nhancdt2602 opened a new pull request, #3557: URL: https://github.com/apache/kvrocks/pull/3557
## Summary This change tracks command calls, latency, and histograms per namespace. A namespaced connection sees its own numbers in INFO (Stats, CommandStats) and LATENCY HISTOGRAM; the admin/default namespace sees the aggregate across all namespaces. Behavior: - In namespace ns1, call `INFO commandstats` -> returns stats scoped by ns1 only - In namespace admin, call `INFO commandstats` -> returns stats aggregated from all namespaces Closes #755. ## Changes - Per-namespace Stats kept in `ns_stats_` field in the Server class (guarded by a shared_mutex), created lazily via `GetOrCreateNamespaceStats`. - Command hot path records into the connection's cached per-namespace Stats (no lock needed). - `GetStatsInfo`, `GetCommandsStatsInfo`, `LATENCY HISTOGRAM` resolve their source by caller namespace, or `AggregateNamespaceStats()` for the admin/default view. - Go integration test TestNamespaceStats. ## Implementation notes - Stats such as command counts, ops-per-sec, commandstats, hist I/O bytes and keyspace hits/misses stay global for now. They're counted where the namespace isn't in scope (request parsing / storage layer). Open for follow-ups. ## AI disclosure - Human: outlined the behaviors, interfaces scaffolding and finalized approaches. - AI: implementation and writing tests -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
