Conversation
|
Thank you for updating Change log entry section 👏 Visited at: 2026-04-15 09:21:37 UTC |
Typing analysisNote: Ignored files are excluded from the next sections.
|
|
✅ Tests 🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 7ad9047 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
74333c7 to
c6b3f68
Compare
BenchmarksBenchmark execution time: 2026-04-14 11:05:11 Comparing candidate commit c6b3f68 in PR branch Found 0 performance improvements and 2 performance regressions! Performance is the same for 43 metrics, 1 unstable metrics.
|
`_dd.base_service` is now set via the `before_finish` hook in `SpanOperation#finish`, so tests must operate on a finished span. Move `environment service name` and `schema version span` examples from `describe '#perform'` (where `complete` is mocked and the span is never finished) to `describe '#complete'` (where the full lifecycle runs). Remove those two examples from inside the ethon `'span'` shared example, since `'span'` is also used with open `SpanOperation`s in `#perform`. Drop the `span.finish` workaround from both shared examples now that no caller passes an unfinished span.
What does this PR do?
Introduces a
before_finishhook onSpanOperationand a correspondingspan_before_finisheventon
TraceOperation. Moves the_dd.base_servicetag-writing logic out of each individualintegration and into a single centralized tracer subscriber that fires on every span finish.
Motivation:
The
_dd.base_servicetag needs to be set consistently on every span, regardless of whichintegration produced it. Before this change, the logic was copy-pasted across ~26 integrations.
This created two problems:
incorrect service naming without any obvious failure signal.
build_spanfreezes the
SpanOperationinto an immutableSpan. The hook makes the timing contractexplicit — subscribers are guaranteed a write window immediately before
build_spanis called.A
before_finishhook is the right abstraction here because the tag must be computed from thefinal state of the span (service name is known, parent context is resolved) but must be written
before the span is frozen. Neither
before_start(service not yet set) norafter_finish(spanis immutable) satisfies this constraint.
Change log entry
None.
Additional Notes:
The hook follows the same pattern as the existing
before_start/after_finish/after_stopevents, so no new mechanism is introduced. The
SpanOperation::Events::BeforeFinish→TraceOperation::Events::SpanBeforeFinish→ tracer subscriber chain mirrors howbefore_startpropagates today.