metrics

package
v1.1.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPMetricsCollector

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

HTTPMetricsCollector implements NamedCollector and integrates OpenTelemetry HTTP metrics with the existing Prometheus metrics infrastructure.

func NewHTTPMetricsCollector

func NewHTTPMetricsCollector(ctx context.Context, _ *config.Config, serviceName string, log logrus.FieldLogger) *HTTPMetricsCollector

NewHTTPMetricsCollector creates a new HTTPMetricsCollector that integrates OpenTelemetry HTTP metrics with Prometheus. It initializes the OpenTelemetry meter provider and creates a Prometheus exporter for metrics collection.

func (*HTTPMetricsCollector) Collect

func (c *HTTPMetricsCollector) Collect(ch chan<- prometheus.Metric)

Collect forwards the Collect call to the OpenTelemetry Prometheus registry

func (*HTTPMetricsCollector) Describe

func (c *HTTPMetricsCollector) Describe(ch chan<- *prometheus.Desc)

Describe forwards the Describe call to the OpenTelemetry Prometheus registry

func (*HTTPMetricsCollector) Shutdown

func (c *HTTPMetricsCollector) Shutdown() error

Shutdown gracefully shuts down the OpenTelemetry meter provider

type MetricsServer added in v1.0.0

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

MetricsServer is an HTTP server exposing a Prometheus /metrics endpoint. By default it listens on 127.0.0.1 and serves metrics from the provided collectors.

func NewMetricsServer added in v1.0.0

func NewMetricsServer(log logrus.FieldLogger, collectors ...prometheus.Collector) *MetricsServer

NewMetricsServer creates a Prometheus metrics server with the given logger.

func (*MetricsServer) Run added in v1.0.0

func (m *MetricsServer) Run(ctx context.Context, options ...MetricsServerOption) error

Run starts the metrics HTTP server and blocks until the provided context is canceled or an error occurs. Optional settings can be supplied via MetricsServerOption.

type MetricsServerOption added in v1.0.0

type MetricsServerOption func(*metricsServerOptions)

MetricsServerOption configures a MetricsServer.

func WithHandlerWrapper added in v1.0.0

func WithHandlerWrapper(wrap func(http.Handler) http.Handler) MetricsServerOption

WithHandlerWrapper injects middleware around /metrics (e.g., OpenTelemetry).

func WithListenAddr added in v1.0.0

func WithListenAddr(addr string) MetricsServerOption

WithListenAddr sets host:port. Examples: "127.0.0.1:15690", "0.0.0.0:15690", "[::]:15690".

func WithMaxInflight added in v1.0.0

func WithMaxInflight(n int) MetricsServerOption

WithMaxInflight limits concurrent scrapes (0 = unlimited).

func WithScrapeTimeout added in v1.0.0

func WithScrapeTimeout(d time.Duration) MetricsServerOption

WithScrapeTimeout sets a server-side cap for a single scrape (0 = no cap).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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