feat(mcp): count admitted initializes, the denominator the refusal counter needs #28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat-initialize-admitted"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #21. The gap I filed two hours ago, closed.
What was wrong with v0.2.0's instrumentation
caldav_mcp_initialize_refusals_totalwas added to investigate how many sessions an identity opens. It cannot answer that. It counts only refusals, so there is no rate and no baseline. A night was spent on that question and the instrument built to investigate it was blind to it.The general form, now in
AGENTS.md: when adding a counter for a bad outcome, ask whether anyone will need the denominator. A refusal rate needs both halves and only one of them ever feels worth the line.What this adds
caldav_mcp_initialize_admitted_total.infoline per admitted initialize, carryinguser_hash.The per-identity count is in the log and not in a metric label, because a hash label is unbounded cardinality and identities do not belong in a metrics backend.
user_hashreverses against a candidate list, which is exactly why it works in a log line and exactly why it must not become a label.What it counts, stated so nobody reads it as more
It counts requests the limiter admitted. That is not the same as sessions
rmcpwent on to create: the limiter is the last gate observable outside the MCP router, and a request can pass it and still fail further in. The metric name saysadmittedrather thancreatedfor that reason.It is still the denominator the refusal counter needs, and it is still the number #21 wants, because #21's claim is about how many initializes a workload costs rather than how many sessions survive.
Why it matters past this repo
#21's claim spans three servers.
matrix-mcpestablished four session initializes in a few minutes by reading the call graph;m365-mcpestablished a fresh session per tool call the same way. Neither can produce a count. This is the only one of the three that can, and until this change it could not either.matrix-mcpalso flagged that the claude.ai connector and a Claude Code channel session may be different clients. If so, two clients showing one shape is a stronger fact about the ecosystem and a weaker one about any single implementation — and separating them needs per-identity acceptance counts, which is what the log line gives.Verified by mutation
admitted_and_refused_are_counted_separatelyBoth with the pattern asserted to apply and the harness checked for a
test result:line. The test asserts the two are separate families, because sharing one would make the rate this pair exists to produce unreadable.Gates
cargo fmt --check,cargo clippy -D warnings,cargo test --all-features(117 + 9), green onrustc 1.98.0, through the shared build slot.Release
An instrument that exists and is not deployed answers nothing, which is tonight's lesson in one line. Tagging
v0.2.1after this merges, and the pod digest goes to Clark and Alan.