tracing

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package tracing wires OpenTelemetry distributed tracing for Fiber apps: it builds an OTLP/HTTP tracer provider (configured by the standard OTEL_ env vars), installs it and the W3C propagator as the OTel globals, and returns a shutdown function for graceful shutdown.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogFields

func LogFields(ctx context.Context) (traceID, spanID string, ok bool)

LogFields returns the trace and span IDs from ctx's span context. ok is false when ctx carries no valid span context.

func Setup

func Setup(ctx context.Context, opts ...Option) (func(context.Context) error, error)

Setup builds an OTLP/HTTP tracer provider, installs it and the W3C trace context + baggage propagator as the OTel globals, and returns a shutdown function that flushes and stops the provider. Exporter endpoint and headers come from the standard OTEL_ env vars (e.g. OTEL_EXPORTER_OTLP_ENDPOINT).

Types

type Option

type Option func(*config)

Option configures tracer setup.

func WithSampler

func WithSampler(s sdktrace.Sampler) Option

WithSampler overrides the default ParentBased(AlwaysSample) sampler.

func WithServiceName

func WithServiceName(name string) Option

WithServiceName sets the resource service.name used when OTEL_SERVICE_NAME is not set in the environment.

Jump to

Keyboard shortcuts

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