telemetry

package
v0.0.0-...-a1393ee Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ctx context.Context) (shutdown func(context.Context) error, err error)

Init bootstraps the OpenTelemetry TracerProvider.

When OTEL_ENABLED is "true" it connects an OTLP/gRPC exporter to the collector at OTEL_EXPORTER_OTLP_ENDPOINT (default: localhost:4317) and registers a BatchSpanProcessor. All standard OTEL_* env vars (endpoint, headers, TLS, etc.) are respected automatically by the SDK.

When OTEL_ENABLED is missing or any other value, a no-op TracerProvider is installed so the rest of the code can call otel.Tracer() safely without branching.

It returns a shutdown function that must be called before the process exits (e.g. deferred in main) to flush buffered spans.

func TraceIDFromContext

func TraceIDFromContext(ctx context.Context) (traceID, spanID string)

TraceIDFromContext extracts the W3C trace ID and span ID from the current span in ctx. Returns empty strings when there is no active span.

Types

This section is empty.

Jump to

Keyboard shortcuts

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