Documentation
¶
Overview ¶
metrics/metrics.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HTTPMetrics ¶
HTTPMetrics is a middleware that records request duration into the http_request_duration_seconds histogram.
It uses the chi route pattern (e.g., "/users/{id}") instead of the actual request path (e.g., "/users/123") to prevent label cardinality explosion. Paths longer than 256 characters are truncated with "..." to prevent unbounded memory growth in the metrics registry.
func RegisterDefault ¶
RegisterDefault registers the default Go runtime and process collectors, plus the HTTP request duration histogram. It is safe (and intended) to call this once at startup.
This function will panic if registration fails for reasons other than the collector already being registered. This ensures configuration errors are caught early rather than silently ignored.
Types ¶
This section is empty.