Skip to content

Add command metrics#267

Open
llixon wants to merge 9 commits into
Story-Of-Alicia:masterfrom
llixon:feat/command-metrics
Open

Add command metrics#267
llixon wants to merge 9 commits into
Story-Of-Alicia:masterfrom
llixon:feat/command-metrics

Conversation

@llixon

@llixon llixon commented May 26, 2026

Copy link
Copy Markdown

Implements command timing metrics as discussed, collected per-server and synchronized to Postgres.

What's collected

  • Send/receive time - duration of network I/O, measured in the client read/write loops and reported up to the owning network::Server.
  • Processing time - time spent inside command handlers, measured around the handler dispatch in both CommandServer and ChatterServer.

Both are stored in TimeSeriesData and pulled by telemetry each sync tick, then written to the metric tables.

Let me know if you want anything changed or added!

Design

Pull-based, per the discussion: the servers own the time series and expose getters (GetSendTimeStatistics(), GetReceiveTimeStatistics(), GetProcessingTimeStatistics()), and Telemetry reaches them via the director → command/chatter server → server chain. Nothing in the network layer depends on telemetry.

Covers all six servers: lobby, ranch, race, messenger, all-chat, and private chat. Send/receive live on the shared network::Server; processing time lives on the dispatching server (CommandServer / ChatterServer).

Storage notes

  • Timings stored as microsecond counts (int64 internally, int column to match the existing metrics).
  • Timing tables intentionally omit the time primary key the count metrics use, since many samples can share a one-second timestamp.

Retention

On startup, rows older than 30 days are deleted from all metric tables (CleanOldData).

Drive-by fix

Noticed during testing that Telemetry::Initialize() used a second if instead of else if, so the "unknown backend" warning fired even for valid backends (e.g. none). Fixed.

Testing

Verified end-to-end against a local Postgres: lobby, ranch, messenger, and all-chat tables populate with sane microsecond values and no constraint violations. Private chat uses the same ChatterServer path as messenger/all-chat; its tables are created and wired identically but weren't exercised with live traffic (requires two clients whispering).

llixon and others added 9 commits May 26, 2026 20:53
Collects per-server network I/O and command handler processing times,
stored in TimeSeriesData and synchronized to Postgres metric tables.
Includes startup retention cleanup for data older than 30 days.
Collects per-server network I/O and command handler processing times,
stored in TimeSeriesData and synchronized to Postgres metric tables.
Includes startup retention cleanup for data older than 30 days.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant