Documentation
¶
Overview ¶
Package metrics provides Prometheus request metrics for Fiber apps: a middleware that records request count and latency, and a handler that serves the Prometheus exposition format. It is a thin wrapper over prometheus/client_golang's default registry (which also exposes the standard Go-runtime and process collectors).
Index ¶
Constants ¶
const MetricsPath = "/metrics"
MetricsPath is the conventional scrape path. Middleware skips it so scrapes are not self-counted.
Variables ¶
This section is empty.
Functions ¶
func Handler ¶
Handler serves the Prometheus exposition format (default registry) as a Fiber handler.
func Middleware ¶
Middleware returns a Fiber handler that records request count and duration, labeled by method, route template (e.g. "/items/:id"), and status.
Types ¶
type Option ¶
type Option func(*config)
Option configures the metrics middleware.
func WithNamespace ¶
WithNamespace prefixes all metric names with namespace + "_". Because the metric vectors are registered once (on the first Middleware call), the namespace is captured from that first call and fixed thereafter.