oc

package
v0.12.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

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 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL