Skip to content

feat(node,server-utils): Set cache.key on dataloader spans and capture redis delete operations as cache.remove#22389

Merged
msonnb merged 4 commits into
developfrom
ms/cache-key-attribute
Jul 21, 2026
Merged

feat(node,server-utils): Set cache.key on dataloader spans and capture redis delete operations as cache.remove#22389
msonnb merged 4 commits into
developfrom
ms/cache-key-attribute

Conversation

@msonnb

@msonnb msonnb commented Jul 20, 2026

Copy link
Copy Markdown
Member
  • Add missing cache.key attribute in dataloader instrumentation (otel and tracing channels)
  • Set op to cache.remove for redis DEL and UNLINK commands

Closes #22365

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 27.75 kB - -
@sentry/browser - with treeshaking flags 26.18 kB - -
@sentry/browser (incl. Tracing) 46.56 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.37 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.36 kB - -
@sentry/browser (incl. Tracing, Replay) 85.84 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 75.46 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 90.55 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 103.21 kB - -
@sentry/browser (incl. Feedback) 44.93 kB - -
@sentry/browser (incl. sendFeedback) 32.55 kB - -
@sentry/browser (incl. FeedbackAsync) 37.69 kB - -
@sentry/browser (incl. Metrics) 28.83 kB - -
@sentry/browser (incl. Logs) 29.05 kB - -
@sentry/browser (incl. Metrics & Logs) 29.76 kB - -
@sentry/react 29.54 kB +0.01% +1 B 🔺
@sentry/react (incl. Tracing) 48.84 kB - -
@sentry/vue 33.17 kB - -
@sentry/vue (incl. Tracing) 48.52 kB - -
@sentry/svelte 27.78 kB - -
CDN Bundle 30.14 kB - -
CDN Bundle (incl. Tracing) 48.53 kB - -
CDN Bundle (incl. Logs, Metrics) 31.73 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 49.83 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 70.99 kB - -
CDN Bundle (incl. Tracing, Replay) 86.05 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 87.35 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 91.85 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 93.12 kB - -
CDN Bundle - uncompressed 89.88 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.73 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 94.59 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 150.71 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 219.35 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 265.96 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 269.93 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 279.67 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 283.62 kB - -
@sentry/nextjs (client) 51.36 kB - -
@sentry/sveltekit (client) 46.99 kB - -
@sentry/core/server 80.26 kB - -
@sentry/core/browser 66.69 kB - -
@sentry/node-core 63.21 kB -0.01% -1 B 🔽
@sentry/node 125.76 kB +0.02% +24 B 🔺
@sentry/node (incl. diagnostics channel injection) 149.55 kB +0.02% +29 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 70.03 kB -0.01% -2 B 🔽
@sentry/node/light 51.32 kB -0.01% -1 B 🔽
@sentry/node - without tracing 74.92 kB -0.01% -2 B 🔽
@sentry/aws-serverless 84.15 kB -0.01% -1 B 🔽
@sentry/cloudflare (withSentry) - minified 197.51 kB - -
@sentry/cloudflare (withSentry) 485.87 kB - -

View base workflow run

@msonnb msonnb changed the title feat(node): Set cache.key on dataloader spans and capture redis delete operations as cache.remove feat(node,server-utils): Set cache.key on dataloader spans and capture redis delete operations as cache.remove Jul 20, 2026
@msonnb

msonnb commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0af75dc. Configure here.

@msonnb
msonnb marked this pull request as ready for review July 20, 2026 11:53
@msonnb
msonnb requested review from a team as code owners July 20, 2026 11:53
@msonnb
msonnb requested review from JPeer264, Lms24 and isaacs and removed request for a team July 20, 2026 11:53

@isaacs isaacs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Small style/nit to use an undefined attribute in favor of a spread, but LGTM.

Comment thread packages/server-utils/src/integrations/tracing-channel/dataloader.ts Outdated
}

return keyArg == null ? undefined : [String(keyArg)];
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Array keys mishandled on load

Medium Severity

getCacheKey uses Array.isArray to decide between a single key and a key list, but load can take an array as one composite key. In that case cache.key is expanded into multiple entries instead of one, so the span attribute no longer matches the actual dataloader key.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ece7d46. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d4fe083. Configure here.

'network.peer.address': 'localhost',
'network.peer.port': 6383,
}),
}),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing remove size assertion

Low Severity

This violates the testing rule about expect.objectContaining when a payload must omit a field: the new DEL expectations never assert that cache.item_size is absent, even though remove responses are intentionally excluded from size calculation. A regression that sets size again would still pass. Flagged because it was mentioned in this rules file.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit d4fe083. Configure here.

@Lms24 Lms24 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice!

@msonnb
msonnb merged commit a0657e1 into develop Jul 21, 2026
223 checks passed
@msonnb
msonnb deleted the ms/cache-key-attribute branch July 21, 2026 09:11
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.

Ensure cache.* spans set cache.key attribute and ops are in conventions

3 participants