Skip to main content

Module meter

Module meter 

Source
Expand description

Per-addon / per-tool usage metering (P5 — discovery & observability).

Every gateway proxy call (crate::core::gateway::proxy) is attributed to its owning server and tool, and counted in a local ledger (<data_dir>/addons/usage.json). This is the foundation for marketplace analytics, builder dashboards and usage-metered billing (Track B) — without it there is no honest basis to pay a builder or show “most-used” tools.

Local-only and side-channel: metering writes to a state file, never to a tool output body, so it cannot perturb output determinism (#498). Controlled by addons.metering (default on).

Structs§

ServerUsage
Aggregated usage for one gateway server (= one addon).
ToolStat
Call counters for a single downstream tool.
UsageLedger
The on-disk usage ledger (<data_dir>/addons/usage.json).

Functions§

record
Record a single proxied call for server::tool. No-op when addons.metering is off or the data dir is unavailable. Best-effort: a metering write failure never affects the proxied call’s result.