[reference] R2DBC net-new instrumentation — regen vs sharpened DB skill (toolkit output) - #12237
Draft
jordan-wong wants to merge 1 commit into
Draft
[reference] R2DBC net-new instrumentation — regen vs sharpened DB skill (toolkit output)#12237jordan-wong wants to merge 1 commit into
jordan-wong wants to merge 1 commit into
Conversation
…ll (toolkit output) Toolkit-generated R2DBC instrumentation (io.r2dbc:r2dbc-spi:1.0.0.RELEASE), regenerated against the apm-instrumentation-toolkit's sharpened database-category rules. NOT a merge candidate — a research/reference artifact. Improvement over the earlier reference PR #12032: the generator now hooks the OTel-correct entry point — ConnectionFactory.create() + ConnectionFactoryOptions, threaded via MetadataWrappingPublisher -> R2dbcConnectionInfo -> statement/batch spans — and the decorator populates db.name/peer.hostname/db.user/peer.port. KNOWN DEFECT (do not fix on this branch — it is the finding): the module is CI-green (:check :muzzle :allLatestDepTests pass, 11/11 unit tests) but emits ZERO spans on a real driver. Every advice declares a writable @Advice.Return(readOnly=false) Publisher<...> against methods that return concrete Mono/Flux, so Byte Buddy fails 3 class transformations at runtime (io.r2dbc.pool.ConnectionPool, io.r2dbc.h2.H2ConnectionFactory, io.r2dbc.h2.H2Statement: "Cannot assign interface org.reactivestreams.Publisher to class reactor.core.publisher.Mono/Flux") and the classes load uninstrumented. The SPI-fake test suite binds where real drivers won't, hiding the failure from CI. Verified live against a Spring Data R2DBC / H2 app (eugenp spring-reactive-data): 0 R2DBC spans under this agent vs 13 under the OpenTelemetry Java agent 2.30.0. Full write-up: apm-instrumentation-toolkit docs/eval-research/runs/r2dbc/attempt-dbskill-20260818/outcome.md and docs/eval-research/r2dbc-live-trace-comparison-2026-08-17.md. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🎯 Code Coverage (details) 🔗 Commit SHA: 882acfb | Docs | View more details | Give us feedback! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Toolkit-generated R2DBC instrumentation (
io.r2dbc:r2dbc-spi:1.0.0.RELEASE), regenerated by the apm-instrumentation-toolkit against its sharpened database-category rules. This is a reference/research artifact — NOT a merge candidate. It supersedes nothing; the original reference PR #12032 stays as-is.Generated module:
dd-java-agent/instrumentation/r2dbc/r2dbc-1.0/.Why this regen exists
#12032 was generated before the toolkit's database-category rules were sharpened (SPI-first targeting, eager connection-metadata capture, muzzle handling). This run tests whether the improved skill produces a better R2DBC — and it does, in architecture. But a live-trace comparison against the OpenTelemetry SDK surfaced that it still doesn't actually emit spans on a real driver, for a new, mechanical reason.
Improvement over #12032 (architecture)
The DBM feature step now hooks the OTel-correct entry point:
ConnectionFactory.create()+ConnectionFactoryOptions(host/port/database/user live here, not onConnectionMetadata), threaded via a newMetadataWrappingPublisher→R2dbcConnectionInfo→ statement/batch spans.R2dbcDecoratornow populatesdb.name/peer.hostname/db.user/peer.port(in [reference] R2DBC net-new instrumentation (io.r2dbc:r2dbc-spi 1.0.0, toolkit output) #12032 these were hardcodednull).Known defect — the finding (do NOT fix on this branch)
The module is CI-green but emits ZERO spans on a real driver.
:check,:muzzle,:allLatestDepTestsall pass; 11/11 unit tests pass.@Advice.Return(readOnly = false) Publisher<...>, while real driver methods return the concreteMono/Flux. Byte Buddy refuses to bind the interface into the concrete return slot, so class transformation fails at runtime and the classes load uninstrumented:So the (correct) new connection-metadata architecture never runs. The SPI-fake test suite binds where real drivers won't, which is why CI is green.
Live verification — Spring Data R2DBC / H2 app (eugenp
spring-reactive-data),GET /products×3:ConnectionFactoryOptions(but dead)Remediation (for a future working version, not this branch)
Type the writable
@Advice.Returnso Byte Buddy can bind it against a concrete-Mono/Flux-returning method — e.g.@Advice.Return(readOnly = false) Object+ cast, orAdvice.AssignReturned— on all three advices (ConnectionFactoryCreateAdvice,StatementExecuteAdvice,BatchExecuteAdvice). AND add at least one integration test against a real driver (r2dbc-h2), not only an SPI fake.Provenance
eval/java@d9dcb160(force-read DB rules R-DB-1..6).docs/eval-research/runs/r2dbc/attempt-dbskill-20260818/outcome.mdanddocs/eval-research/r2dbc-live-trace-comparison-2026-08-17.md.🤖 Generated by apm-instrumentation-toolkit. Reference/research artifact — not a merge candidate.