Skip to content

feat(server-utils): Emit low cardinality redis span names - #23741

Open
Lms24 wants to merge 3 commits into
developfrom
lms/feat-server-utils-low-card-redis-span-names
Open

feat(server-utils): Emit low cardinality redis span names#23741
Lms24 wants to merge 3 commits into
developfrom
lms/feat-server-utils-low-card-redis-span-names

Conversation

@Lms24

@Lms24 Lms24 commented Aug 28, 2026

Copy link
Copy Markdown
Member

Redis has no SQL statement to summarize and no collection to pair the command with, so with span streaming enabled db.query spans are named {db.operation.name} {server.address}:{server.port}, and the key and its arguments stay on db.query.text. A client configured without a host has nothing to pair with, so the name falls back to {db.system.name}. db.namespace is deliberately kept out of the name: for redis it is the numeric database index, which OTel excludes from span names for exactly that reason.

static streamed
ioredis set test-key [1 other arguments] set localhost:6379
node-redis SET test-key [1 other arguments] SET localhost:6379
native DC redis-SET SET localhost:6379
no host configured SET test-key [1 other arguments] redis
FCALL unchanged fcall my_func
batch MULTI / PIPELINE unchanged
cache cache key unchanged
  • FCALL/FCALL_RO name a redis function, the one redis construct the conventions model as a stored procedure, so those spans report db.stored_procedure.name and pair it with the operation instead of the connection. Skipped when the publishing library redacted the function name
  • batch spans now report the MULTI/PIPELINE operation they were already named after, so their name follows from their attributes too
  • cache spans are still renamed to the cache key by the cache hook, so they stay high cardinality on the streamed path — left as is here

Streamed integration tests mirror the transaction-based ones across the redis, redis-cache, redis-dc and ioredis-dc suites, switched by a STREAMED env var on the existing instrument files. Split out of #23603, which keeps the mongodb half.

Refs #23523

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size % Change Change
@sentry/browser 28.56 kB - -
@sentry/browser - with treeshaking flags 26.92 kB - -
@sentry/browser - with treeshaking flags tracing without tracing 26.82 kB - -
@sentry/browser (incl. Tracing) 48.75 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.76 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.68 kB - -
@sentry/browser (incl. Tracing, Replay) 88.23 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.63 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.93 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.85 kB - -
@sentry/browser (incl. Feedback) 46.05 kB - -
@sentry/browser (incl. sendFeedback) 33.62 kB - -
@sentry/browser (incl. FeedbackAsync) 38.73 kB - -
@sentry/browser (incl. Metrics) 29.51 kB - -
@sentry/browser (incl. Logs) 29.8 kB - -
@sentry/browser (incl. Metrics & Logs) 30.43 kB - -
@sentry/react 30.3 kB - -
@sentry/react (incl. Tracing) 50.94 kB - -
@sentry/vue 35.73 kB - -
@sentry/vue (incl. Tracing) 51.02 kB - -
@sentry/svelte 28.59 kB - -
CDN Bundle 30.35 kB - -
CDN Bundle (incl. Tracing) 49.38 kB - -
CDN Bundle (incl. Logs, Metrics) 32.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.25 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.17 kB - -
CDN Bundle (incl. Tracing, Replay) 86.86 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.73 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.8 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.64 kB - -
CDN Bundle - uncompressed 89.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 147.2 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.89 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.41 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.69 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.37 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.4 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 286.06 kB - -
@sentry/nextjs (client) 53.56 kB - -
@sentry/sveltekit (client) 49.19 kB - -
@sentry/core/server 65.67 kB - -
@sentry/core/browser 51.86 kB - -
@sentry/node 123.98 kB +0.2% +237 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.53 kB - -
@sentry/node - without tracing 88.03 kB +0.02% +14 B 🔺
@sentry/node - without channel injection 103.41 kB +0.25% +249 B 🔺
@sentry/aws-serverless 96.42 kB +0.03% +26 B 🔺
@sentry/cloudflare (withSentry) - minified 201.04 kB - -
@sentry/cloudflare (withSentry) 500.26 kB - -

View base workflow run

@Lms24 Lms24 changed the title feat(server-utils)!: Emit low cardinality redis span names feat(server-utils): Emit low cardinality redis span names Aug 31, 2026
@Lms24
Lms24 marked this pull request as ready for review August 31, 2026 16:05
@Lms24
Lms24 requested review from a team as code owners August 31, 2026 16:05
@Lms24
Lms24 requested review from isaacs, mydea and s1gr1d and removed request for a team August 31, 2026 16:05
@Lms24 Lms24 self-assigned this Aug 31, 2026
Comment thread packages/server-utils/src/integrations/redis/redis-span-name.ts
Lms24 and others added 3 commits August 31, 2026 18:36
Redis reports no SQL statement, so there is no query summary to name its spans
after. With span streaming they use the next conventions template that can be
filled instead: the command paired with `{server.address}:{server.port}`, since
redis has no collection or namespace to pair with. It falls back to
`{db.system.name}` when the client was configured without a host.

This keeps the serialized command, which carries the key and its arguments, out
of the span name. It stays on `db.query.text`.

`traceLifecycle: 'static'` keeps the existing names.

Refs #23523
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Pairing the command with `{server.address}:{server.port}` put a host and port in
every redis span name, which says nothing about what ran. Redis has nothing low
cardinality to pair the operation with, so the name is now the bare command,
matching the span name OTel prescribes for redis. The key and its arguments stay
on `db.query.text`.

`db.namespace` is deliberately left out of the name: for redis it is the numeric
database index, which OTel excludes from span names for that reason.

`FCALL`/`FCALL_RO` are the exception, since they name a redis function — the one
redis construct the conventions model as a stored procedure. Those spans report
`db.stored_procedure.name` and pair it with the operation, unless the publishing
library redacted the function name.

Batch spans now report the `MULTI`/`PIPELINE` operation they were already named
after, so their name follows from their attributes too.

Refs #23523
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Naming streamed redis spans after the bare command dropped the only target the
conventions can fill for redis, leaving `SET` to say nothing about where the
command went. Pair the operation with `{server.address}:{server.port}` again,
falling back to `{db.system.name}` when the client was configured without a host.

The native diagnostics_channel subscriber gets the same name, built from the
`serverAddress`/`serverPort` its payload already carries.

`FCALL`/`FCALL_RO` keep naming the redis function they call: the conventions rank
`db.stored_procedure.name` ahead of the connection.

Refs #23523
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Lms24
Lms24 force-pushed the lms/feat-server-utils-low-card-redis-span-names branch from 70ad779 to 87fa5b5 Compare August 31, 2026 16:37
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