Skip to content

Redis diagnostics_channel subscriber creates root spans for commands outside any active span #25793

Open

Description

@SwiftXLight

Package + version

@sentry/node 10.75.0 / 10.76.2 (@sentry/server-utils same), also present in 11.9.0. ioredis 5.11.1 and 6.0.0 (both publish ioredis:command / ioredis:connect).

Description

server-utils/src/redis/redis-dc-subscriber binds ioredis:command, ioredis:connect and the node-redis:* channels with bindTracingChannelToSpan(...) and calls startInactiveSpan unconditionally. A command issued outside an active span (a blocking XREAD loop from @socket.io/redis-streams-adapter, the ioredis Cluster slot refresh every slotsRefreshInterval, background jobs) therefore starts a new trace, and tracesSampler samples it as a root transaction named redis-xread, redis-connect, redis-cluster, …

The OpenTelemetry-based ioredis instrumentation this replaces only created a span when getActiveSpan() was set, and bindTracingChannelToSpan already supports requiresParentSpan, but the Redis subscriber does not pass it.

Impact for us: about 926k sampled root transactions per 7 days across 9 Node services, the largest single source of span volume.

Expected

Redis command and connect spans are created only when there is an active parent span (requiresParentSpan: true), matching the previous OTel instrumentation behaviour; or an option to require a parent.

Workaround

tracesSampler: ({ name, inheritOrSampleWith }) => name.startsWith('redis-') ? 0 : inheritOrSampleWith(rate). On 11.x the op changes to db.query, and the span name may change too (streamedName, cache names), so a name-based workaround is fragile across majors.

Activity

  1. linear-code commented on Oct 28, 2026

    @linear-code
  2. added
    javascript
    on Oct 28, 2026
  3. self-assigned this
    on Oct 29, 2026
  4. nicohrubec commented on Nov 6, 2026

    @nicohrubec
    Member

    Hey, thanks for writing in. We are discussing internally how we'll handle such cases in the future, we'll keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bugjavascript

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions