telemetry

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// OTLPEnabled controls whether metrics are pushed to an OTLP endpoint.
	OTLPEnabled bool
	// OTLPEndpoint is the base URL of the OTLP HTTP receiver (e.g. "http://localhost:4318").
	OTLPEndpoint string
	// OTLPInterval is how often metrics are pushed to the OTLP endpoint.
	OTLPInterval time.Duration
}

Config holds telemetry configuration.

type MetadataStats

type MetadataStats struct {
	CacheGets    uint64
	CacheMisses  uint64
	CacheEntries uint64
	DBSizeBytes  int64
}

MetadataStats is a snapshot of metadata subsystem metrics captured at scrape time.

type Provider

type Provider struct {

	// PrometheusHTTP is the HTTP handler that serves Prometheus-format metrics.
	PrometheusHTTP http.Handler
	// contains filtered or unexported fields
}

Provider wraps the OTel MeterProvider and exposes the Prometheus HTTP handler.

func Setup

func Setup(ctx context.Context, cfg Config) (*Provider, error)

Setup initializes the OTel MeterProvider with a Prometheus pull reader and, when cfg.OTLPEnabled is true, an OTLP HTTP push reader. It also sets the global OTel MeterProvider so that otelhttp and other libraries pick it up.

func (*Provider) MeterProvider

func (p *Provider) MeterProvider() metric.MeterProvider

MeterProvider returns the underlying OTel MeterProvider.

func (*Provider) RegisterMetadataObservers

func (p *Provider) RegisterMetadataObservers(stats func() MetadataStats) error

RegisterMetadataObservers wires up observable instruments that read from the metadata subsystem at each scrape/push interval. Call this after both the Provider and the metadata Manager are initialised.

func (*Provider) Shutdown

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

Shutdown flushes and closes all exporters. Call during graceful shutdown.

Jump to

Keyboard shortcuts

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