You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add INFO COMMANDSTATS tracking with per-command success rates (#1702)
* Add INFO COMMANDSTATS tracking with per-command success rates
Implements Redis-compatible INFO COMMANDSTATS support, gated behind
--commandstats-monitor config flag. Tracks per-command calls, failed_calls,
and rejected_calls using lightweight counter increments (no Stopwatch).
Key design decisions:
- Array-indexed by RespCommand enum for O(1) access
- Per-session counters (single-writer, no locking on hot path)
- On-demand aggregation from active sessions + disposed session history
- No latency tracking (usec=0) to avoid Stopwatch overhead (~4.4x perf hit)
- Monitor dispose handles case where Start() was never called (EmbeddedServer)
Benchmark results (100 PINGs, .NET 10):
Disabled: 1.687 us | Enabled: 1.820 us | Overhead: ~7.8%
SET/GET overhead: 0-4% (within noise for real workloads)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Fix double-counting bug in PopulateCommandStatsInfo and remove stale latency references
When MetricsSamplingFrequency > 0, globalCommandStats already includes
history from disposed sessions. PopulateCommandStatsInfo was adding
historyCommandStats on top, double-counting disposed session stats.
Also removed stale 'latency' references from doc comments and help text
since per-command latency tracking was removed to avoid Stopwatch overhead.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Address PR review: simplify error detection, use canonical command names, fix tests
- Remove bufferFlushedDuringCommand field and pointer-based error detection;
rely solely on commandErrorWritten flag set by WriteError/AbortWithErrorMessage
- Use RespCommandsInfo.GetRespCommandName() for canonical Redis command names
instead of enum ToString with string replacement
- Switch most tests to metricsSamplingFreq: 0 (on-demand aggregation) to remove
Thread.Sleep delays; keep one test with periodic sampling for coverage
- Fix CommandStatsFailedCallsTest to use SETRANGE with invalid offset (goes
through AbortWithErrorMessage) instead of WRONGTYPE which bypasses the flag
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Include LatencyMonitor in monitor creation condition
GarnetLatencyMetricsSession dereferences monitor.monitor_iterations, but
StoreWrapper only created the monitor when MetricsSamplingFrequency > 0 or
CommandStatsMonitor was enabled. With --latency-monitor alone and no
sampling frequency, this would cause a NullReferenceException at session
creation. Add LatencyMonitor to the condition so the monitor is always
created when latency tracking is enabled.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Update REspInfo test
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments