trace

package
v3.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate() string

func Get

func Get(ctx context.Context) (t string)

func InitProvider added in v3.7.0

func InitProvider(ctx context.Context, cfg ProviderConfig) (func(context.Context) error, error)

InitProvider sets up the global OTel TracerProvider and W3C TraceContext propagator.

If tracing is disabled or no endpoint is configured, the provider returned is just a nop.

The returned shutdown function must be called (e.g. via defer) to flush and stop the exporter.

func Set

func Set(ctx context.Context, trace string) context.Context

ContextSetTrace stores the trace in the context.

Types

type ProviderConfig added in v3.7.0

type ProviderConfig struct {
	Enabled     bool
	Endpoint    string // OTLP/gRPC endpoint, e.g. "localhost:4317"
	Collector   string // OTLP/HTTP collector URL, e.g. "http://localhost:4318"
	ServiceName string
	Log         *zerolog.Logger
}

ProviderConfig holds the tracing configuration.

Jump to

Keyboard shortcuts

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