tracing

package
v2.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetClientSpan added in v2.0.6

func SetClientSpan(ctx context.Context, span trace.Span, m interface{})

func SetServerSpan added in v2.0.6

func SetServerSpan(ctx context.Context, span trace.Span, m interface{})

Types

type Metadata added in v2.0.6

type Metadata struct{}

Metadata is tracing metadata propagator

func (Metadata) Extract added in v2.0.6

func (b Metadata) Extract(parent context.Context, carrier propagation.TextMapCarrier) context.Context

Extract returns a copy of parent with the metadata from the carrier added.

func (Metadata) Fields added in v2.0.6

func (b Metadata) Fields() []string

Fields returns the keys who's values are set with Inject.

func (Metadata) Inject added in v2.0.6

func (b Metadata) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject sets metadata key-values from ctx into the carrier.

type Option

type Option func(*options)

Option is tracing option.

func WithGlobalPropagator

func WithGlobalPropagator() Option

WithGlobalPropagator set the global TextMapPropagator

func WithGlobalTracerProvider

func WithGlobalTracerProvider() Option

WithGlobalTracerProvider set the registered global trace provider

func WithPropagator

func WithPropagator(propagator propagation.TextMapPropagator) Option

WithPropagator with tracer propagator.

func WithTracerName

func WithTracerName(tracerName string) Option

WithTracerName with tracer name

func WithTracerProvider

func WithTracerProvider(provider trace.TracerProvider) Option

WithTracerProvider with tracer provider. By default, it uses the global provider that is set by otel.SetTracerProvider(provider).

type Tracer

type Tracer struct {
	// contains filtered or unexported fields
}

Tracer is otel span tracer

func NewTracer

func NewTracer(kind trace.SpanKind, spanName string, opts ...Option) *Tracer

NewTracer create tracer instance

func (*Tracer) End

func (t *Tracer) End(_ context.Context, span trace.Span, err error, attrs ...attribute.KeyValue)

End finish tracing span

func (*Tracer) Inject

func (t *Tracer) Inject(ctx context.Context, carrier propagation.TextMapCarrier)

Inject set cross-cutting concerns from the Context into the carrier.

func (*Tracer) Start

func (t *Tracer) Start(ctx context.Context, operation string, carrier propagation.TextMapCarrier, attrs ...attribute.KeyValue) (context.Context, trace.Span)

Start starts tracing span

Jump to

Keyboard shortcuts

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