Skip to content

graphql: Attribute query cache metrics to deployments#6696

Open
DenisCarriere wants to merge 2 commits into
graphprotocol:masterfrom
DenisCarriere:codex/deployment-cache-metrics
Open

graphql: Attribute query cache metrics to deployments#6696
DenisCarriere wants to merge 2 commits into
graphprotocol:masterfrom
DenisCarriere:codex/deployment-cache-metrics

Conversation

@DenisCarriere

@DenisCarriere DenisCarriere commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Add bounded per-deployment cache telemetry:

  • query_cache_status_count{deployment,cache_status} for hit, shared-hit, insert and miss rates;
  • query_cache_status_duration_seconds{deployment,cache_status} for comparing hit and miss latency distributions.

The load manager already receives the internal deployment ID and field execution duration. This change passes the public deployment hash from both GraphQL and SQL query paths, then records cache outcome and duration using nine explicit latency buckets from 10 ms through 10 s.

Existing fleet-level counter queries can retain their current behaviour with sum by (cache_status) (...). Series are created lazily and bounded by deployments queried by a node multiplied by the four existing cache states.

Test plan

  • cargo fmt --all -- --check
  • cargo test -p graph cache_status_metrics_are_scoped_by_deployment
  • cargo check -p graph-graphql

The unit test records different cache outcomes and durations for two deployments and verifies that both counters and histograms remain isolated.

Related downstream issue: pinax-network/k8s-subgraphs#471


🤖 Created by Codex GPT 5.6 SOL

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