Documentation
¶
Overview ¶
Package metrics owns chatz's Prometheus registry and the per-subsystem metric vectors. It is constructed once at boot (no package globals) and passed to the recorders that emit; the /metrics handler and the pprof mux are served on internal-only ports (never the public ingress).
Index ¶
Constants ¶
const ( TokenKindInput = "input" TokenKindOutput = "output" TokenKindCache = "cache_read" )
Token kinds for the llm_tokens_total counter.
const ( OutcomeOK = "ok" OutcomeError = "error" )
Outcomes for request counters (bounded set).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics holds the registry and the metric vectors. Emit via the Record* methods; expose via Handler / PprofHandler.
func New ¶
New builds the registry, registers the runtime + build-info collectors and the subsystem vectors, and returns the Metrics.
func (*Metrics) PprofHandler ¶
PprofHandler returns a mux with the net/http/pprof endpoints under /debug/pprof/. Internal-only: never mount on the public ingress.
func (*Metrics) RecordLLMRequest ¶
RecordLLMRequest records one LLM call's latency + count under the outcome.
func (*Metrics) RecordLLMTokens ¶
RecordLLMTokens adds token counts for a call, by kind.