Documentation ¶
Index ¶
- Variables
- func SetSpanStatus(span *trace.Span, err error)
- func StartSpan(ctx context.Context, name string, o ...trace.StartOption) (context.Context, *trace.Span)
- func StartSpanWithRemoteParent(ctx context.Context, name string, parent trace.SpanContext, ...) (context.Context, *trace.Span)
- type LogrusExporter
Constants ¶
This section is empty.
Variables ¶
var DefaultSampler = trace.AlwaysSample()
var WithClientSpanKind = trace.WithSpanKind(trace.SpanKindClient)
var WithServerSpanKind = trace.WithSpanKind(trace.SpanKindServer)
Functions ¶
func SetSpanStatus ¶
SetSpanStatus sets `span.SetStatus` to the proper status depending on `err`. If `err` is `nil` assumes `trace.StatusCodeOk`.
func StartSpan ¶ added in v0.10.0
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 ¶ added in v0.10.0
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.
Types ¶
type LogrusExporter ¶
type LogrusExporter struct{}
LogrusExporter is an OpenCensus `trace.Exporter` that exports `trace.SpanData` to logrus output.
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.