Skip to content

fix: emit zero-value hits counter for active miss labels (OQP-2)#6

Merged
TadMSTR merged 2 commits into
mainfrom
fix/oqp-2-cache-hits-zero-sentinel
Jun 18, 2026
Merged

fix: emit zero-value hits counter for active miss labels (OQP-2)#6
TadMSTR merged 2 commits into
mainfrom
fix/oqp-2-cache-hits-zero-sentinel

Conversation

@TadMSTR

@TadMSTR TadMSTR commented Jun 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • `oqp_embedding_cache_hits_total` emitted no samples when `cache_hits` was empty (e.g. after container restart), causing Prometheus to have no time series and the Grafana cache hit rate panel to show "No data" instead of 0%.
  • Fix: after emitting real hit samples, iterate `cache_misses` and emit a `0` sample for any label not already in `cache_hits`.
  • `cache_misses` always has entries after the first request, so the zero sentinel appears as soon as the cache is active.

Test plan

  • Restart the proxy container (clears Valkey), send one embedding request, scrape `/metrics` — `oqp_embedding_cache_hits_total` should appear with value `0` for the active label.
  • Send a second identical embedding request (cache hit), re-scrape — counter should increment to `1`.
  • Grafana "Embedding Cache Hit Rate" panel should show `0%` immediately after restart rather than "No data".

Closes OQP-2

🤖 Generated with Claude Code

developer-agent added 2 commits June 18, 2026 10:46
When cache_hits is empty after a container restart, Prometheus has no
time series for oqp_embedding_cache_hits_total and the Grafana cache
hit rate panel shows "No data". For each label in cache_misses that
is absent from cache_hits, emit a 0 sample so the time series always
exists once the cache is active.

agent-id: developer
agent-id: developer
@TadMSTR TadMSTR merged commit 780d4bb into main Jun 18, 2026
4 checks passed
@TadMSTR TadMSTR deleted the fix/oqp-2-cache-hits-zero-sentinel branch June 18, 2026 14:50
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