Documentation
¶
Overview ¶
Package telemetry gives every app /metrics (Prometheus exposition, OpenTelemetry-compatible), /healthz (liveness) and /readyz (readiness: every service that can check itself is asked). Request metrics are labelled by route pattern, never by raw path, so cardinality stays bounded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Named ¶
type Named interface {
Name() string
}
Named services label their stats; otherwise the Go type name is used.
type Ready ¶
Ready is implemented by services that can report readiness: a database pool that pings, a bus that is connected. /readyz fails while any returns an error.
type Stats ¶
Stats is implemented by services that expose gauges: pool sizes, open connections, calls in flight. Keys are metric-safe names.
type Telemetry ¶
type Telemetry struct {
// contains filtered or unexported fields
}
Telemetry is the registry and the collectors of one app.
func New ¶
New builds a registry with the Go runtime and process collectors, the request metrics and a collector that walks services (each is called with every registered service).
func (*Telemetry) Middleware ¶
Middleware records every request. Place it directly around the router so the matched pattern (http.Request.Pattern) is visible.
func (*Telemetry) Readyz ¶
Readyz asks every Ready service, with a deadline, and replies 503 while any fails. The body lists each check.
func (*Telemetry) Registry ¶
func (t *Telemetry) Registry() *prometheus.Registry
Registry exposes the registry for packs that add their own metrics.