traceotel

package
v1.11.6 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetTraceProvider

func SetTraceProvider(tp *sdktrace.TracerProvider)

SetTraceProvider sets global Open Telemetry trace provider to be used.

func TraceHeadersToContext added in v1.9.0

func TraceHeadersToContext(parentCtx context.Context, r *http.Request) (context.Context, bool)

TraceHeadersToContext maps trace headers in request to context. If there were no tracing headers to be propagated, the original context is returned. The returned bool indicates if the original and the new contexts are the same.

Types

type TraceOTel

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

TraceOTel HTTP trace object.

func NewFromContext

func NewFromContext(ctx context.Context) *TraceOTel

NewFromContext creates new TraceOTel object. Returns nil if tracer not found in context.

func NewFromRequest

func NewFromRequest(r *http.Request) *TraceOTel

NewFromRequest creates new TraceOTel object. Returns nil if tracer not found in request.

Warning: Does not return trace from request context.

func NewFromRequestWithContext added in v1.9.0

func NewFromRequestWithContext(parentCtx context.Context, r *http.Request) *TraceOTel

NewFromRequestWithContext creates new TraceOTel object derived from parentCtx. Returns nil if tracer not found in request.

Warning: Does not return trace from request context.

func NewRandom

func NewRandom() *TraceOTel

NewRandom creates new TraceOTel object.

func (*TraceOTel) IsReceived

func (t *TraceOTel) IsReceived() bool

IsReceived tells whether trace data was received (parsed from a request) or a random one.

func (*TraceOTel) SetHeader

func (t *TraceOTel) SetHeader(headers http.Header)

SetHeader sets request headers according to the trace data. This function is dummy, as headers are set at client transport.

func (*TraceOTel) Span

func (t *TraceOTel) Span(r *http.Request) (*http.Request, string)

Span spans the existing trace data and puts that into the request. Does not change the input trace data.

func (*TraceOTel) SpanID

func (t *TraceOTel) SpanID() string

SpanID returns the span ID of the trace data.

func (*TraceOTel) String

func (t *TraceOTel) String() string

String makes a log string from trace data.

func (*TraceOTel) TraceID

func (t *TraceOTel) TraceID() string

TraceID returns the trace ID of the trace data.

Jump to

Keyboard shortcuts

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