Skip to content

feat(profiling): Add setting to omit local root span id from serialized pprof [PROF-15045]#2104

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
ivoanjo/prof-150465-experiment-omit-root-span-id
Jun 11, 2026
Merged

feat(profiling): Add setting to omit local root span id from serialized pprof [PROF-15045]#2104
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
ivoanjo/prof-150465-experiment-omit-root-span-id

Conversation

@ivoanjo

@ivoanjo ivoanjo commented Jun 10, 2026

Copy link
Copy Markdown
Member

What does this PR do?

This PR adds a new API to profiles: set_omit_local_root_span_id_when_serializing. This API can be used to omit the local root span id from serialized pprof files.

Note that nothing else changes: The local root span id is still being tracked and used for everything in the profile, only never actually written in the pprof. Also, this is off by default and needs to be set on every profile before serialization (gets disabled again on profile reset).

Motivation

In https://datadoghq.atlassian.net/wiki/spaces/PROF/pages/6821413373/ADR+2026-06-04.1+Continue+using+span-child+filter+mode+remove+local-root-span+backend+support we discussed experimenting with having libraries not emit local root span id. This is very relevant for implementing OTel thread context, since "local root span" is not a common otel concept and we need to do extra work in all libraries to try to keep it.

Having this in libdatadog and in an off-by-default opt-in-api will allow us to easily test this.

Additional Notes

N/A

How to test the change?

This change includes test coverage. I plan to wire this up to dd-trace-rb and add an end-to-end test there.

@ivoanjo ivoanjo requested review from a team as code owners June 10, 2026 17:41
@datadog-official

datadog-official Bot commented Jun 10, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 84.29%
Overall Coverage: 73.36% (-0.01%)

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

… pprof

**What does this PR do?**

This PR adds a new API to profiles: `set_omit_local_root_span_id_when_serializing`.
This API can be used to omit the `local root span id` from serialized
pprof files.

**Note that nothing else changes**: The `local root span id` is still
being tracked and used for everything in the profile, only never
actually written in the pprof. Also, this is off by default and needs to
be set on every profile before serialization (gets disabled again on
profile reset).

**Motivation:**

In <https://datadoghq.atlassian.net/wiki/spaces/PROF/pages/6821413373/ADR+2026-06-04.1+Continue+using+span-child+filter+mode+remove+local-root-span+backend+support>
we discussed experimenting with having libraries not emit local root
span id. This is very relevant for implementing OTel thread context,
since "local root span" is not a common otel concept and we need
to do extra work in all libraries to try to keep it.

Having this in libdatadog and in an off-by-default opt-in-api will
allow us to easily test this.

**Additional Notes:**

N/A

**How to test the change?**

This change includes test coverage. I plan to wire this up to
dd-trace-rb and add an end-to-end test there.
@ivoanjo ivoanjo force-pushed the ivoanjo/prof-150465-experiment-omit-root-span-id branch from 6e61d14 to 8ed96aa Compare June 10, 2026 17:41
@ivoanjo ivoanjo changed the title [PROF-15045] Add setting to omit local root span id from serialized pprof feat(profiling): [PROF-15045] Add setting to omit local root span id from serialized pprof Jun 10, 2026
@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Clippy Allow Annotation Report

Comparing clippy allow annotations between branches:

  • Base Branch: origin/main
  • PR Branch: origin/ivoanjo/prof-150465-experiment-omit-root-span-id

Summary by Rule

Rule Base Branch PR Branch Change
unwrap_used 1 1 No change (0%)
Total 1 1 No change (0%)

Annotation Counts by File

File Base Branch PR Branch Change
libdd-profiling/src/internal/profile/mod.rs 1 1 No change (0%)

Annotation Stats by Crate

