Repository navigation
Resolve direction-scoped OpenTelemetry names when reading span tags (OTLP/tag registry) - #12972
Conversation
getTag and unsafeGetTag already resolve an OpenTelemetry name to its Datadog tag when the name means the same tag in every direction. Names whose tag depends on the span's direction (server.address is http.hostname inbound and peer.hostname outbound) found nothing, so a sampling rule on server.address never matched. After a plain lookup misses, resolve such a name by the span's kind, using the cached span-kind ordinal. A tag set under the literal name still wins, and spans with no direction resolve nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
Existing tag values retain precedence, while direction-scoped misses resolve consistently with the registry mappings and cached span kind.
🤖 Bits Code Review · Commit 81429bf
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
fff28e2
into
master
What Does This Do
Makes
getTagandunsafeGetTagresolve OpenTelemetry names whose tag depends on the span's direction, using the span's kind:server.addresshttp.hostnamepeer.hostnameserver.portserver.port(its own tag)peer.portnetwork.peer.addressnetwork.client.ipclient.portpeer.port(the client's port)The fallback runs only after a plain lookup misses:
server.addressset through the Datadog API, stored as a custom tag) is still returned first.nullresults change: a read that finds something today returns the same value.server.porton outbound spans:server.portis also a Datadog name (the server's own port, set only on inbound spans). On a client or producer span, a read ofserver.portthat misses now returnspeer.port, matching its OpenTelemetry meaning there. So a sampling rule such asserver.port:5432matches database client spans. A Datadog-meaning reader can't get a wrong value, because the Datadogserver.porttag isn't set on outbound spans.The direction comes from the cached span-kind ordinal, so the fallback doesn't touch the tag map or take a lock to find it.
Motivation
Tag sampling with OpenTelemetry names. Trace and span sampling rules match tags with
span.getTag(name). Today, a rule written with the OpenTelemetry name of a direction-independent rename already works (http.request.method,http.response.status_code,url.full, …), becauseTagMapmaps OTel names to Datadog names on lookup. But a rule onserver.addresssilently never matched, becauseKnownTagCodec.keyOfdeliberately returns 0 for direction-scoped names. Resolving direction was only done at the OpenTelemetry boundary, on writes.Checked on master before this change, with a probe against real spans:
http.methodvshttp.request.method: match;http.status_codevshttp.response.status_code:2*: match;server.addresson server spans (http.hostname) and on client spans (peer.hostname): no match.Timing: sampling decides at the first inject or at the root's finish (trace sampling), or at span finish (span sampling). By then, decorators, span prototypes or the OpenTelemetry span builder have set
span.kind.Additional Notes
directionalKeyOf). Internal readers are moving to tag ids, so the name path being a little slower on misses is acceptable.DDSpanContextTest):server.addressmatches a client span throughTagsMatcher.dd-trace-core; the only failures are the two Docker-based tests (no Docker locally).DDSpanContext's tag storage. This fallback is a few lines and moves easily with it.Jira ticket: [PROJ-IDENT]
🤖 Generated with Claude Code