Skip to content

Fix cache metric gaps and add entry age histogram - #9040

Open
jdolle wants to merge 1 commit into
feat-cache-insightsfrom
feat-cache-insights-review
Open

jdolle wants to merge 1 commit into
feat-cache-insightsfrom
feat-cache-insights-review

Conversation

@jdolle

@jdolle jdolle commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

Background

The cache metrics on this branch could not show whether a cache duration needs changing. Stale
hits counted as hits and were attributed to the wrong layer, a cache with no hits disappeared
from the dashboard, and nothing recorded how old an entry is when it is read.

Description

Metrics (@hive/service-common, API, schema, workflows; usage gets them through the API cache classes)

  • Stale hits no longer carry a layer label, because BentoCache does not report which layer
    served them.
  • createCacheMetrics(feature, layers) takes the layers a cache has and creates every series at
    zero, so a cache at 0% is shown and the first event per pod is counted.
  • New hive_cache_entry_age_seconds{feature, result} histogram for the four Redis-backed
    BentoCache caches, read through a custom BentoCache serializer. The stored Redis format is
    unchanged.

Dashboard (Redis-Caches.json)

  • Fresh and stale hit rates are separate panels; Redis hit rate counts fresh hits only.
  • New "Entry age" row with the median and p99 age of fresh and stale hits.
  • Pod start annotation, a short guide on deciding whether a duration needs adjusting, and a
    compact one-row Overview.

Checklist

  • Testing
redis-caches-dashboard

@jdolle
jdolle requested a review from n1ru4l December 4, 2026 20:55
@jdolle jdolle self-assigned this Dec 4, 2026
@theguild-bot

Copy link
Copy Markdown
Collaborator

🚀 Snapshot Release (alpha)

The latest changes of this PR are available as alpha on npm (based on the declared changesets):

Package Version Info
@graphql-hive/laboratory 0.4.2-alpha-20261204205639-8ffa55fbee7306fa1536e950643b5b8e7d8d7f14 npm ↗︎ unpkg ↗︎
@graphql-hive/render-laboratory 0.2.1-alpha-20261204205639-8ffa55fbee7306fa1536e950643b5b8e7d8d7f14 npm ↗︎ unpkg ↗︎

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

🐋 This PR was built and pushed to the following Docker images:

Targets: build

Platforms: linux/amd64

Image Tags: 15.9.2-alpha-8ffa55f, 8ffa55f, 8ffa55fbee7306fa1536e950643b5b8e7d8d7f14

@jdolle
jdolle changed the base branch from test-native-composition to feat-cache-insights December 4, 2026 21:01

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants