Skip to content

feat(entity-caching-1): raw event pipeline (draft)#2827

Draft
SkArchon wants to merge 7 commits intojensneuse/entity-caching-v2from
milinda/entity-caching-1-raw-event-pipeline
Draft

feat(entity-caching-1): raw event pipeline (draft)#2827
SkArchon wants to merge 7 commits intojensneuse/entity-caching-v2from
milinda/entity-caching-1-raw-event-pipeline

Conversation

@SkArchon
Copy link
Copy Markdown
Contributor

@SkArchon SkArchon commented May 6, 2026

This PR has the following

  • Allow the graphqlmetrics handler to accept raw entity cache events
  • Have the router push events to graphqlmetrics
  • Refactor the existing auth headers of the otel metrics being pushed to the graphqlmetrics collector, its moved to a common grpc handler / interceptor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added entity cache events export capability to capture and analyze cache decision analytics including reads, writes, timings, errors, and field-level hashing data.
    • Configured with new events_export settings under entity_caching to enable batch export of cache events to a backend service.
    • Events are authenticated using bearer token authentication.
  • Chores

    • Added ClickHouse database migration to support cache events storage.
    • Updated build configuration and CI workflow to include cache events protobuf generation.

Checklist

  • I have discussed my proposed changes in an issue and have received approval to proceed.
  • I have followed the coding standards of the project.
  • Tests or benchmarks have been added or updated.
  • Documentation has been updated on https://github.com/wundergraph/docs-website.
  • I have read the Contributors Guide.

Open Source AI Manifesto

This project follows the principles of the Open Source AI Manifesto. Please ensure your contribution aligns with its principles.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0098fdfb-4531-416f-a45c-f1f1f2605bc5

📥 Commits

Reviewing files that changed from the base of the PR and between 87fe366 and 25c20ba.

