Skip to content

feat(jedis): regenerate jedis-3.0 instrumentation [reference] - #12080

Draft
jordan-wong wants to merge 2 commits into
masterfrom
eval/jedis-3.0-blind-regen-20260726-clean
Draft

feat(jedis): regenerate jedis-3.0 instrumentation [reference]#12080
jordan-wong wants to merge 2 commits into
masterfrom
eval/jedis-3.0-blind-regen-20260726-clean

Conversation

@jordan-wong

@jordan-wong jordan-wong commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🤖 Generated with APM Instrumentation Toolkit

[Reference PR — not intended to be merged as-is.] This is a toolkit-generated regeneration of the existing jedis-3.0 instrumentation, opened as a reference artifact to evaluate generation quality against the current instrumentation guidance. It is not a request to replace the production module.

What Does This Do

Regenerates the jedis-3.0 Redis client instrumentation from scratch:

  • Instruments redis.clients.jedis.Connection#sendCommand(ProtocolCommand, ...) to create a client span per Redis command, with a class-loader matcher scoping it to Jedis 3.x (ProtocolCommand present, CommandObject absent).
  • Muzzle directive: explicit fail [,3.0.0) + pass [3.0.0,4.0.0), including skipVersions += "jedis-3.6.2" to handle that release's malformed jedis--prefixed version string.
  • Migrates the test suite to the newer Java/JUnit instrumentation-test DSL (AbstractInstrumentationTest / SpanMatcher / TagsMatcher), with base + V0 + V1 forked variants.

Motivation

Evaluates whether the current instrumentation guidance produces a correct, muzzle-clean Jedis module without manual intervention — in particular whether the muzzle version-range pattern and the skipVersions library quirk are handled automatically. Both were produced correctly this run (the skipVersions gap was caught and fixed by an automated review check rather than requiring a manual CI round-trip).

Additional Notes

Local CI-equivalent verification (:check :muzzle :latestDepTest, single-JVM):

  • muzzle — GREEN (all AssertPass/AssertFail tasks pass; jedis-3.6.2 correctly skipped)
  • spotless — GREEN
  • latestDepTest — reported green but executes no concrete tests (see CI Triage Status below); not a meaningful pass.
  • forkedTest2 red: wrongTypeCommandSetsErrorTags (V0 + V1). See the corrected root-cause analysis and the automated-review findings in CI Triage Status below. These are open items for maintainer decision, not yet resolved.

Multi-JVM CI matrix (JDK 8/17/21/25): the same single shard (6/8 = jedis-3.0) fails identically across all JVMs.

Comparison against the existing jedis-3.0 module

  • Integration name (super("jedis", "redis")): identical — no rename, no config-surface change.
  • Muzzle range: byte-for-byte identical, including skipVersions += "jedis-3.6.2".
  • metadata/supported-configurations.json: jedis entries identical — no dropped _ENABLED flags.
  • One divergence to flag: this regeneration adds a classLoaderMatcher() (scoping to Jedis 3.x by requiring ProtocolCommand and excluding CommandObject) that the current module does not have — the current module relies on muzzle range alone for version scoping. Additive and arguably a tighter classloader isolation, but noting it explicitly for reviewers.
  • Test structure: same 2-source-file main (JedisInstrumentation + JedisClientDecorator, no helper extraction) and the standard v0/v1 attribute-schema forked-test split.

CI Triage Status

Last updated: 2026-07-28

Classified as infra / test-framework gap (not an instrumentation defect):

  • dd-gitlab/test_inst: [8|11|17|21|25|tip, 6/8] — all six JVM variants of shard 6/8 fail on wrongTypeCommandSetsErrorTags. Shard 6/8 is confirmed to be :dd-java-agent:instrumentation:jedis:jedis-3.0 (verified via the repo's abs(project.path.hashCode() % 8) + 1 shard math). Reproduces identically in local forkedTest. Corrected root cause: the assertion Unexpected error status. True expected but was: false — the generated test asserts the LPUSH span is marked as an error (from Redis's WRONGTYPE reply), but the span is not. This is a generated test that the existing jedis-3.0 module never had (master has no wrong-type/error test); Jedis 3.x surfaces the WRONGTYPE error when the response is read, not as a throwable out of the instrumented sendCommand, so the @Advice.Thrown at method exit is null and DECORATE.onError never marks the span. Needs a maintainer decision: either the error-capture hook point is genuinely narrower than the test assumes (instrumentation-logic finding) or the invented test over-asserts. Not silently fixed.
  • dd-gitlab/default-pipeline — umbrella pipeline; fails only because the shard 6/8 child above fails. No independent cause.

Confirmed findings from automated (Codex) review — do not silently fix:

  • latestDepTest runs zero concrete tests (Codex P2): both concrete test classes (Jedis30ClientV0ForkedTest, Jedis30ClientV1ForkedTest) are *ForkedTest, but the module registers only latestDepTest, not latestDepForkedTest. Forked classes are excluded from latestDepTest, and the remaining shared class is abstract — so latestDepTest can report green while executing no instrumentation tests against the declared Jedis 3.+. This invalidates the earlier "latestDepTest GREEN" claim. Needs either a non-forked v0 concrete class or a registered latestDepForkedTest suite.
  • peer.service assertions weakened to any() (Codex P2): the removed Groovy test verified peer.service equals the hostname and _dd.peer.service.source identifies that tag; the generated test replaced these with any(), which passes even if the tag is absent or wrong — a silent loss of coverage vs. the original.
  • error.msg not matched (Codex P1): error(JedisDataException.class) matches only error.type/error.stack, but BaseDecorator.onError → DDSpan.addThrowable also emits error.msg; the strict matcher would reject the extra tag. (Secondary to the error-status failure above, but same test.)

Fixed (config/mechanical):

  • spotless — formatting drift from the generation run, fixed via spotlessApply (commit 567dc872cc) before the PR was opened. Currently green.

To fix (mechanical, pending push approval):

  • Deleted gradle.lockfile (Codex P2): AGENTS.md requires a per-project gradle.lockfile; the regeneration deleted it, unpinning the dependency graph (including the 3.+ dynamic latestDepTest version). Should be regenerated, not removed. Mechanical (a)-class fix.

Still unclassified: none.

Pre-review checklist

  • Phase 1 (blind/additive integrity): PASS — generation stayed scoped to jedis-3.0; siblings jedis-1.4/jedis-4.0 untouched; draft skill confirmed loaded.
  • Phase 2 (diff scope): PASS — 8 files, all under jedis/jedis-3.0/, no .analysis/ pollution, no sibling contamination.
  • Phase 3 (master overrides): PASS with 1 documented divergence (added classLoaderMatcher(), see above). super(...), muzzle range, and metadata all preserved verbatim.
  • Phase 4 (category rules — Cat A cache client): PASS — no Thread.sleep, no jvmArgs override, no helper-class extraction; forked variants isolate on @WithConfig(trace.span.attribute.schema) which is self-documenting.
  • Phase 5 (CI-equivalent): muzzle/spotless GREEN. latestDepTest reported green but — per Codex review — executes no concrete tests (see findings above), so it is not a meaningful pass. forkedTest red on the error-status assertion (see corrected root cause above). Same single shard fails across all JVMs.
  • Phase 9 (post-PR CI triage): 1 (a) fix pre-applied (spotless); 1 (a) fix pending (regenerate gradle.lockfile); 3 review findings documented and left un-fixed for maintainer decision (error-status test, zero-concrete-latestDep, weakened peer.service assertions).

Jira ticket: [N/A — reference artifact]

🤖 Generated with APM Instrumentation Toolkit

