tracer

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOTel

func GetOTel() bool

GetOTel returns if Open Telemetry is enabled.

func SetOTel

func SetOTel(enabled bool, tp *sdktrace.TracerProvider)

SetOTel enables/disables Open Telemetry. By default it is disabled. Tracer provider can be set with an exporter and collector endpoint you need.

func SetOTelGrpc added in v1.7.3

func SetOTelGrpc(target string) error

SetOTelGrpc enables Open Telemetry. Activates trace export to the OTLP gRPC collector target address defined. Port is 4317, unless defined otherwise in provided target string.

Types

type Tracer

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

Tracer is a HTTP trace handler of various kinds.

func NewFromRequest

func NewFromRequest(r *http.Request) *Tracer

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

func NewFromRequestOrRandom

func NewFromRequestOrRandom(r *http.Request) *Tracer

NewFromRequestOrRandom creates new tracer object. If no trace data, then create random. Never returns nil.

Warning: Does not return trace from request context.

func NewRandom

func NewRandom() *Tracer

NewRandom creates a tracer object with random data.

func (*Tracer) IsReceived

func (t *Tracer) IsReceived() bool

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

func (*Tracer) SetHeader

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

SetHeader sets request headers according to the trace data. Input headers object must not be nil.

func (*Tracer) Span

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

Span spans the existing trace data and puts that into the request. Returns the updated request and a trace string for logging. Does not change the input trace data.

func (*Tracer) SpanID

func (t *Tracer) SpanID() string

SpanID returns the span ID of the trace data.

func (*Tracer) String

func (t *Tracer) String() string

String makes a log string from trace data.

func (*Tracer) TraceID

func (t *Tracer) 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