telemetry

package
v0.0.0-...-ae8c3b3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package telemetry provides OpenTelemetry metrics integration for metalog.

The package creates a metric.MeterProvider from configuration, supporting pluggable exporters (Prometheus, OTLP, or custom). Enterprise deployments can register custom exporters via RegisterExporter using the same init() pattern as storage backends and message transformers.

When telemetry is disabled, subsystems use a no-op meter with zero overhead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterExporter

func RegisterExporter(name string, factory ExporterFactory)

RegisterExporter registers a named exporter factory. Enterprise deployments can add custom exporters (e.g., Datadog, M3) via init() in a separate module.

Types

type Config

type Config struct {
	Enabled  bool              `yaml:"enabled"`
	Exporter string            `yaml:"exporter"` // "prometheus", "otlp", or custom registered name
	Options  map[string]string `yaml:"options"`  // exporter-specific options
}

Config holds telemetry configuration.

type ExporterFactory

type ExporterFactory func(cfg map[string]string) (sdkmetric.Reader, error)

ExporterFactory creates an OTel metric reader from configuration.

type Provider

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

Provider wraps an OTel MeterProvider with lifecycle management.

func NewProvider

func NewProvider(cfg Config) (*Provider, error)

NewProvider creates a Provider from configuration. Returns a no-op provider if telemetry is disabled.

func (*Provider) Handler

func (p *Provider) Handler() http.Handler

Handler returns the Prometheus HTTP handler, or nil if not using Prometheus.

func (*Provider) Meter

func (p *Provider) Meter(name string) metric.Meter

Meter returns a named Meter for a subsystem. If telemetry is disabled, returns a no-op meter.

func (*Provider) Shutdown

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

Shutdown flushes and shuts down the meter provider.

Jump to

Keyboard shortcuts

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