Blind regen against dd-trace-java skill at b994882 (includes skill PR #11927).
Toolkit run: jedis3_blind_regen.log, run_id 20260727-002431-fab584.
Not intended to be merged as-is.
@jordan-wong jordan-wong added apm-integration-toolkit inst: jedis Jedis instrumentation type: feature Enhancements and improvements labels Jul 27, 2026
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 57.56% (-0.03%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 567dc87 | Docs | Datadog PR Page | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Jul 27, 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.00 s 13.97 s [-0.5%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 12.93 s 13.02 s [-1.6%; +0.2%] (no difference)
startup:petclinic:appsec:Agent 16.89 s 16.79 s [-0.4%; +1.6%] (no difference)
startup:petclinic:iast:Agent 16.88 s 16.38 s [-1.4%; +7.4%] (no difference)
startup:petclinic:profiling:Agent 16.59 s 16.88 s [-3.0%; -0.4%] (maybe better)
startup:petclinic:sca:Agent 16.90 s 16.78 s [-0.2%; +1.6%] (no difference)
startup:petclinic:tracing:Agent 16.12 s 15.99 s [-0.1%; +1.6%] (no difference)

Commit: 567dc872 · 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.

@PerfectSlayer PerfectSlayer added tag: ai generated Largely based on code generated by an AI or LLM tag: apm integration toolkit Changes generated by DataDog/apm-instrumentation-toolkit as part of IDM AIT experimentation labels Jul 28, 2026
@PerfectSlayer

Copy link
Copy Markdown
Contributor

I updated the label to the ones from the repo.
Can you make sure the bot don’t create new ones? Thanks!

@jordan-wong

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 567dc872cc

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

tag("_dd.peer.service.source", any()),
tag("_dd.svc_src", any()),
tag("peer.service", any()),
error(JedisDataException.class),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Match the exception message tag

When LPUSH throws the expected JedisDataException, BaseDecorator.onError calls DDSpan.addThrowable, which always emits error.msg; however, error(JedisDataException.class) only matches error.type and error.stack, so SpanMatcher rejects the extra message tag and this test fails in both forked variants. Capture the exception returned by assertThrows and pass it to error(exception), or explicitly match its message.

Useful? React with 👍 / 👎.

Comment on lines +94 to +96
tag("_dd.peer.service.source", any()),
tag("_dd.svc_src", any()),
tag("peer.service", any()),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve exact peer-service assertions

For the v1 fork, the removed Groovy test's peerServiceFrom(Tags.PEER_HOSTNAME) verified that peer.service equals the hostname and that _dd.peer.service.source identifies that hostname tag. Replacing those checks with any() accepts incorrect values and even absent tags because SpanMatcher treats an unmatched Any matcher as optional, so a peer-service regression now passes the entire suite; match the expected values and schema-specific presence instead.

Useful? React with 👍 / 👎.

@@ -1,133 +0,0 @@
# This is a Gradle generated file for dependency locking.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore the module dependency lock

Deleting this lock file leaves the module's dependency graph—including the latestDepTest declaration using dynamic version 3.+—unpinned, so identical revisions can resolve different Jedis and transitive versions over time. The repository's Gradle source of truth requires a per-project gradle.lockfile; regenerate it after changing the test dependency rather than removing it.

AGENTS.md reference: AGENTS.md:L39-L44

Useful? React with 👍 / 👎.


@WithConfig(key = "trace.span.attribute.schema", value = "v0")
@WithConfig(key = "trace.db.client.split-by-instance", value = "true")
class Jedis30ClientV0ForkedTest extends Jedis30ClientTest {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restore latest-dependency test execution

The only concrete v0 test was changed from a regular test to a ForkedTest, but this module registers only latestDepTest, not latestDepForkedTest; forked classes are excluded from latestDepTest, and the remaining shared class is abstract. Consequently the task can report green without executing any instrumentation tests against the declared Jedis 3.+ dependency, so retain a non-forked v0 concrete class or register and run a latest-dependency forked suite.

AGENTS.md reference: AGENTS.md:L63-L65

Useful? React with 👍 / 👎.

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

Labels

inst: jedis Jedis instrumentation tag: ai generated Largely based on code generated by an AI or LLM tag: apm integration toolkit Changes generated by DataDog/apm-instrumentation-toolkit as part of IDM AIT experimentation type: feature Enhancements and improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants