Skip to content

Set database client and JDBC span tags by id (tag registry rollout) - #13193

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
dougqh/jdbc-tag-ids
Nov 6, 2026
Merged

gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
masterfrom
dougqh/jdbc-tag-ids

Conversation

@dougqh

@dougqh dougqh commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

Sets database span tags with KnownTags ids instead of names, in two places:

  • DatabaseClientDecorator, which every database client's spans go through (JDBC, Redis, Mongo, Cassandra, ...): db.user, peer.hostname, db.instance, db.type.
  • JDBC:
    • db.operation, db.warehouse, db.schema, db.pool.name, component
    • _dd.propagated_hash, _dd.dbm_trace_injected, _dd.instrumentation.time_ms
    • JDBCDecorator.setTagIfPresent now takes the id. All of its callers passed constants.
    • The one "_dd.dbm_trace_injected" string literal becomes the same id as its constant.

Motivation

This continues the move to ids after Kafka (#13192). Every one of these tags was already registered, so the change is mechanical. The decorator part benefits every database client, not just JDBC.

Additional Notes

  • No behavior change. For a known tag, the core span's setTag(String, …) resolves the name and calls setTag(long, …). This PR calls the id setter directly, so storage and interception are unchanged.
  • Left as is: .withTag("dd.instrumentation", true) on the span builder. The builder has no id-keyed withTag yet, and dd.instrumentation isn't registered.
  • Stacked on Name KnownTags ids after their tags and fail on constant clashes (tag registry rollout) #13061, for its bare id names (DB_POOL_NAME). It doesn't depend on Set Kafka span tags by id (tag registry rollout) #13192.
  • Testing:
    • agent-bootstrap decorator tests pass (414). Their Spock mocks still match string-keyed setTag assertions, because the id default method delegates to the name.
    • jdbc test: 328 pass. The other 100 are RemoteJDBCInstrumentationV0Test, which needs Docker (Testcontainers) and couldn't run locally. CI will cover them.

🤖 Generated with Claude Code

@dougqh dougqh added comp: core Tracer core tag: no release notes Changes to exclude from release notes type: refactoring inst: jdbc JDBC instrumentation tag: ai generated Largely based on code generated by an AI or LLM labels Nov 3, 2026
@dougqh
dougqh marked this pull request as ready for review November 3, 2026 22:39
@dougqh
dougqh requested review from a team as code owners November 3, 2026 22:39
@dougqh
dougqh requested review from amarziali and ygree and removed request for a team November 3, 2026 22:39
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T22:41:15.105330Z 67bb80a 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.

@datadog-prod-us1-4 datadog-prod-us1-4 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.

Bits Code Review: PASS

More details

The registered IDs match the existing database and JDBC tag keys and preserve setter overloads, null handling, and tag interception.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 67bb80a

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 59.99% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 08dac0f | Docs | Give us feedback!

@dd-octo-sts

dd-octo-sts Bot commented Nov 3, 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 13.97 s 13.92 s [-0.3%; +1.0%] (no difference)
startup:insecure-bank:tracing:Agent 12.89 s 12.94 s [-1.2%; +0.4%] (no difference)
startup:petclinic:appsec:Agent 17.21 s 17.07 s [+0.1%; +1.4%] (maybe worse)
startup:petclinic:iast:Agent 16.40 s 16.61 s [-7.3%; +4.8%] (unstable)
startup:petclinic:profiling:Agent 16.70 s 16.83 s [-1.9%; +0.3%] (no difference)
startup:petclinic:sca:Agent 17.10 s 17.00 s [-0.4%; +1.6%] (no difference)
startup:petclinic:tracing:Agent 15.78 s 16.21 s [-6.9%; +1.6%] (no difference)

Commit: 08dac0f7 · 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.

@ygree ygree 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.

IDM approved

@dougqh
dougqh force-pushed the dougqh/jdbc-tag-ids branch from 67bb80a to d82541c Compare November 5, 2026 20:34
@dougqh
dougqh force-pushed the dougqh/known-tags-full-suffix branch from d983320 to 7e702ac Compare November 5, 2026 20:44
@dougqh
dougqh requested review from a team as code owners November 5, 2026 20:44
@dougqh
dougqh requested review from claponcet, manuel-alvarez-alvarez and mhlidd and removed request for a team November 5, 2026 20:44
@dougqh
dougqh force-pushed the dougqh/jdbc-tag-ids branch from d82541c to 7ebc223 Compare November 5, 2026 20:50

@datadog-prod-us1-4 datadog-prod-us1-4 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.

Bits Code Review: FAIL

The new collision policy rejects the existing shared plugin fixture, breaking build-plugin verification. The constant rename also silently narrows the bucket-hash checks to tags whose names still end in _ID.

Open Bits AI session

🤖 Bits Code Review · Commit d82541c


Findings that could not be posted inline

build-logic/tag-registry/src/main/kotlin/datadog/buildlogic/tagRegistry/KnownTagsEmitter.kt:36

P1 Adapt the shared plugin fixture to the new collision policy

TagRegistryGeneratorPluginTest's shared fixture still declares both foo and foo.name. These now claim FOO_NAME as a string constant and an ID respectively, causing generation to throw before the existing compilation, cache, and custom-output assertions. Update the shared fixture or provide a java_names override alongside this collision-policy change.

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

build-logic/tag-registry/src/main/kotlin/datadog/buildlogic/tagRegistry/KnownTagsEmitter.kt:47

P2 Update bucket-hash ID enumeration for the removed suffix

TagMapBucketHashTest.knownTagIds() still selects reflected long fields whose names end in _ID. After this rename, it only includes tags whose names naturally have that suffix, silently excluding tags such as HTTP_METHOD and HTTP_ROUTE from the distinct-hash and slot-bucketing checks. Remove the suffix predicate in that helper to preserve coverage of all generated IDs.

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

Base automatically changed from dougqh/known-tags-full-suffix to master November 6, 2026 17:24
dougqh and others added 2 commits November 6, 2026 12:28
DatabaseClientDecorator, which every database client's spans go
through, and the JDBC instrumentation now set their tags with KnownTags
ids instead of names. All of them were already registered; the
"_dd.dbm_trace_injected" literal becomes the same id as its constant.
JDBCDecorator's setTagIfPresent takes the id.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#13061 now names an id after its tag with no _ID suffix. Rename only;
the ids are the same values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh
dougqh force-pushed the dougqh/jdbc-tag-ids branch from 7ebc223 to 08dac0f Compare November 6, 2026 17:30

@datadog-prod-us1-4 datadog-prod-us1-4 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.

Bits Code Review: FAIL

Renaming generated tag constants leaves the bucket-hash tests filtering by the old _ID suffix, silently excluding database and HTTP tags from their checks.

Open Bits AI session

🤖 Bits Code Review · Commit 7ebc223


Findings that could not be posted inline

build-logic/tag-registry/src/main/kotlin/datadog/buildlogic/tagRegistry/KnownTagsEmitter.kt:47

P2 Preserve full tag enumeration in the bucket-hash tests

After this rename, TagMapBucketHashTest.knownTagIds() still requires field names ending in "_ID", so it selects only 16 of 330 tags and omits every database and HTTP tag. The uniqueness and slot-placement checks therefore keep passing without exercising most of the registry. Update that helper to select static long fields independently of their names.

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

@dougqh

dougqh commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-11-06 18:36:37 UTC ℹ️ Start processing command /merge


2026-11-06 18:36:42 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 1h (p90).


2026-11-06 19:44:41 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit c2f0925 into master Nov 6, 2026
683 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the dougqh/jdbc-tag-ids branch November 6, 2026 19:44
@github-actions github-actions Bot added this to the 1.69.0 milestone Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core inst: jdbc JDBC instrumentation tag: ai generated Largely based on code generated by an AI or LLM tag: no release notes Changes to exclude from release notes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants