...

Package oc

import "github.com/Microsoft/hcsshim/internal/oc"
Overview
Index

Overview ▾

Variables

var DefaultSampler = trace.AlwaysSample()
var WithClientSpanKind = trace.WithSpanKind(trace.SpanKindClient)
var WithServerSpanKind = trace.WithSpanKind(trace.SpanKindServer)

func SetSpanStatus

func SetSpanStatus(span *trace.Span, err error)

SetSpanStatus sets `span.SetStatus` to the proper status depending on `err`. If `err` is `nil` assumes `trace.StatusCodeOk`.

func StartSpan

func StartSpan(ctx context.Context, name string, o ...trace.StartOption) (context.Context, *trace.Span)

StartSpan wraps "go.opencensus.io/trace".StartSpan, but, if the span is sampling, adds a log entry to the context that points to the newly created span.

func StartSpanWithRemoteParent

func StartSpanWithRemoteParent(ctx context.Context, name string, parent trace.SpanContext, o ...trace.StartOption) (context.Context, *trace.Span)

StartSpanWithRemoteParent wraps "go.opencensus.io/trace".StartSpanWithRemoteParent.

See StartSpan for more information.

type LogrusExporter

LogrusExporter is an OpenCensus `trace.Exporter` that exports `trace.SpanData` to logrus output.

type LogrusExporter struct{}

func (*LogrusExporter) ExportSpan

func (le *LogrusExporter) ExportSpan(s *trace.SpanData)

ExportSpan exports `s` based on the the following rules:

1. All output will contain `s.Attributes`, `s.SpanKind`, `s.TraceID`, `s.SpanID`, and `s.ParentSpanID` for correlation

2. Any calls to .Annotate will not be supported.

3. The span itself will be written at `logrus.InfoLevel` unless `s.Status.Code != 0` in which case it will be written at `logrus.ErrorLevel` providing `s.Status.Message` as the error value.