Help us shape the future of Go! Take the 2026 Go Developer Survey

telemetry

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

Provider holds all OTEL SDK providers and shuts them down gracefully. All methods are safe to call on a zero-value Provider (OTEL disabled).

func Setup

func Setup(
	ctx context.Context,
	cfg config.OTelConfig,
	promReg *prometheus.Registry,
	svcVersion string,
) (*Provider, error)

Setup initialises OTEL TracerProvider, MeterProvider (bridged from the Prometheus registry), and LoggerProvider, then registers them as globals.

When cfg.Endpoint is empty all three signals remain as no-ops (the OTEL SDK default), and a zero-value Provider is returned.

func (*Provider) LogHandler

func (p *Provider) LogHandler() slog.Handler

LogHandler returns a slog.Handler that ships records to the OTEL LoggerProvider. Returns nil when OTEL is disabled.

func (*Provider) Shutdown

func (p *Provider) Shutdown(ctx context.Context) error

Shutdown flushes and stops all OTEL providers.

Jump to

Keyboard shortcuts

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