tracing

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package tracing wires up an OpenTelemetry tracer provider configured by the standard OTEL_EXPORTER_OTLP_ENDPOINT environment variable. When no exporter is configured the provider is a no-op, so instrumented code pays a single indirect-call cost and emits nothing. The intent is that Fleetsweeper's scan code can sprinkle spans freely without forcing every deployment to run a collector.

Index

Constants

View Source
const TracerName = "github.com/dcadolph/fleetsweeper"

TracerName is the instrumentation library name used for spans emitted from Fleetsweeper packages. Backends and dashboards key off this string.

Variables

This section is empty.

Functions

func Init

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

Init bootstraps OpenTelemetry tracer and meter providers for the process. It returns a shutdown function that the caller must invoke before exit so pending spans and metric points are flushed.

Behavior:

  • If OTEL_EXPORTER_OTLP_ENDPOINT (or the trace-specific variant) is unset, the trace provider is the no-op SDK default.
  • If OTEL_EXPORTER_OTLP_ENDPOINT (or the metrics-specific variant) is unset, the meter provider is the no-op SDK default.
  • When either endpoint is set, an OTLP-HTTP exporter is installed for the corresponding signal with the appropriate processor.
  • The W3C TraceContext propagator is installed unconditionally so downstream callers can already participate in distributed traces.

Version is the service version emitted as a resource attribute.

func Meter

func Meter() metric.Meter

Meter returns the package-scoped meter used to register metric instruments from anywhere in Fleetsweeper. Safe to call before Init: the global meter provider falls back to a no-op until Init installs one.

func Tracer

func Tracer() trace.Tracer

Tracer returns the package-scoped tracer used to start spans from anywhere in Fleetsweeper. Safe to call before Init: the global provider falls back to a no-op until Init installs one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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