ot

package
v0.15.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TracerName = "containerd-shim-runhcs-v1"
)

Variables

View Source
var DefaultSampler = sdktrace.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 the span's OpenTelemetry status based on `err`.

If `err` is non-nil the error is recorded on the span and the status is set to `codes.Error`.

If `err` is nil the span is left in its default (Unset) status. The exporter treats Unset the same as Ok for level selection (Info), so downstream log level does not change. Leaving the status Unset instead of calling SetStatus(Ok, "") avoids the OpenTelemetry spec's "Ok is terminal" rule, under which a subsequent SetStatus(Error, ...) would be silently dropped.

func StartSpan

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

StartSpan wraps otel.Start(), 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.SpanStartOption) (context.Context, trace.Span)

StartSpanWithRemoteParent wraps "go.opentelemetry.io/otel/trace".ContextWithRemoteSpanContext

See StartSpan for more information.

Types

type LogrusExporter

type LogrusExporter struct{}

LogrusExporter is an OpenTelemetry `sdktrace.SpanExporter` that exports `trace.ReadOnlySpan` to logrus output.

func (*LogrusExporter) ExportSpans

func (le *LogrusExporter) ExportSpans(ctx context.Context, spans []sdktrace.ReadOnlySpan) error

ExportSpans exports each `spans` based on 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.

func (*LogrusExporter) Shutdown

func (le *LogrusExporter) Shutdown(ctx context.Context) error

Jump to

Keyboard shortcuts

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