⛔ Files ignored due to path filters (4)
  • graphqlmetrics/gen/proto/wg/cosmo/cacheevents/v1/cacheevents.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • graphqlmetrics/gen/proto/wg/cosmo/cacheevents/v1/cacheeventsv1connect/cacheevents.connect.go is excluded by !**/gen/**
  • router/gen/proto/wg/cosmo/cacheevents/v1/cacheevents.pb.go is excluded by !**/*.pb.go, !**/gen/**
  • router/gen/proto/wg/cosmo/cacheevents/v1/cacheeventsv1connect/cacheevents.connect.go is excluded by !**/gen/**
📒 Files selected for processing (39)
  • .github/workflows/graphqlmetrics-ci.yaml
  • Makefile
  • controlplane/clickhouse/migrations/20260427120000_create_gql_cache_events.sql
  • graphqlmetrics/cacheevents/processor.go
  • graphqlmetrics/cacheevents/processor_test.go
  • graphqlmetrics/cacheevents/schema.go
  • graphqlmetrics/cacheevents/schema_test.go
  • graphqlmetrics/cacheevents/service.go
  • graphqlmetrics/cacheevents/service_test.go
  • graphqlmetrics/cacheevents/writer.go
  • graphqlmetrics/cacheevents/writer_test.go
  • graphqlmetrics/cmd/main.go
  • graphqlmetrics/core/server.go
  • proto/wg/cosmo/cacheevents/v1/cacheevents.proto
  • router-tests/entity_caching/cache_events_export_test.go
  • router-tests/observability/graphql_metrics_test.go
  • router/core/factoryresolver.go
  • router/core/graph_server.go
  • router/core/graphql_handler.go
  • router/core/router.go
  • router/core/router_config.go
  • router/internal/cacheevents/aggregate.go
  • router/internal/cacheevents/builder.go
  • router/internal/cacheevents/builder_test.go
  • router/internal/cacheevents/exporter.go
  • router/internal/cacheevents/sink.go
  • router/internal/cacheevents/sink_test.go
  • router/internal/exporter/auth.go
  • router/internal/exporter/auth_test.go
  • router/internal/exporter/retry.go
  • router/internal/exporter/retry_test.go
  • router/internal/graphqlmetrics/graphql_exporter.go
  • router/internal/graphqlmetrics/graphql_exporter_test.go
  • router/internal/graphqlmetrics/graphql_metrics_sink.go
  • router/internal/graphqlmetrics/graphql_metrics_sink_test.go
  • router/pkg/config/config.go
  • router/pkg/config/config.schema.json
  • router/pkg/config/testdata/config_defaults.json
  • router/pkg/config/testdata/config_full.json
 ___________________________________
< This function is pure-pure chaos. >
 -----------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

This comment has been minimized.

@SkArchon SkArchon changed the title Milinda/entity caching 1 raw event pipeline feat(entity-caching-1) raw event pipeline May 6, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

❌ Patch coverage is 31.38866% with 835 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (jensneuse/entity-caching-v2@87fe366). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...en/proto/wg/cosmo/cacheevents/v1/cacheevents.pb.go 6.00% 312 Missing and 1 partial ⚠️
...en/proto/wg/cosmo/cacheevents/v1/cacheevents.pb.go 15.01% 281 Missing and 2 partials ⚠️
graphqlmetrics/cacheevents/writer.go 4.21% 91 Missing ⚠️
router/core/router.go 3.22% 28 Missing and 2 partials ⚠️
...nts/v1/cacheeventsv1connect/cacheevents.connect.go 0.00% 26 Missing ⚠️
router/internal/cacheevents/builder.go 87.57% 21 Missing and 1 partial ⚠️
router/core/graphql_handler.go 16.00% 21 Missing ⚠️
graphqlmetrics/cacheevents/service.go 50.00% 14 Missing and 1 partial ⚠️
graphqlmetrics/core/server.go 0.00% 9 Missing and 1 partial ⚠️
graphqlmetrics/cmd/main.go 0.00% 7 Missing ⚠️
... and 5 more
Additional details and impacted files
@@                      Coverage Diff                       @@
##             jensneuse/entity-caching-v2    #2827   +/-   ##
==============================================================
  Coverage                               ?   64.05%           
==============================================================
  Files                                  ?      600           
  Lines                                  ?    74399           
  Branches                               ?     4764           
==============================================================
  Hits                                   ?    47659           
  Misses                                 ?    25222           
  Partials                               ?     1518           
Files with missing lines Coverage Δ
graphqlmetrics/cacheevents/processor.go 100.00% <100.00%> (ø)
graphqlmetrics/cacheevents/schema.go 100.00% <100.00%> (ø)
router/core/factoryresolver.go 82.92% <ø> (ø)
router/core/router_config.go 93.75% <ø> (ø)
router/internal/cacheevents/aggregate.go 100.00% <100.00%> (ø)
router/internal/exporter/auth.go 100.00% <100.00%> (ø)
router/internal/exporter/retry.go 100.00% <100.00%> (ø)
router/internal/graphqlmetrics/graphql_exporter.go 68.42% <100.00%> (ø)
router/pkg/config/config.go 84.40% <ø> (ø)
...er/internal/graphqlmetrics/graphql_metrics_sink.go 82.35% <66.66%> (ø)
... and 14 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SkArchon SkArchon changed the title feat(entity-caching-1) raw event pipeline feat(entity-caching-1): raw event pipeline May 6, 2026
The raw-event pipeline previously depended on graphql-go-tools fields that
only exist on the unmerged engine branch (per-event Timestamp, DataSource on
MutationEvent/EntityFieldHash, FieldPath on EntityFieldHash, and the
ForceHashAnalyticsKeys planner override). CI builds against the pinned
go.mod version, which does not yet have those fields, so the package failed
to compile.

Use a single build-time timestamp for every event in a snapshot, drop the
fields that the pinned engine does not expose, and rely on per-entity SDL
configuration for KeyHash population until the engine bump lands. Also wire
proto/wg/cosmo/cacheevents into make generate-go so the router and
graphqlmetrics gen dirs stay in sync with `make generate`.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Router-nonroot image scan passed

✅ No security vulnerabilities found in image:

ghcr.io/wundergraph/cosmo/router:sha-0051ffef149940f8e2672df769994c1509d7c38a-nonroot

SkArchon added 3 commits May 6, 2026 18:43
The graphqlmetrics CI workflow runs its own buf generate command rather
than make generate-go, so the Makefile fix did not cover it. Add the new
cacheevents proto path so CI does not delete the committed gen files.
@SkArchon SkArchon changed the title feat(entity-caching-1): raw event pipeline feat(entity-caching-1): raw event pipeline (draft) May 6, 2026
@SkArchon SkArchon marked this pull request as ready for review May 6, 2026 13:46
@SkArchon SkArchon requested a review from a team as a code owner May 6, 2026 13:46
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@SkArchon
Copy link
Copy Markdown
Contributor Author

SkArchon commented May 6, 2026

@claude review once

Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit at claude.ai/admin-settings/claude-code.

Once credits are available, comment @claude review on this pull request to trigger a review.

@SkArchon SkArchon marked this pull request as draft May 6, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant