Repository navigation
Record where a span's parent came from on DDSpanContext - #13452
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit into
Conversation
The span builder sets a final parentOrigin byte (none, local or remote) from the resolved parent context, so later consumers such as the otel.sdk.span.* self-monitoring metrics can tell extracted parents from in-process ones after the parent context is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis 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
Parent-origin classification follows the resolved parent context, including roots and remote parents dropped on restart. Legacy constructors preserve compatibility by deriving NONE or LOCAL from the parent ID.
🤖 Bits Code Review · Commit 09d07d7
🟢 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. |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
Build pipeline has failing jobs for baa4061: What to do next?
DetailsSince those jobs are not marked as being allowed to fail, the pipeline will most likely fail. |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
e5fdfc1
into
master
…-known-custom Resolves #12998's package move (datadog.contract.Restricted) and adapts master's #13452 and SpanKind changes to the split stores: the new DDSpanContext constructor drops the removed tagsSize parameter, and seedAbsentSpanKind checks and stores span.kind through knownTags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
) Have the span own its tag stores directly DDSpanContext holds its IdStore (also its tag lock) and its HashStore instead of one TagMap, and routes each write to the store that holds the tag: a name is resolved once and routed, and a write by id goes straight to the id store. The custom store is borrowed read-only from the read-through parent until the span's first custom write. The eager post-processors already read and write the span through TagStore. The lazy post-processors and the serializer still take a TagMap: the span builds a view over its stores once, at serialization, and caches it (about 32 B per span until they move to TagStore). TagMap.Internals, the core's trusted side door, is gone: the stores are the direct path. The constructors drop the unused tagsSize parameter. Allocation, 7-span web-request trace: +104 B (+1.3%), from the new DDSpanContext fields (8 B per span) and the first custom store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Use the bare KnownTags id names #13061 named 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> Remove the tag when a map write carries a null value setAllTags and unsafeSetTag passed null values straight to the stores, which take none, leaving a null-valued entry: the tag still showed in getTags() and could break serialization. TagMap.set removed the tag on null, as setTag does; route a null to removal again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Keep copying root-span tags locally when exporting OTLP With builder-tag precedence, root spans read their trace-level tags through a shared parent. The OTLP span writer emits only a span's own tags, so root-only tags (process_id, runtime-id, language, profiling) dropped out of OTLP exports. Turn the read-through off when OTLP export is on, decided once at startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Copy root-span tags into root spans again instead of reading them through With builder-tag precedence, root spans read their root-span tags through a shared frozen parent. A parent is always the lowest layer, which is the same as applying it first, but root tags used to be applied after the inbound request's tags: a request header mapped onto a root-tag name (process_id, runtime-id, language, ...) now overrode it. The OTLP span writer also emits only local tags, so it lost them. Copy root tags into root spans again, as on master. Only the merged tracer tags, which were already applied first, stay in the read-through parent. That also makes the OTLP-export exception unnecessary. Root spans keep about 5-7 more tags locally. RootSpanTagsReadThroughTest becomes RootSpanTagsTest, which checks root and child spans in both precedence modes and that root tags win over same-named inbound tags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Merge remote-tracking branch 'origin/master' into dougqh/tagmap-split-known-custom Store setAllTags entries with the id already looked up setAllTags resolved each name to choose the interceptor, then stored the tag through unsafeSetTag, which resolved it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Drop the name-only routeSet overloads Each hid a KnownTagCodec.keyOf call, which is how setAllTags came to look a name up twice. Callers now resolve the id themselves, so every lookup is visible where it happens; setMetric does it before taking the lock. The comment introducing the route methods moves to where they start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Set the by-name map's db.pool.name by name again A rename turned DB_POOL_NAME_NAME into the id constant, so the test's by-name map set that tag by id, and still passed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Trim the knownTags Javadoc to what the field needs; use SPAN_KIND_NAME The Storage section repeated what customTags and tagView say, and the rest is now the lock's scope, why it is reentrant, and who skips it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Trim the tag storage comments; post-processors don't call span setters The knownTags Javadoc said post-processors call back into the span's setters while the lock is held. None does: they write through the view. If one did, a custom tag written through the view could miss the span, so tagView now states the rule, and the rest of the comments are trimmed or dropped where the code says it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Merge remote-tracking branch 'origin/master' into dougqh/tagmap-split-known-custom Resolves #12998's package move (datadog.contract.Restricted) and adapts master's #13452 and SpanKind changes to the split stores: the new DDSpanContext constructor drops the removed tagsSize parameter, and seedAbsentSpanKind checks and stores span.kind through knownTags. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: douglas.hawkins <douglas.hawkins@datadoghq.com>
What Does This Do
Every
DDSpanContextnow records where its parent came from, as a finalparentOriginbyte with one of three values:PARENT_ORIGIN_NONE: no parent span ID.PARENT_ORIGIN_LOCAL: the parent is in-process.PARENT_ORIGIN_REMOTE: the parent is an extracted context.CoreTracer.buildSpanContextsets it from the resolved parent context, andDDSpanContext.getParentOrigin()exposes it. There is no behavior change: nothing reads it in production yet, and it is not serialized or tagged.Motivation
The OTel SDK self-monitoring metrics
otel.sdk.span.startedandotel.sdk.span.liveneed theotel.span.parent.originattribute (none/local/remote). Today the span keeps onlyparentIdonce it is built, so it can't tell an extracted parent from an in-process one. The hook that ends a span also needs the same origin that was recorded at start, so the origin has to live on the span context. This PR adds the field. The metrics PR that reads it follows separately.Additional Notes
parentSpanId == DDSpanId.ZEROthe origin isNONE. Otherwise it isREMOTEwhenresolvedParentSpanContext.isRemote()andLOCALwhen not.REMOTEtherefore mirrorsAgentSpanContext.isRemote().ExtractedContextandTagContextreport remote.TagContextwith no trace, or a remote parent dropped undertrace.propagation.behavior.extract=restart, ends up with no parent span ID, so it isNONE.DatabricksParentContext,OpenlineageParentContext,PredeterminedTraceIdContext) reportisRemote() == false, so they classify asLOCAL.parentOrigin. The previous primary constructor delegates to it and derives the origin fromparentIdalone (NONEorLOCAL), so the other 23 call sites, mostly tests and JMH benchmarks, are unchanged.ClassLayout.parseClass(DDSpanContext.class), Temurin 25).DDSpanContextstays at 152 B with compressed oops, and at 248 B in JOL's simulated layout without compressed oops. The byte fills an existing 1-byte padding gap, and no reference field moves.CoreSpanBuilderTestcases: root span, child of a local span, child of an extracted context, child of an emptyTagContext, and a remote parent dropped on restart.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: [PROJ-IDENT]
🤖 Generated with Claude Code