tracing

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 26 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(handler http.Handler) http.Handler

Middleware returns a new HTTP handler that will trace all requests with the HTTP method and path as the span name.

func NewTracer added in v0.32.0

func NewTracer(name string) trace.Tracer

NewTracer returns a trace.Tracer that skips span creation when tracing is disabled. Use this instead of otel.Tracer().

func Transport

func Transport(rt http.RoundTripper) http.RoundTripper

Transport wraps the provided http.RoundTripper with one that starts a span and injects the span context into the outbound request headers. If the provided http.RoundTripper is nil, http.DefaultTransport will be used as the base http.RoundTripper.

Types

type Manager

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

Manager is capable of building, (re)installing and shutting down the tracer provider.

func NewManager

func NewManager(logger *slog.Logger) *Manager

NewManager creates a new tracing manager.

func (*Manager) ApplyConfig

func (m *Manager) ApplyConfig(cfg TracingConfig) error

ApplyConfig takes care of refreshing the tracing configuration by shutting down the current tracer provider (if any is registered) and installing a new one.

func (*Manager) Run

func (m *Manager) Run()

Run starts the tracing manager. It registers the global text map propagator and error handler. It is blocking.

func (*Manager) Stop

func (m *Manager) Stop()

Stop gracefully shuts down the tracer provider and stops the tracing manager.

type TracingClientType added in v0.32.0

type TracingClientType string
const (
	TracingClientHTTP TracingClientType = "http"
	TracingClientGRPC TracingClientType = "grpc"

	GzipCompression = "gzip"
)

func (*TracingClientType) UnmarshalYAML added in v0.32.0

func (t *TracingClientType) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type TracingConfig added in v0.32.0

type TracingConfig struct {
	ClientType       TracingClientType    `yaml:"client_type,omitempty"`
	Endpoint         string               `yaml:"endpoint,omitempty"`
	SamplingFraction float64              `yaml:"sampling_fraction,omitempty"`
	Insecure         bool                 `yaml:"insecure,omitempty"`
	TLSConfig        *commoncfg.TLSConfig `yaml:"tls_config,omitempty"`
	Headers          *commoncfg.Headers   `yaml:"headers,omitempty"`
	Compression      string               `yaml:"compression,omitempty"`
	Timeout          model.Duration       `yaml:"timeout,omitempty"`
}

TracingConfig configures the tracing options.

func (*TracingConfig) SetDirectory added in v0.32.0

func (t *TracingConfig) SetDirectory(dir string)

SetDirectory joins any relative file paths with dir.

func (*TracingConfig) UnmarshalYAML added in v0.32.0

func (t *TracingConfig) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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