Skip to content

fix(redis): bring span attributes into alignment with conventions#21255

Open
isaacs wants to merge 2 commits into
isaacs/sentry-internal-server-utilsfrom
isaacs/js-2636-review-redis-diagnostics_channel-span-attribute-names
Open

fix(redis): bring span attributes into alignment with conventions#21255
isaacs wants to merge 2 commits into
isaacs/sentry-internal-server-utilsfrom
isaacs/js-2636-review-redis-diagnostics_channel-span-attribute-names

Conversation

@isaacs
Copy link
Copy Markdown
Member

@isaacs isaacs commented May 30, 2026

Bring the span attributes emitted by the Redis and IORedis diagnostics_channel instrumentations into alignment with OTel and Sentry conventions.

The cache keys are left as-is, because they already align with Sentry's cache conventions, which differ from the DB conventions deliberately.

So:

db.system -> db.system.name
OTel deprecated db.system; Sentry's own span processing (captureSpan.ts) reads db.system.name first; matches postgresjs

db.statement -> db.query.text
OTel deprecated db.statement; matches postgresjs

net.peer.port -> server.port
net.peer.name -> server.address
OTel deprecated net.peer.*; Sentry DB convention uses server.address

db.redis.batch_size -> db.operation.batch.size
OTel's stable batch-size key, proposed addition to sentry conventions: getsentry/sentry-conventions#407

fix: JS-2636
fix: #21227

isaacs added 2 commits May 29, 2026 14:23
This is phase 1 of the plan to move all server utils into a single
reusable package that can be shared across SSJS SDKs.

Right now it does not do much, just houses the `diagnostics_channel`
redis integrations. In subsequent steps:

1. Code will *not* be moved out of `@sentry/core/server` into
   `@sentry-internal/server-utils`, in v10.
2. Some or all code in `@sentry/core/server` may be moved into
   `@sentry-internal/server-utils` in v11, as this would be breaking
   change. (Redis channel integration was not, because it hasn't yet
   shipped in a release. Other high-level portable components may move
   over later, if justified.)
3. No components will ever live in *both* places, because `server-utils`
   depends on `core`, and that would create a type dependency cycle.

`@sentry/core/server` will live on for at least v10, possibly into v11.
New server components will be placed in `@sentry-internal/server-utils`.

fix: #21222
fix: JS-2631
Bring the span attributes emitted by the Redis and IORedis
diagnostics_channel instrumentations into alignment with OTel and Sentry
conventions.

The cache keys are left as-is, because they already align with Sentry's
cache conventions, which differ from the DB conventions deliberately.

So:

db.system -> db.system.name
OTel deprecated db.system; Sentry's own span processing (captureSpan.ts)
reads db.system.name first; matches postgresjs

db.statement -> db.query.text
OTel deprecated db.statement; matches postgresjs

net.peer.port -> server.port
net.peer.name -> server.address
OTel deprecated net.peer.*; Sentry DB convention uses server.address

db.redis.batch_size -> db.operation.batch.size
OTel's stable batch-size key, proposed addition to sentry conventions:
getsentry/sentry-conventions#407

fix: JS-2636
fix: #21227
@isaacs isaacs requested a review from JPeer264 May 30, 2026 01:49
@isaacs isaacs requested a review from a team as a code owner May 30, 2026 01:49
@isaacs isaacs requested review from andreiborza and removed request for a team May 30, 2026 01:49
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 30, 2026

JS-2636

@isaacs
Copy link
Copy Markdown
Member Author

isaacs commented May 30, 2026

Note: the target of this PR is the isaacs/sentry-internal-server-utils branch, because it didn't make much sense to land one of these and immediately conflict the other.

This should land after #21200.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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.

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 08abb36. Configure here.

...(data.serverAddress != null ? { [ATTR_NET_PEER_NAME]: data.serverAddress } : {}),
...(data.serverPort != null ? { [ATTR_NET_PEER_PORT]: data.serverPort } : {}),
[ATTR_DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,
[ATTR_DB_QUERY_TEXT]: statement,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Integration tests not updated for renamed attributes

High Severity

The production code now emits db.system.name and db.query.text instead of db.system and db.statement, but the Node.js integration tests in dev-packages/node-integration-tests/suites/tracing/redis-dc/test.ts and dev-packages/node-integration-tests/suites/tracing/ioredis-dc/test.ts still assert the old attribute names (e.g. 'db.system': 'redis' and 'db.statement': 'SET dc-test-key ?'). These tests will fail in CI because expect.objectContaining will not match the new keys, causing the integration test suite to break.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 08abb36. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 27.17 kB added added
@sentry/browser - with treeshaking flags 25.62 kB added added
@sentry/browser (incl. Tracing) 45.25 kB added added
@sentry/browser (incl. Tracing + Span Streaming) 47.47 kB added added
@sentry/browser (incl. Tracing, Profiling) 50.22 kB added added
@sentry/browser (incl. Tracing, Replay) 84.83 kB added added
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 74.39 kB added added
@sentry/browser (incl. Tracing, Replay with Canvas) 89.53 kB added added
@sentry/browser (incl. Tracing, Replay, Feedback) 102.15 kB added added
@sentry/browser (incl. Feedback) 44.34 kB added added
@sentry/browser (incl. sendFeedback) 31.98 kB added added
@sentry/browser (incl. FeedbackAsync) 37.08 kB added added
@sentry/browser (incl. Metrics) 28.25 kB added added
@sentry/browser (incl. Logs) 28.48 kB added added
@sentry/browser (incl. Metrics & Logs) 29.19 kB added added
@sentry/react 28.99 kB added added
@sentry/react (incl. Tracing) 47.51 kB added added
@sentry/vue 32.2 kB added added
@sentry/vue (incl. Tracing) 47.16 kB added added
@sentry/svelte 27.19 kB added added
CDN Bundle 29.55 kB added added
CDN Bundle (incl. Tracing) 47.81 kB added added
CDN Bundle (incl. Logs, Metrics) 31.05 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) 49.04 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) 70.31 kB added added
CDN Bundle (incl. Tracing, Replay) 85.18 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 86.35 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) 91.05 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 92.21 kB added added
CDN Bundle - uncompressed 87.59 kB added added
CDN Bundle (incl. Tracing) - uncompressed 144.09 kB added added
CDN Bundle (incl. Logs, Metrics) - uncompressed 92.08 kB added added
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 147.85 kB added added
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 216.81 kB added added
CDN Bundle (incl. Tracing, Replay) - uncompressed 262.87 kB added added
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 266.61 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 276.57 kB added added
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 280.3 kB added added
@sentry/nextjs (client) 50.03 kB added added
@sentry/sveltekit (client) 45.68 kB added added
@sentry/core/server 75.93 kB added added
@sentry/core/browser 63.09 kB added added
@sentry/node-core 61.69 kB added added
@sentry/node 130.55 kB added added
@sentry/node - without tracing 74.09 kB added added
@sentry/aws-serverless 86.29 kB added added
@sentry/cloudflare (withSentry) - minified 171.64 kB added added
@sentry/cloudflare (withSentry) 429.7 kB added added

@isaacs isaacs force-pushed the isaacs/sentry-internal-server-utils branch from 1e2b91f to 39f2781 Compare May 30, 2026 02:46
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