Crate Base Branch PR Branch Change
clippy-annotation-reporter 5 5 No change (0%)
datadog-ffe-ffi 1 1 No change (0%)
datadog-ipc 21 21 No change (0%)
datadog-live-debugger 4 6 ⚠️ +2 (+50.0%)
datadog-live-debugger-ffi 10 10 No change (0%)
datadog-profiling-replayer 4 4 No change (0%)
datadog-sidecar 46 58 ⚠️ +12 (+26.1%)
libdd-common 13 13 No change (0%)
libdd-common-ffi 12 12 No change (0%)
libdd-data-pipeline 5 5 No change (0%)
libdd-ddsketch 2 2 No change (0%)
libdd-dogstatsd-client 1 1 No change (0%)
libdd-profiling 13 13 No change (0%)
libdd-remote-config 3 0 ✅ -3 (-100.0%)
libdd-telemetry 20 20 No change (0%)
libdd-tinybytes 4 4 No change (0%)
libdd-trace-normalization 2 2 No change (0%)
libdd-trace-obfuscation 3 3 No change (0%)
libdd-trace-stats 1 1 No change (0%)
libdd-trace-utils 11 13 ⚠️ +2 (+18.2%)
Total 181 194 ⚠️ +13 (+7.2%)

About This Report

This report tracks Clippy allow annotations for specific rules, showing how they've changed in this PR. Decreasing the number of these annotations generally improves code quality.

@ivoanjo ivoanjo changed the title feat(profiling): [PROF-15045] Add setting to omit local root span id from serialized pprof feat(profiling): Add setting to omit local root span id from serialized pprof [PROF-15045] Jun 10, 2026
Comment thread libdd-profiling/src/internal/profile/mod.rs Outdated

@danielsn danielsn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I guess we still need to set the local-root-span as a label to get the endpoint?

@ivoanjo

ivoanjo commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

I guess we still need to set the local-root-span as a label to get the endpoint?

Yes -- this is why the change is only on the serializer; we're currently using the "local root span id" as a key for updating the endpoint later.

In the future, libraries could keep using local root span id as the key, or may use any other key (e.g. can even be a ever-incrementing counter, libdatadog doesn't particularly care) but for now I didn't want to touch those interfaces/APIs.

@dd-octo-sts

dd-octo-sts Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Artifact Size Benchmark Report

aarch64-alpine-linux-musl
Artifact Baseline Commit Change
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.a 83.49 MB 83.49 MB +.01% (+9.42 KB) 🔍
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 7.70 MB 7.70 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 94.58 MB 94.59 MB +0% (+9.38 KB) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.34 MB 10.34 MB +0% (+200 B) 👌
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 24.73 MB 24.73 MB +0% (+2.00 KB) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 86.89 KB 87.33 KB +.50% (+450 B) 🔍
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 179.90 MB 179.94 MB +.02% (+40.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 923.19 MB 923.21 MB +0% (+21.66 KB) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.09 MB 8.09 MB +0% (+512 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 86.89 KB 87.33 KB +.50% (+450 B) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 23.91 MB 23.91 MB +.03% (+8.00 KB) 🔍
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 47.72 MB 47.73 MB +0% (+4.35 KB) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 21.43 MB 21.43 MB +0% (+2.00 KB) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 88.26 KB 88.71 KB +.50% (+454 B) 🔍
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 183.87 MB 183.90 MB +.01% (+32.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 915.95 MB 916.21 MB +.02% (+266.80 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.25 MB 6.25 MB +0% (+512 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 88.26 KB 88.71 KB +.50% (+454 B) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 25.62 MB 25.63 MB +.03% (+8.00 KB) 🔍
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 45.35 MB 45.36 MB +0% (+4.41 KB) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 74.45 MB 74.46 MB +.01% (+8.53 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 8.58 MB 8.58 MB 0% (0 B) 👌
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 89.86 MB 89.87 MB +0% (+8.47 KB) 👌
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 10.43 MB 10.43 MB +0% (+136 B) 👌

@ivoanjo ivoanjo force-pushed the ivoanjo/prof-150465-experiment-omit-root-span-id branch from e35c67d to 49e154d Compare June 11, 2026 08:37
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot merged commit 92c0740 into main Jun 11, 2026
110 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d Bot deleted the ivoanjo/prof-150465-experiment-omit-root-span-id branch June 11, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants