tracing

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tracing builds an OpenTelemetry TracerProvider that batches spans to an OTLP/HTTP collector, configured from a resolved otelcore.Settings. It is one of the GTB observability signals; the transport span instrumentation lives in pkg/http and pkg/grpc and reads whichever provider is installed globally.

Index

Constants

View Source
const DefaultSampling = 0.1

DefaultSampling is the parent-based ratio applied when none is configured. It is deliberately production-safe: set telemetry.tracing.sampling = 1.0 to record every trace while developing or following the tutorial.

Variables

This section is empty.

Functions

func NewProvider

func NewProvider(
	ctx context.Context,
	res *resource.Resource,
	s otelcore.Settings,
	opts ...Option,
) (*sdktrace.TracerProvider, error)

NewProvider builds a TracerProvider that batches spans to the OTLP/HTTP collector described by s. When s.Endpoint is empty the exporter falls back to the standard OTEL_EXPORTER_OTLP_* environment variables. Sampling is parent-based around a TraceID-ratio sampler, so a sampled trace stays whole across services.

The caller owns the returned provider's Shutdown — typically by registering it on the controls.Controller so spans flush on graceful stop.

Types

type Option

type Option func(*config)

Option configures the tracer provider.

func WithSampling

func WithSampling(ratio float64) Option

WithSampling sets the parent-based head sampling ratio (0.0–1.0). Defaults to DefaultSampling.

Jump to

Keyboard shortcuts

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