Skip to content

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

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

feat(server-utils)!: Emit low cardinality redis span names#23741
Lms24 wants to merge 2 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 nothing low cardinality to pair the command with. So with span streaming enabled, db.query spans are named after db.operation.name — the bare command — and the key and its arguments stay on db.query.text. This is the span name OTel prescribes for redis. 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
node-redis SET test-key [1 other arguments] SET
native DC redis-SET SET
FCALL unchanged fcall my_func
batch MULTI / PIPELINE unchanged
cache cache key unchanged
  • our naming templates have no bare {db.operation.name} rule yet — I'm adding one to sentry-conventions to cover this
  • 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. 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
  • traceLifecycle: 'static' keeps the existing names

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

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>
@github-actions

github-actions Bot commented Aug 28, 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 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.64 kB - -
@sentry/browser (incl. Tracing + Span Streaming) 48.65 kB - -
@sentry/browser (incl. Tracing, Profiling) 51.56 kB - -
@sentry/browser (incl. Tracing, Replay) 88.09 kB - -
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 77.52 kB - -
@sentry/browser (incl. Tracing, Replay with Canvas) 92.79 kB - -
@sentry/browser (incl. Tracing, Replay, Feedback) 105.74 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.84 kB - -
@sentry/vue 35.69 kB - -
@sentry/vue (incl. Tracing) 50.87 kB - -
@sentry/svelte 28.59 kB - -
CDN Bundle 30.35 kB - -
CDN Bundle (incl. Tracing) 49.25 kB - -
CDN Bundle (incl. Logs, Metrics) 32.58 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) 51.15 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) 73.17 kB - -
CDN Bundle (incl. Tracing, Replay) 86.74 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) 88.62 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) 92.63 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) 94.52 kB - -
CDN Bundle - uncompressed 89.95 kB - -
CDN Bundle (incl. Tracing) - uncompressed 146.85 kB - -
CDN Bundle (incl. Logs, Metrics) - uncompressed 96.24 kB - -
CDN Bundle (incl. Tracing, Logs, Metrics) - uncompressed 152.54 kB - -
CDN Bundle (incl. Replay, Logs, Metrics) - uncompressed 225.41 kB - -
CDN Bundle (incl. Tracing, Replay) - uncompressed 266.34 kB - -
CDN Bundle (incl. Tracing, Replay, Logs, Metrics) - uncompressed 272.02 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 280.05 kB - -
CDN Bundle (incl. Tracing, Replay, Feedback, Logs, Metrics) - uncompressed 285.71 kB - -
@sentry/nextjs (client) 53.42 kB - -
@sentry/sveltekit (client) 49.08 kB - -
@sentry/core/server 65.44 kB - -
@sentry/core/browser 51.84 kB - -
@sentry/node 123.34 kB +0.2% +242 B 🔺
@sentry/node/import (ESM hook with diagnostics-channel injection) 85.23 kB - -
@sentry/node - without tracing 87.75 kB +0.04% +27 B 🔺
@sentry/node - without channel injection 102.98 kB +0.21% +215 B 🔺
@sentry/aws-serverless 95.91 kB +0.03% +24 B 🔺
@sentry/cloudflare (withSentry) - minified 200.51 kB - -
@sentry/cloudflare (withSentry) 498.77 kB - -

View base workflow run

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>
注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

None yet

Development

Successfully merging this pull request may close these issues.

1 participant