telemetry

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package telemetry provides Prometheus-based metrics collection and HTTP handler support for the framework.

Index

Constants

This section is empty.

Variables

View Source
var (

	// RequestsTotal counts the total number of HTTP requests received.
	RequestsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "http_requests_total",
			Help: "Total number of HTTP requests received",
		},
		[]string{"method", "path", "status"},
	)

	// RequestDurationSeconds measures the duration of HTTP requests.
	RequestDurationSeconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "http_request_duration_seconds",
			Help:    "Duration of HTTP requests in seconds",
			Buckets: prometheus.DefBuckets,
		},
		[]string{"method", "path", "status"},
	)

	// ActiveConnections tracks the current number of active connections.
	ActiveConnections = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "active_connections",
			Help: "Current number of active connections",
		},
	)
)

Functions

func ConfigureTelemetry

func ConfigureTelemetry(useDefaultRegistry bool, collectors ...prometheus.Collector)

ConfigureTelemetry initializes the telemetry registry and registers the provided collectors. If useDefaultRegistry is true, uses the default Prometheus registry; otherwise creates a new one.

func GetHTTPHandler

func GetHTTPHandler(opts promhttp.HandlerOpts) http.Handler

GetHTTPHandler returns an HTTP handler for the prometheus metrics endpoint.

Types

This section is empty.

Jump to

Keyboard shortcuts

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