tracing

package
v0.1.5-alpha Latest Latest
Warning

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

Go to latest
Published: May 24, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package tracing configures the project-wide OpenTelemetry tracer.

Init wires an OTLP/gRPC exporter when the standard OTEL_EXPORTER_* env vars are set (see https://opentelemetry.io/docs/specs/otel/protocol/exporter/); otherwise tracing stays a no-op and instrumented call sites pay only the cost of a Tracer.Start/End pair on the noop tracer. This means binaries can be instrumented unconditionally without requiring an operator to run a collector for local development.

Context propagation (W3C traceparent + baggage) is installed unconditionally so a traceparent header on an incoming RPC is honoured even when this process itself isn't exporting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ctx context.Context, serviceName string) (func(context.Context) error, error)

Init configures the global OpenTelemetry tracer for the process. Returns a shutdown function the caller should defer to flush pending spans on exit; the function is safe to call once and is a no-op when tracing is disabled.

serviceName tags every emitted span with the OTel semantic `service.name` attribute so exporters can group traces by binary (e.g. "hpcc-worker", "hpcc-scheduler").

Tracing is enabled only when OTEL_EXPORTER_OTLP_ENDPOINT (or the trace-specific OTEL_EXPORTER_OTLP_TRACES_ENDPOINT) is set. Without it we leave the global noop tracer in place and return a no-op shutdown — instrumentation in the rest of the codebase still compiles and runs but emits nothing.

func Tracer

func Tracer(name string) trace.Tracer

Tracer returns a named tracer for an instrumentation package. Thin passthrough over otel.Tracer kept here so call sites import one place; the noop tracer is returned when Init hasn't run or has been disabled.

Types

This section is empty.

Jump to

Keyboard shortcuts

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