Skip to content

fix(library-config): omit absent process context attributes - #2337

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
PROF-15487-omit-absent-tracer-metadata
Aug 12, 2026
Merged

fix(library-config): omit absent process context attributes#2337
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
mainfrom
PROF-15487-omit-absent-tracer-metadata

Conversation

@morrisonlevi

Copy link
Copy Markdown
Contributor

What does this PR do?

If these items are not set, they should be missing, rather than sent with no value.

Motivation

In PHP, these will not be set at all because they live in the OTel thread context instead of the process context.

Additional Notes

Needed for DataDog/dd-trace-php#4077.

How to test the change?

Tests the same, there just won't be "empty" items and they'll be missing instead.

@morrisonlevi
morrisonlevi requested a review from a team as a code owner August 10, 2026 14:21
@morrisonlevi
morrisonlevi requested review from mabdinur and removed request for a team August 10, 2026 14:21
@pr-commenter

pr-commenter Bot commented Aug 10, 2026

Copy link
Copy Markdown

Benchmarks

Comparison

Candidate

Candidate benchmark details

Baseline

Baseline benchmark details

@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 75.98% (-0.01%)

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

@yannham

yannham commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

The original implementation did drop undefined attributes, but @ivoanjo reverted this decision explicitly, as per this review comment: #1658 (comment), and as hinted at by the presence of the comment. It could be good to double check with him that this is ok.

@dd-octo-sts

dd-octo-sts Bot commented Aug 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 89.19 MB 89.21 MB +.02% (+25.08 KB) 🔍
/aarch64-alpine-linux-musl/lib/libdatadog_profiling.so 8.20 MB 8.20 MB 0% (0 B) 👌
aarch64-unknown-linux-gnu
Artifact Baseline Commit Change
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.06 MB 11.06 MB +0% (+360 B) 👌
/aarch64-unknown-linux-gnu/lib/libdatadog_profiling.a 100.36 MB 100.38 MB +.02% (+24.67 KB) 🔍
libdatadog-x64-windows
Artifact Baseline Commit Change
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.dll 26.63 MB 26.63 MB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.lib 94.56 KB 94.56 KB 0% (0 B) 👌
/libdatadog-x64-windows/debug/dynamic/datadog_profiling_ffi.pdb 191.41 MB 191.46 MB +.02% (+48.00 KB) 🔍
/libdatadog-x64-windows/debug/static/datadog_profiling_ffi.lib 1001.43 MB 1001.83 MB +.03% (+404.59 KB) 🔍
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.dll 8.71 MB 8.71 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.lib 94.56 KB 94.56 KB 0% (0 B) 👌
/libdatadog-x64-windows/release/dynamic/datadog_profiling_ffi.pdb 25.62 MB 25.62 MB 0% (0 B) 👌
/libdatadog-x64-windows/release/static/datadog_profiling_ffi.lib 51.01 MB 51.01 MB 0% (0 B) 👌
libdatadog-x86-windows
Artifact Baseline Commit Change
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.dll 23.22 MB 23.22 MB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.lib 96.04 KB 96.04 KB 0% (0 B) 👌
/libdatadog-x86-windows/debug/dynamic/datadog_profiling_ffi.pdb 196.33 MB 196.38 MB +.02% (+56.00 KB) 🔍
/libdatadog-x86-windows/debug/static/datadog_profiling_ffi.lib 990.81 MB 991.20 MB +.04% (+405.86 KB) 🔍
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.dll 6.73 MB 6.73 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.lib 96.04 KB 96.04 KB 0% (0 B) 👌
/libdatadog-x86-windows/release/dynamic/datadog_profiling_ffi.pdb 27.55 MB 27.55 MB 0% (0 B) 👌
/libdatadog-x86-windows/release/static/datadog_profiling_ffi.lib 48.55 MB 48.55 MB 0% (0 B) 👌
x86_64-alpine-linux-musl
Artifact Baseline Commit Change
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.a 79.46 MB 79.48 MB +.02% (+24.35 KB) 🔍
/x86_64-alpine-linux-musl/lib/libdatadog_profiling.so 9.12 MB 9.13 MB +.04% (+4.00 KB) 🔍
x86_64-unknown-linux-gnu
Artifact Baseline Commit Change
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.a 95.12 MB 95.14 MB +.02% (+23.96 KB) 🔍
/x86_64-unknown-linux-gnu/lib/libdatadog_profiling.so 11.14 MB 11.14 MB +.03% (+4.31 KB) 🔍

@ivoanjo ivoanjo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the ping @morrisonlevi and @yannham . I think for the multi-tenant use-case this change is fine, and for all others, our libraries usually have defaults for most of them so in practice I don't think this empty vs omitted will show up very often there.

Comment on lines +146 to +156
key_value_if_some("container.id", container_id),
]
.into_iter()
.flatten()
.collect();

// `mut` is only needed when `otel-thread-ctx` is enabled.
#[allow(unused_mut)]
let mut extra_attributes = vec![key_value_opt("datadog.process_tags", process_tags)];
let mut extra_attributes: Vec<_> = key_value_if_some("datadog.process_tags", process_tags)
.into_iter()
.collect();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I agree that for a multi-tenant case (like we're doing for PHP), it's kinda weird to have empty service.name/service.instance.id/service.version/deployment.environment.name since those are properties of a given tenant, not for the whole process.

Yet, container.id and datadog.process_tags I think still make sense as being process-wide.

Do you mind if we keep the old key_value_opt for those two, and use the new key_value_if_some only for those that are truly per-tenant?

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.

For container.id, I agree. Sadly process tags are service specific with the svc tags...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👍 I wasn't aware of that, thanks for catching it!

@bwoebi bwoebi Aug 12, 2026

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.

Given that I don't think it makes much sense to have particular behaviour for just this single container.id, I'm now just merging this as is.

@bwoebi

bwoebi commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented Aug 12, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-08-12 13:37:22 UTC ℹ️ Start processing command /merge


2026-08-12 13:37:27 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1h (p90).


2026-08-12 14:26:22 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 3dd8fa1 into main Aug 12, 2026
91 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the PROF-15487-omit-absent-tracer-metadata branch August 12, 2026 14:26
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.

5 participants