Documentation
¶
Overview ¶
Package metrics builds an OpenTelemetry MeterProvider that pushes metrics to an OTLP/HTTP collector on a periodic interval, configured from a resolved otelcore.Settings. It is one of the GTB observability signals; the standard server metrics (http.server.*, rpc.server.*) are produced by the otelhttp and otelgrpc instrumentation in pkg/http and pkg/grpc, which read whichever MeterProvider is installed globally.
Index ¶
Constants ¶
const DefaultInterval = 60 * time.Second
DefaultInterval is the metric export interval applied when none is configured.
Variables ¶
This section is empty.
Functions ¶
func NewProvider ¶
func NewProvider( ctx context.Context, res *resource.Resource, s otelcore.Settings, opts ...Option, ) (*sdkmetric.MeterProvider, error)
NewProvider builds a MeterProvider that pushes metrics to the OTLP/HTTP collector described by s on a periodic interval. When s.Endpoint is empty the exporter falls back to the standard OTEL_EXPORTER_OTLP_* environment variables.
The caller owns the returned provider's Shutdown — typically by registering it on the controls.Controller so the final metric batch flushes on graceful stop.
Types ¶
type Option ¶
type Option func(*config)
Option configures the meter provider.
func WithInterval ¶
WithInterval sets the PeriodicReader export interval. Defaults to DefaultInterval.