Repository navigation
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.
Contributor
🟢 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. |
This branch has not been deployed
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 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