Skip to content

feat(metrics): emit conserver.redis.memory_used_bytes observable gauge - #175

Merged
pavanputhra merged 1 commit into
mainfrom
feat/redis-memory-gauge
May 20, 2026
Merged

pavanputhra merged 1 commit into
mainfrom
feat/redis-memory-gauge

Conversation

@pavanputhra

Copy link
Copy Markdown
Contributor

Summary

Adds a second observable gauge in common/lib/queue_metrics.py:

Metric Source Attributes
conserver.redis.memory_used_bytes INFO memory → used_memory none (pod identity is on resource)

Sampled on every metric-export tick alongside conserver.ingress_list.length. One round-trip per pod per tick; negligible cost.

The metric exists so monitoring stacks can observe Redis memory pressure directly from the conserver process — useful when a deployment doesn't run a separate Redis exporter.

Test plan

  • New tests in common/tests/test_queue_metrics.py:

    • happy path: one Observation with the correct integer value, no attributes
    • INFO memory failure → no observation, no exception
    • missing used_memory key → no observation
    • non-int used_memory (defensive) → no observation
    • string used_memory (some clients) → coerced to int

    All 13 tests in the module pass.

  • Manual verification on a running deployment: roll the new image, confirm conserver.redis.memory_used_bytes shows up in the metrics backend with one series per pod.

🤖 Generated with Claude Code

Adds a second observable gauge in the queue_metrics module that samples
``used_memory`` from ``INFO memory`` on every metric-export tick and
emits it as ``conserver.redis.memory_used_bytes``.

The metric exists so monitoring stacks that previously relied on an
externally-deployed Redis exporter for memory pressure visibility can
get the same signal from the conserver itself. One round-trip per pod
per tick; negligible cost.

Single series per pod, no per-key attributes — pod identity is already
on the resource. Bootstrapped from worker_loop alongside the existing
``conserver.ingress_list.length`` gauge.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pavanputhra
pavanputhra merged commit c717a2f into main May 20, 2026
@pavanputhra
pavanputhra deleted the feat/redis-memory-gauge branch May 20, 2026 14:48
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