Skip to content

fix(metrics): 14 Snapshot counters reach /stats but never Prometheus, including every summarize/agentdiet failure signal #156

Description

@OsherElhadad

proxy/promexport.go is a hand-maintained list of promLine(&b, …, s.<Field>) calls with nothing
asserting that every metrics.Snapshot field is either exported or deliberately exempt. That is how
cg_expand_unresolved_total went unexported and how cg_frozen_decisions_total shipped reading a
permanent 0 (#154).

The coverage test added in #155 reflects over Snapshot's 66 fields and requires each to be exported
or listed with a reason. Fourteen are recorded there as genuine gaps rather than exempted to make
the test pass. Listing them here so they are trackable outside a test file.

Alertable — how you would notice a component silently failing

Field Why it matters
SummarizeTimeouts, SummarizeErrors summarize restructures the whole transcript. Silent failure means no compaction and no signal.
AgentDietTimeouts, AgentDietErrors Same, for the agentdiet reflection pass.
LLMTruncated A cheap-model reply cut short produces a partial filter. Distinguishable from an error only by this counter.

cg_llm_errors_total and cg_llm_timeouts_total are exported for extract_llm, so the pattern
exists and these three components simply never got the same treatment.

Savings denominators

Field Why it matters
AttemptedTokens The divisor for "of what we tried to compact" — one of the four labelled denominators.
FrozenTokens The cache-frozen ceiling. /metrics cannot express why savings plateaued without it.
SavingsPctAttempted, SavingsPctNewInput Two of the four headline ratios.

The dashboard makes a point of naming what each denominator divides by; Prometheus currently cannot
compute any of them, because the divisors are not exported.

Remaining

SyncEnforced, CompactionResets, UpstreamMsAvgBypassed, SSETTFBMsAvgBuf,
SSEExpandAfterStream.

Notes for whoever picks this up

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions