Skip to content

Stop Redis liveness checks from creating spans (quick fix - span reduction) - #13678

Open
dougqh wants to merge 4 commits into
masterfrom
dougqh/redis-liveness-suppression
Open

dougqh wants to merge 4 commits into
masterfrom
dougqh/redis-liveness-suppression

Conversation

@dougqh

@dougqh dougqh commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

What Does This Do

Redis client liveness checks no longer create spans:

  • Jedis 3.x: pool validation (PING on borrow, on return and from the idle evictor, which JedisPoolConfig enables by default).
  • Redisson 3.x: the keepalive PING sent to every pooled connection on a timer (every 30 seconds by default).

It is on by default. DD_TRACE_REDIS_POOL_VALIDATION_ENABLED=false restores the previous behavior.

Motivation

These checks run with no active trace, so each one became a standalone root span. Redisson alone pings every connection in its pool, which by default keeps a minimum of 24 idle connections. Nobody gets value from these spans, and they are cheap to stop at the source rather than filtering them later.

Additional Notes

  • Each check runs under a black-hole span, so the command it sends creates no span.
  • Jedis 4.x/5.x needs no change: the pool sends PING through sendCommand, which that integration doesn't trace.
  • The Jedis advice lives in a separate instrumentation limited to 3.x by a class-loader matcher (ProtocolCommand present, CommandObject absent), so muzzle's expectations for the module still hold.
  • The Redisson advice lives in the existing RedissonInstrumentation module, so muzzle limits it to the same versions. Its switch is read once when the advice is applied, not in the advice.
  • Left traced: the PING Redisson sends once while setting up a connection, along with the other setup commands; failed-node probing; and the user-facing RedisNodes.pingAll.
  • Not covered yet: Jedis 2.x (the module's main tests run Jedis 1.4.0, which has no pool factory).
  • Tests read the server's PING count (INFO commandstats), so they fail if no checks actually happened. With the advice disabled, they fail on leaked PING spans.

Contributor Checklist

🤖 Generated with Claude Code

dougqh and others added 4 commits November 24, 2026 11:33
Jedis pools check a connection by sending PING on borrow, on return and
from the idle evictor, which JedisPoolConfig turns on by default. Each
check produced a Redis span; the evictor's checks run with no active
trace, so they became standalone root spans every eviction run.

Run JedisFactory and ShardedJedisFactory validation under a black-hole
span. Jedis 4 needs no change: its pool sends PING through sendCommand,
which that integration does not trace.

The integration is on by default and can be turned off with
DD_TRACE_REDIS_POOL_VALIDATION_ENABLED=false.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test reads the server's PING count, so it also proves the pool
really validated during the traced borrow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redisson pings every pooled connection on a timer, every 30 seconds by
default. Each ping produced a Redis span with no active trace, so it
became a standalone root span.

Run PingConnectionHandler.sendPing under a black-hole span. The advice
lives in the existing Redisson module so muzzle limits it to the same
versions, and it shares the DD_TRACE_REDIS_POOL_VALIDATION_ENABLED
switch with the Jedis change. The PING sent once while setting up a
connection stays traced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test reads the server's PING count through redis-cli, so it also
proves keepalive pings really happened while no PING spans appeared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh dougqh added type: feature Enhancements and improvements inst: redis Redis instrumentation inst: jedis Jedis instrumentation labels Nov 25, 2026
@datadog-datadog-prod-us1-2

This comment has been minimized.

@dd-octo-sts

dd-octo-sts Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.85 s 14.67 s [+0.3%; +2.1%] (maybe worse)
startup:insecure-bank:tracing:Agent 13.57 s 13.70 s [-1.7%; -0.2%] (maybe better)
startup:petclinic:appsec:Agent 17.19 s 17.09 s [-0.2%; +1.4%] (no difference)
startup:petclinic:iast:Agent 17.02 s 17.03 s [-0.9%; +0.8%] (no difference)
startup:petclinic:profiling:Agent 16.80 s 16.75 s [-0.6%; +1.1%] (no difference)
startup:petclinic:sca:Agent 17.16 s 17.14 s [-0.7%; +1.0%] (no difference)
startup:petclinic:tracing:Agent 16.21 s 15.68 s [-0.9%; +7.7%] (no difference)

Commit: 41f2dcfa · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@dougqh

dougqh commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-02T04:11:14.436506Z 41f2dcf Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 41f2dcfa06

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@dougqh
dougqh marked this pull request as ready for review December 2, 2026 04:09
@dougqh
dougqh requested review from a team as code owners December 2, 2026 04:09
@dougqh
dougqh requested review from PerfectSlayer, claponcet and jordan-wong and removed request for a team December 2, 2026 04:09
@dd-octo-sts dd-octo-sts Bot added the tag: ai generated Largely based on code generated by an AI or LLM label Dec 2, 2026

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bits Code Review: FAIL

With integrations disabled globally and Jedis enabled explicitly, the pool-validation opt-out is ignored, so validation PING spans remain suppressed.

Open Bits AI session

🤖 Bits Code Review · Commit 41f2dcf

Comment on lines +49 to +53
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
named("validateObject"), PoolValidationInstrumentation.class.getName() + "$MuteAdvice");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Honor the pool-validation opt-out with selective integrations

With DD_INTEGRATIONS_ENABLED=false and DD_TRACE_JEDIS_ENABLED=true, setting DD_TRACE_REDIS_POOL_VALIDATION_ENABLED=false does not restore validation spans. InstrumenterModule ORs these integration settings when integrations default to disabled, so the enabled Jedis setting overrides the explicit suppression opt-out. Pool-validation PING spans remain suppressed despite the documented switch.

Suggested change
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
named("validateObject"), PoolValidationInstrumentation.class.getName() + "$MuteAdvice");
}
@Override
public void methodAdvice(MethodTransformer transformer) {
datadog.trace.api.InstrumenterConfig config = datadog.trace.api.InstrumenterConfig.get();
if (config.isIntegrationEnabled(
java.util.Collections.singletonList("redis-pool-validation"),
config.isIntegrationsEnabled())) {
transformer.applyAdvice(
named("validateObject"), PoolValidationInstrumentation.class.getName() + "$MuteAdvice");
}
}

React: 👍 useful · 👎 wrong · 😕 unclear · 👀 right, but not acting on it

What each reaction means
  • 👍 Useful: correct, and you're fixing it or will.
  • 👎 Wrong: the finding is incorrect, for example the bug can't happen or the code was misread.
  • 😕 Unclear: you can't tell what it means or why it matters.
  • 👀 Right, not acting: correct, but intended, out of scope for this PR, a known risk, or too minor.

🤖 Bits Code Review · Open Bits AI session

This branch has not been deployed

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

Labels

inst: jedis Jedis instrumentation inst: redis Redis instrumentation tag: ai generated Largely based on code generated by an AI or LLM type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant