Skip to content

Fix assumptions about what a top_level span is#3916

Open
bwoebi wants to merge 2 commits into
masterfrom
bob/fix-span-stats
Open

Fix assumptions about what a top_level span is#3916
bwoebi wants to merge 2 commits into
masterfrom
bob/fix-span-stats

Conversation

@bwoebi
Copy link
Copy Markdown
Collaborator

@bwoebi bwoebi commented May 25, 2026

Otherwise span stats will be broken for nested services.

Also properly handling version propagation, its removal according to UST was too aggressive until now.

@bwoebi bwoebi requested review from a team as code owners May 25, 2026 15:26
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 531586746b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ext/span_stats.c
Comment on lines +394 to +397
zval *root_version_zv = &span->root->property_version;
ZVAL_DEREF(root_version_zv);
if (Z_TYPE_P(root_version_zv) == IS_STRING && ZSTR_LEN(Z_STR_P(root_version_zv)) > 0) {
version_zstr = Z_STR_P(root_version_zv);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use resolved version when keying concentrator writes

ddtrace_feed_span_to_concentrator now ignores pre->version and reads only span->root->property_version when it is already a string, which drops versions that were resolved via deprecated meta["version"] (still supported in ddtrace_precompute_span) or via non-string values converted during precompute. In those cases spans are emitted with a version tag but stats are keyed with an empty version, causing version-level stats to be mis-grouped or split from trace data.

Useful? React with 👍 / 👎.

@datadog-prod-us1-3
Copy link
Copy Markdown

datadog-prod-us1-3 Bot commented May 25, 2026

Pipelines  Tests

Fix all issues with BitsAI

⚠️ Warnings

🚦 26 Pipeline jobs failed

Check snapshots | check-snapshots   View in Datadog   GitHub Actions

🔄 Retry job. This looks flaky and may succeed on retry. Failed to download action archive from GitHub: 5018 error.

DataDog/apm-reliability/dd-trace-php | Extension Tea Tests: [7.3, zts]   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. Linking with `cc` failed: realloc(): invalid old size during the compilation of `cpp_demangle`.

DataDog/apm-reliability/dd-trace-php | compile appsec extension: [7.2, arm64, aarch64-unknown-linux-gnu]   View in Datadog   GitLab

🔄 Retry job. This looks flaky and may succeed on retry. Failed to pull image 'registry.ddbuild.io/images/mirror/datadog/dd-trace-ci:php-7.2_centos-7'. Error: 502 Bad Gateway during image retrieval.

View all 26 failed jobs.

ℹ️ Info

No other issues found (see more)

🧪 All tests passed
❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2dc3d7b | Docs | Datadog PR Page | Give us feedback!

@pr-commenter
Copy link
Copy Markdown

pr-commenter Bot commented May 25, 2026

Benchmarks [ tracer ]

Benchmark execution time: 2026-05-25 16:40:49

Comparing candidate commit 5315867 in PR branch bob/fix-span-stats with baseline commit 0fb4c56 in branch master.

Found 0 performance improvements and 14 performance regressions! Performance is the same for 178 metrics, 2 unstable metrics.

scenario:PDOBench/benchPDOOverhead

  • 🟥 execution_time [+11.019µs; +13.417µs] or [+4.477%; +5.452%]

scenario:PDOBench/benchPDOOverhead-opcache

  • 🟥 execution_time [+12.974µs; +14.846µs] or [+5.316%; +6.083%]

scenario:PDOBench/benchPDOOverheadWithDBM

  • 🟥 execution_time [+10.846µs; +13.490µs] or [+4.412%; +5.488%]

scenario:PDOBench/benchPDOOverheadWithDBM-opcache

  • 🟥 execution_time [+12.006µs; +14.084µs] or [+4.915%; +5.766%]

scenario:PHPRedisBench/benchRedisOverhead

  • 🟥 execution_time [+51.400µs; +69.178µs] or [+5.375%; +7.234%]

scenario:PHPRedisBench/benchRedisOverhead-opcache

  • 🟥 execution_time [+56.329µs; +71.108µs] or [+5.632%; +7.110%]

scenario:SpanBench/benchDatadogAPI

  • 🟥 execution_time [+4.812µs; +6.296µs] or [+7.480%; +9.788%]

scenario:SpanBench/benchDatadogAPI-opcache

  • 🟥 execution_time [+4.909µs; +5.752µs] or [+7.595%; +8.900%]

scenario:SpanBench/benchOpenTelemetryInteroperability

  • 🟥 execution_time [+4.724µs; +7.261µs] or [+2.505%; +3.850%]

scenario:SpanBench/benchOpenTelemetryInteroperability-opcache

  • 🟥 execution_time [+81.080µs; +85.228µs] or [+28.622%; +30.086%]

scenario:TraceFlushBench/benchFlushTrace

  • 🟥 execution_time [+53.371µs; +91.629µs] or [+4.570%; +7.846%]

scenario:TraceFlushBench/benchFlushTrace-opcache

  • 🟥 execution_time [+71.057µs; +93.143µs] or [+6.066%; +7.952%]

scenario:TraceSerializationBench/benchSerializeTrace

  • 🟥 execution_time [+94.875µs; +111.725µs] or [+22.730%; +26.767%]

scenario:TraceSerializationBench/benchSerializeTrace-opcache

  • 🟥 execution_time [+96.650µs; +110.750µs] or [+27.925%; +32.000%]

@bwoebi bwoebi force-pushed the bob/fix-span-stats branch 2 times, most recently from f69edb3 to 9883729 Compare May 26, 2026 11:25
@bwoebi bwoebi force-pushed the bob/fix-span-stats branch from 9883729 to 2dc3d7b Compare May 26, 2026 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant