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.
Click to show internal directories.
Click to hide internal directories.