Shared stats registry + gRPC Stats API
A single namespaced counter map on the engine that every service reports into: ServiceCtx::count(key) is folded in after each command, the engine bumps its own events (botserv.kick/ban/warn/greet/trigger), and a per-service command counter (nickserv.command, chanserv.command, …) is tallied in dispatch. stats_snapshot() merges those with live gauges from the store (accounts/channels/bots/opers total). Exposed over gRPC as a new Stats service (Get -> map<string,uint64>), authorized by the same bearer token as Directory/Accounts — so any consumer (a dashboard, Django) reads every module's stats through one pipe. New service is additive to the proto; existing RPCs untouched.
This commit is contained in:
parent
5d1bfb3144
commit
d4e2c905f2
4 changed files with 111 additions and 8 deletions
|
|
@ -138,3 +138,15 @@ message ForceLogoutReply { Status status = 1; uint32 sessions_cleared = 2; }
|
|||
|
||||
message GroupNickRequest { string nick = 1; string account = 2; }
|
||||
message UngroupNickRequest { string nick = 1; }
|
||||
|
||||
// Stats API: a flat, namespaced counter map any service contributes to
|
||||
// (e.g. "nickserv.command", "botserv.kick", "channels.total"). Read-only.
|
||||
service Stats {
|
||||
rpc Get(StatsRequest) returns (StatsResponse);
|
||||
}
|
||||
|
||||
message StatsRequest {}
|
||||
message StatsResponse {
|
||||
map<string, uint64> counters = 1;
|
||||
uint64 collected_at = 2; // unix seconds when this snapshot was taken
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue