Skip to content

feat: phase 5 observability — metrics, enriched INFO, slowlog - #40

Merged
kacy merged 2 commits into
mainfrom
feat/slowlog
Feb 6, 2026
Merged

feat: phase 5 observability — metrics, enriched INFO, slowlog#40
kacy merged 2 commits into
mainfrom
feat/slowlog

Conversation

@kacy

@kacy kacy commented Feb 6, 2026

Copy link
Copy Markdown
Owner

summary

rolls up the three observability PRs (#37, #38, #39) into main:

  • prometheus metrics: --metrics-port flag, per-command counters/histograms, background stats poller, connection gauges
  • enriched INFO: multi-section response (server, clients, memory, persistence, stats, keyspace) with ServerContext for shared state
  • SLOWLOG: ring buffer with SLOWLOG GET/LEN/RESET, configurable threshold and max length

tested

  • cargo test --workspace — all tests pass
  • cargo clippy --workspace -- -D warnings — clean
  • manual verification of all three features

kacy added 2 commits February 6, 2026 13:26
…, stats, keyspace sections

INFO with no args returns all sections. INFO <section> returns just
that section. follows Redis conventions — # headers, key:value pairs.

sections:
- server: ember_version, process_id, uptime_in_seconds, shard_count
- clients: connected_clients, max_clients
- memory: used_memory, used_memory_human, max_memory, max_memory_human
- persistence: aof_enabled
- stats: total_connections_received, total_commands_processed,
         expired_keys, evicted_keys
- keyspace: db0:keys=N,expires=N,used_bytes=N

adds ServerContext struct (shared via Arc) that tracks start_time,
version, config, and atomic counters for connections/commands.
implements SLOWLOG GET [count], SLOWLOG LEN, and SLOWLOG RESET with a
fixed-size ring buffer (default 128 entries). commands exceeding the
threshold are recorded with id, timestamp, duration, and command name.

CLI flags:
- --slowlog-log-slower-than: microseconds threshold (default 10000 = 10ms,
  -1 to disable, 0 to log everything)
- --slowlog-max-len: ring buffer capacity (default 128)

the slow log is shared across connections via Arc<SlowLog>. the inner
mutex is effectively uncontended since only slow commands (rare by
definition) ever acquire it. the threshold check itself is a single
duration comparison — ~1ns overhead per command.

also simplifies the process() timing: Instant::now() is always taken
(needed for slowlog), and metrics recording is gated separately.
@kacy
kacy merged commit 2c5c5ea into main Feb 6, 2026
4 of 5 checks passed
@kacy
kacy deleted the feat/slowlog branch February 7, 2026 20:06
kacy added a commit that referenced this pull request Feb 11, 2026
feat: phase 5 observability — metrics, enriched INFO, slowlog
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