Documentation
¶
Overview ¶
Package metrics owns the Prometheus registry and the collectors exposed at GET /v0/metrics (Phase 2). It provides a chi-compatible middleware that records per-request count + duration keyed by route *pattern* (never the raw path, to keep label cardinality bounded) and a hook the events path calls to report ingest counts. promhttp renders the exposition format — we never hand-format Prometheus text.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics holds a private registry and the TinyRaven collectors. Use New to build one; the zero value is not usable.
func New ¶
func New() *Metrics
New builds a Metrics with its own registry and registers all collectors. A dedicated registry (not the global default) keeps tests isolated and avoids duplicate-registration panics when several instances coexist.
func (*Metrics) Handler ¶
Handler serves the metrics exposition format from this instance's registry. Mount it at /v0/metrics.
func (*Metrics) IngestObserved ¶
IngestObserved reports ingest outcomes from the events path (orchestrator calls it after gatherer.Ingest returns its counts).
func (*Metrics) Middleware ¶
Middleware records request count + duration + status per route. Labels use the chi route *pattern* (e.g. "/v0/pipes/{name}.json"), resolved after the handler runs since chi fills the RouteContext during ServeHTTP. Pipe routes (those with a "name" URL param) also increment the per-pipe counter.