Skip to content

fix(otlp): emit otel.scope.name and otel.scope.version span meta - #2099

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 13 commits into
mainfrom
jszwedko/otlp-traces-scope-meta
Jul 14, 2026
Merged

fix(otlp): emit otel.scope.name and otel.scope.version span meta#2099
gh-worker-dd-mergequeue-cf854d[bot] merged 13 commits into
mainfrom
jszwedko/otlp-traces-scope-meta

Conversation

@jszwedko

@jszwedko jszwedko commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

ADP was emitting only the deprecated otel.library.* span metadata, omitting otel.scope.name / otel.scope.version that the Datadog Agent started emitting in 7.82.0. Naively adding the keys unconditionally breaks regular MR CI (which validates against the pinned 7.81.0 baseline that doesn't emit them yet) while fixing nightly CI (which validates against the dev Agent that does).

Uses the Agent version gate from PR #2106 (datadog-agent-commons::agent_version::meets) to emit the keys only when the bundled Agent version is 7.82.0+, keeping both CI contexts green against their respective baselines.

Test plan

  • Existing OTLP trace transform tests pass (8/8)
  • New unit test test_otel_span_to_dd_span_scope_name_version_meta verifies both otel.library.* (always) and otel.scope.* (when version unknown → defaults to latest) are emitted
  • Nightly correctness pipeline validates the gate end-to-end (5 otlp-traces tests currently failing)

🤖 Generated with Claude Code

@dd-octo-sts dd-octo-sts Bot added the area/components Sources, transforms, and destinations. label Jul 13, 2026
@jszwedko jszwedko changed the title fix(otlp-traces): emit otel.scope.name and otel.scope.version span meta fix(otlp): emit otel.scope.name and otel.scope.version span meta Jul 13, 2026
@jszwedko
jszwedko marked this pull request as ready for review July 13, 2026 15:26
@jszwedko
jszwedko requested a review from a team as a code owner July 13, 2026 15:26

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

Copy link
Copy Markdown

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: 75e8a51a1e

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread lib/saluki-components/src/common/otlp/traces/transform.rs Outdated
@pr-commenter

pr-commenter Bot commented Jul 13, 2026

Copy link
Copy Markdown

Binary Size Analysis (Agent Data Plane)

Baseline: 6c17562 · Comparison: 200a5ff · diff
Analysis Configuration: stripped binaries · Pass/Fail Threshold: +5%
Sizes: 41.57 MiB (baseline) vs 41.58 MiB (comparison)
Size Change: +15.98 KiB (+0.04%)

✅ Binary size difference within threshold

Changes by Module
Module File Size Symbols
anon.52c3a273e91bfd564a24d5cb7ee806e3.1001.llvm.15135934386063498543 +17.25 KiB 1
anon.5f040b9cf0e85edcd98481965dce5e0f.55.llvm.9953283433741861364 -17.24 KiB 1
anon.85625ef020824a581138249b4bcd138f.2.llvm.15854790319231473015 +9.81 KiB 1
anon.e02c4dd8ff522f1fe4057746c120546c.61.llvm.14310455044692613470 -9.81 KiB 1
serde_core +8.00 KiB 931
anon.0a98b3590f538e02e15153f12102fa90.2.llvm.17224994202189465113 +7.16 KiB 1
anon.776412e40142ec6aebcfae540905f9b2.970.llvm.3147434244572592408 -7.15 KiB 1
anon.061ad657bd5d2f931b857fc07cfe4e39.2.llvm.11063963451910516310 +4.38 KiB 1
anon.08d6aa4a5b49601fe6872e18f7d05cdc.547.llvm.5257818858558998185 -4.38 KiB 1
std +3.89 KiB 281
datadog_agent_commons::ipc::client +3.52 KiB 30
anon.dae1f8d3e2fd29cf80b1accc5cb6542e.215.llvm.11303867197650265754 +3.37 KiB 1
anon.7b1f3bc0f707c4b3c51155b8c4fa2d7c.215.llvm.5193126962255660412 -3.37 KiB 1
anon.b4f779bdb511619f62c8ac598cbf7a0c.424.llvm.13569147439722624680 -3.20 KiB 1
anon.8e2a8c1164ef4c1d7f6f0c904ac07035.258.llvm.2350770176468815035 +3.02 KiB 1
saluki_components::encoders::datadog -2.79 KiB 444
anyhow -2.72 KiB 1191
async_compression -2.40 KiB 22
datadog_protos::agent_include::datadog +2.40 KiB 80
anon.d62ce1e5b4442fd6d2640366c1f174a1.652.llvm.1446316904667073693 -2.33 KiB 1
Detailed Symbol Changes
    FILE SIZE        VM SIZE    
 --------------  -------------- 
  [NEW] +56.3Ki  [NEW] +56.2Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h8b7f8c5d97ba6139
  [NEW] +44.0Ki  [NEW] +43.9Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::h0fb925ad706e10ff
  [NEW] +38.5Ki  [NEW] +38.3Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::h95f34135b15b6453
  [NEW] +30.6Ki  [NEW] +30.4Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::ha8992029ccc3e467
  [NEW] +30.6Ki  [NEW] +30.4Ki    _<saluki_components::transforms::apm_stats::ApmStats as saluki_core::components::transforms::Transform>::run::_{{closure}}::h06b9e5ed272fda3d
  [NEW] +30.5Ki  [NEW] +30.3Ki    saluki_components::sources::otlp::metrics::translator::OtlpMetricsTranslator::translate_metrics::h3fe1589e3c4d638d
  [NEW] +30.0Ki  [NEW] +29.9Ki    agent_data_plane::cli::dogstatsd::handle_dogstatsd_command::_{{closure}}::h9a00c8b722d068b2
  [NEW] +28.1Ki  [NEW] +27.9Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::h29bc4bf05508540a
  [NEW] +27.5Ki  [NEW] +27.2Ki    _<saluki_components::sources::dogstatsd::_::<impl serde_core::de::Deserialize for saluki_components::sources::dogstatsd::DogStatsDConfiguration>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::h0f7ba74159d95446
  [NEW] +27.0Ki  [NEW] +26.8Ki    saluki_components::sources::dogstatsd::drive_stream::_{{closure}}::hd69617ec6298c4df
  +0.1% +15.9Ki  +0.1% +6.42Ki    [33805 Others]
  [DEL] -27.1Ki  [DEL] -26.9Ki    saluki_components::sources::dogstatsd::drive_stream::_{{closure}}::h32d551929f6fa3b6
  [DEL] -27.4Ki  [DEL] -27.1Ki    _<saluki_components::sources::dogstatsd::_::<impl serde_core::de::Deserialize for saluki_components::sources::dogstatsd::DogStatsDConfiguration>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map::h507eb7431e29ea07
  [DEL] -28.1Ki  [DEL] -27.9Ki    agent_data_plane::cli::run::create_topology::_{{closure}}::hc7701488cdaf9708
  [DEL] -30.0Ki  [DEL] -29.9Ki    agent_data_plane::cli::dogstatsd::handle_dogstatsd_command::_{{closure}}::hd837c28d99cadabd
  [DEL] -30.5Ki  [DEL] -30.4Ki    saluki_components::sources::otlp::metrics::translator::OtlpMetricsTranslator::translate_metrics::hab9dc9f6904919be
  [DEL] -30.6Ki  [DEL] -30.4Ki    _<saluki_components::transforms::apm_stats::ApmStats as saluki_core::components::transforms::Transform>::run::_{{closure}}::h9fdc414799192cda
  [DEL] -30.6Ki  [DEL] -30.4Ki    _<saluki_components::transforms::aggregate::Aggregate as saluki_core::components::transforms::Transform>::run::_{{closure}}::hc9062a2a4246a7d4
  [DEL] -38.4Ki  [DEL] -38.2Ki    _<saluki_components::forwarders::otlp::OtlpForwarder as saluki_core::components::forwarders::Forwarder>::run::_{{closure}}::hadf9b85f315763cf
  [DEL] -44.0Ki  [DEL] -43.8Ki    agent_data_plane::cli::run::handle_run_command::_{{closure}}::h940827480ed79a43
  [DEL] -56.3Ki  [DEL] -56.2Ki    saluki_components::common::datadog::io::run_endpoint_io_loop::_{{closure}}::h49375b69dcfb6f02
  +0.0% +16.0Ki  +0.0% +6.51Ki    TOTAL

@datadog-datadog-prod-us1

This comment has been minimized.

@pr-commenter

pr-commenter Bot commented Jul 13, 2026

Copy link
Copy Markdown

Regression Detector (Agent Data Plane)

Run ID: f285d874-952a-4463-bef1-3297c202d51d
Baseline: 6c175628 · Comparison: 200a5ff1 · diff

Optimization Goals: ✅ No significant changes detected

Fine details of change detection per experiment (5)

Experiments configured erratic: true are tagged (ignored) and skipped when determining which experiments regressed or improved. Experiments which are detected as erratic at runtime are tagged (erratic) to flag that the run's sample dispersion was high, but their regression / improvement signal still counts.

experiment goal Δ mean % links
quality_gates_rss_dsd_ultraheavy memory ⚪ +0.46 metrics profiles logs
quality_gates_rss_dsd_heavy memory ⚪ +0.23 metrics profiles logs
quality_gates_rss_idle memory ⚪ -0.13 metrics profiles logs
quality_gates_rss_dsd_medium memory ⚪ -0.19 metrics profiles logs
quality_gates_rss_dsd_low memory ⚪ -0.49 metrics profiles logs
Bounds Checks: ✅ Passed (5)
experiment check replicates observed links
quality_gates_rss_dsd_heavy memory_usage 10/10 ✅ 132 MiB ≤ 140 MiB metrics profiles logs
quality_gates_rss_dsd_low memory_usage 10/10 ✅ 42.8 MiB ≤ 50 MiB metrics profiles logs
quality_gates_rss_dsd_medium memory_usage 10/10 ✅ 65 MiB ≤ 75 MiB metrics profiles logs
quality_gates_rss_dsd_ultraheavy memory_usage 10/10 ✅ 192 MiB ≤ 200 MiB metrics profiles logs
quality_gates_rss_idle memory_usage 10/10 ✅ 29 MiB ≤ 40 MiB metrics profiles logs
Explanation

A change is flagged as a regression when |Δ mean %| > 5.00% in the regressing direction for its optimization goal AND SMP marks the experiment as a regression (is_regression: true). Improvements use the matching criteria for the improving direction. Experiments configured erratic: true (tagged (ignored)) are skipped outright; experiments detected as erratic at runtime (tagged (erratic)) still count, since that flag describes sample dispersion rather than directional certainty. The Δ mean % cell is colored accordingly: 🟢 = improvement, 🔴 = regression, ⚪ = neutral. Reduction in CPU or memory is an improvement; reduction in ingress throughput is a regression.

jszwedko and others added 2 commits July 13, 2026 13:00
…ted behavior

Adds a minimal AgentVersion parser to datadog-agent-commons and plumbs
DD_AGENT_VERSION from the CI build through the Docker image so ADP can read it
at runtime. Components call agent_version::meets(major, minor, patch) to
conditionally emit behavior matching the bundled Agent version.

Details:
- DD_AGENT_VERSION is set to the release tag (e.g. "7.81.0-full") for regular
  CI builds and to "nightly" for nightly CI builds using the dev Agent.
- When DD_AGENT_VERSION is unset (standalone / local dev), version gates
  default to the most recent behavior.
- Development builds (nightly, devel, master) always satisfy every gate.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
ADP was emitting only the deprecated otel.library.* span metadata, omitting
the current otel.scope.* keys that the Datadog Agent started emitting between
7.81.0 and 7.83.0-devel. Uses the Agent version gate introduced in
datadog-agent-commons to match the behavior of whichever Agent version ADP is
bundled with, keeping both regular CI (pinned release) and nightly CI (dev
Agent) green against their respective baselines.

TODO: confirm exact public Agent release and update the threshold (currently
7.82.0) in transform.rs.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@jszwedko
jszwedko force-pushed the jszwedko/otlp-traces-scope-meta branch from 5374f65 to 2a466a8 Compare July 13, 2026 20:04
@jszwedko
jszwedko changed the base branch from main to jszwedko/agent-version July 13, 2026 20:07
jszwedko and others added 5 commits July 13, 2026 13:31
…of runtime

Addresses review feedback: rather than reading DD_AGENT_VERSION from the process
environment at runtime, bake it into the binary at compile time via build.rs
(mirroring how saluki-metadata embeds APP_* metadata).

- build.rs reads DD_AGENT_VERSION and emits parsed version constants.
- agent_version::meets() / version() now use those compile-time constants; the
  OnceLock and std::env::var runtime read are removed.
- The ADP image build (Dockerfile.agent-data-plane + .gitlab/build.yml) passes
  DD_AGENT_VERSION into the cargo build: "nightly" for nightly CI, the pinned
  public release version otherwise.
- Removes the now-unnecessary runtime env injection from the converged Agent
  image (Dockerfile.datadog-agent) and .gitlab/e2e.yml.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…cript

Replace the double-substitution idiom with a plain if/else for readability.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Adds version_string() to datadog-agent-commons::agent_version to expose the raw
DD_AGENT_VERSION baked-in string, then surfaces it as "Built Against Agent Version"
in ADP's GetStatusDetails response so it appears in Core Agent's `agent status`.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…docs

Replace Latin abbreviations and misspelling flagged by the Vale prose linter:
- "e.g." → "for example"
- "i.e." → "that is"
- "parseable" → "parsable" → reworded to avoid the ambiguity

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…a-plane

The prior commit's lockfile inadvertently reverted agent-data-plane from 1.4.0 to
1.3.0. Regenerate so the only change vs. the base is the added
datadog-agent-commons dependency for saluki-components.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 13, 2026 20:57
@dd-octo-sts dd-octo-sts Bot removed the area/ci CI/CD, automated testing, etc. label Jul 13, 2026
Copilot AI review requested due to automatic review settings July 13, 2026 21:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

Comment thread lib/saluki-components/src/common/otlp/traces/transform.rs Outdated
Comment thread lib/saluki-components/src/common/otlp/traces/transform.rs Outdated
jszwedko and others added 3 commits July 13, 2026 14:11
Since DD_AGENT_VERSION is baked in at build time, version() / meets() can be
const fn — callers can evaluate gates in a const context so the compiler
resolves the outcome statically and eliminates the dead branch.

AgentVersion::meets uses a manual lexicographic comparison of the three
components since tuple PartialOrd is not usable in const fn.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Now that agent_version::meets is a const fn, hoist the gate into a module-level
const (EMIT_OTEL_SCOPE_META) computed once at compile time, instead of calling
the gate twice per span on the transform hot path. Addresses Copilot review
feedback on duplication and hot-path cost.

Also make the unit test key its expectation off EMIT_OTEL_SCOPE_META and assert
the emitted values, so it stays correct regardless of the DD_AGENT_VERSION the
crate was built with.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 13, 2026 21:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

Comment thread lib/saluki-components/src/common/otlp/traces/transform.rs Outdated
…pe keys

Build the otel.library.*/otel.scope.* value once per field and clone it (cheap
for MetaString-backed values) instead of converting the source string twice.
Addresses Copilot review feedback on hot-path allocations.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 13, 2026 21:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

@jszwedko
jszwedko requested a review from tobz July 13, 2026 21:29
The constant was wedged into the middle of the *_META_KEY string-constant block,
splitting it awkwardly. Move it below DD_NAMESPACED_TO_APM_CONVENTIONS into its
own labeled section for version-gated behavior toggles, where future overrides
can live.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 13, 2026 21:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

gh-worker-dd-mergequeue-cf854d Bot pushed a commit that referenced this pull request Jul 14, 2026
…or (#2106)

## Summary

Introduces a minimal Agent version gate in `datadog-agent-commons` so ADP can conditionally reproduce version-specific Agent behavior matching the Agent it is bundled with. This is the infrastructure PR; the first consumer is in the stacked OTLP PR.

`DD_AGENT_VERSION` is baked into the converged image at build time (release tag for regular CI, `"nightly"` for nightly CI) and read by ADP at startup via `agent_version::version()`. Any component calls `agent_version::meets(major, minor, patch)` to gate behavior. When the variable is unset (standalone / local dev), gates default to the most recent behavior.

See example usage in the stacked PR: #2099

## Test plan

- [x] 7 unit tests for `AgentVersion::parse` / `meets` covering release tags, dev builds, bare dev markers, and edge cases

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: jesse.szwedko <jesse.szwedko@datadoghq.com>
Base automatically changed from jszwedko/agent-version to main July 14, 2026 14:09

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: PASS

More details

The PR correctly adds version-gated support for otel.scope.{name,version} span metadata, emitted only when the bundled Agent is 7.82.0+ (resolved at compile time). The implementation maintains backward compatibility by always emitting deprecated otel.library.* keys. Build-time constants, proper empty-scope checks, and test coverage that mirrors the gate logic ensure both CI contexts (7.81.0 baseline and nightly) pass as intended, with no runtime regressions.

Was this helpful? React 👍 or 👎

📊 Validated against 12 scenarios · Open Bits AI session

🤖 Datadog Autotest · Commit 200a5ff · What is Autotest? · Any feedback? Reach out in #autotest

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit a2264ee into main Jul 14, 2026
84 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the jszwedko/otlp-traces-scope-meta branch July 14, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/components Sources, transforms, and destinations. mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants