Skip to content

fix(otlp): align trace-metrics attributes with the RFC attribute spec - #9685

Open
mabdinur wants to merge 11 commits into
masterfrom
munir/otlp-trace-metrics-fixes
Open

fix(otlp): align trace-metrics attributes with the RFC attribute spec#9685
mabdinur wants to merge 11 commits into
masterfrom
munir/otlp-trace-metrics-fixes

Conversation

@mabdinur

@mabdinur mabdinur commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Aligns traces.span.sdk.metrics.duration with the cross-tracer contract in system-tests#7466.

  • OTLP trace metrics always emit available OTel and datadog.* attributes; trace-metrics semantics-mode plumbing and suppression branches are removed.
  • Known span kinds are canonicalized to SPAN_KIND_*; missing, unknown, and unspecified kinds use SPAN_KIND_INTERNAL.
  • Top-level and known trace-root dimensions use native OTLP booleans; unknown trace-root is omitted.
  • _dd.svc_src in the aggregation key is exported as the string attribute datadog.svc_src and omitted when absent.
  • Runtime ID and array-valued process tags are emitted whenever available.
  • Span-export and instrumentation OTel-semantics behavior is unchanged.

additional_metric_tags and datadog.peer_tags remain unsupported on this path and are separate follow-ups.

Validation

  • Focused Mocha suite: 70 passing
  • Targeted ESLint: passing
  • Full npm run lint: passing
  • Targeted NYC coverage: exporter 100%; transformer 98.7% lines

Fixes several OTLP trace-metrics (traces.span.sdk.metrics.duration)
attribute gaps found in a cross-tracer audit against SEMCON-1093:

- datadog.process_tags now emits one array-valued resource attribute
  (mirroring the legacy v0.6/stats ProcessTags shape) instead of
  flattening each tag into its own datadog.<key> attribute.
- datadog.is_trace_root is now emitted per data point, gated the same
  way as the other datadog.* attributes.
- span.kind is canonicalized to the OTel Span Metrics Connector's
  SPAN_KIND_* uppercase convention instead of being passed through
  lowercase.
- status.code is now a required string attribute
  (STATUS_CODE_OK/STATUS_CODE_ERROR) on every data point, replacing
  the previous OTLP-trace-style int enum that was only set on errors.

additional_metric_tags and peer_tags remain unimplemented on this
path; both are flagged with a one-line TODO pointing at the
corresponding gap (or its absence) in the legacy v0.6/stats exporter.
@mabdinur mabdinur added the AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos label Aug 4, 2026
@dd-octo-sts

dd-octo-sts Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Overall package size

Self size: 7.91 MB
Deduped: 8.58 MB
No deduping: 8.58 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.3.3 | 125.43 kB | 441.68 kB | | opentracing | 0.14.7 | 194.81 kB | 194.81 kB | | dc-polyfill | 0.1.11 | 25.74 kB | 25.74 kB |

🤖 This report was automatically generated by heaviest-objects-in-the-universe

@datadog-official

This comment has been minimized.

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.92%. Comparing base (d70e6a0) to head (c9cbd95).
⚠️ Report is 21 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #9685      +/-   ##
==========================================
- Coverage   98.52%   94.92%   -3.60%     
==========================================
  Files         957      899      -58     
  Lines      135106   130030    -5076     
  Branches    12015    10463    -1552     
==========================================
- Hits       133109   123428    -9681     
- Misses       1997     6602    +4605     
Flag Coverage Δ
aiguard ?
aiguard-integration ?
apm-bucket-0 ?
apm-bucket-1 ?
apm-bucket-2 ?
apm-bucket-3 ?
apm-capabilities-tracing ?
apm-integrations-aerospike ?
apm-integrations-confluentinc-kafka-javascript ?
apm-integrations-couchbase ?
apm-integrations-http ?
apm-integrations-kafkajs ?
apm-integrations-next 59.48% <100.00%> (+0.20%) ⬆️
apm-integrations-prisma ?
appsec 72.08% <100.00%> (-0.01%) ⬇️
appsec-express_fastify_graphql ?
appsec-integration ?
appsec-kafka_ldapjs_lodash ?
appsec-mongodb-core_mongoose_mysql ?
appsec-next 56.88% <100.00%> (+0.32%) ⬆️
appsec-node-serialize_passport_postgres ?
appsec-sourcing_stripe_template 65.13% <100.00%> (+0.12%) ⬆️
debugger 64.37% <100.00%> (+0.09%) ⬆️
instrumentations-bucket-0 51.70% <100.00%> (+0.15%) ⬆️
instrumentations-bucket-1 59.50% <100.00%> (-0.14%) ⬇️
instrumentations-bucket-10 61.15% <100.00%> (-0.29%) ⬇️
instrumentations-bucket-11 61.89% <100.00%> (+10.43%) ⬆️
instrumentations-bucket-12 51.71% <100.00%> (-0.55%) ⬇️
instrumentations-bucket-13 52.48% <100.00%> (+0.90%) ⬆️
instrumentations-bucket-14 51.66% <100.00%> (?)
instrumentations-bucket-2 53.19% <100.00%> (-0.19%) ⬇️
instrumentations-bucket-3 53.52% <100.00%> (-5.18%) ⬇️
instrumentations-bucket-4 58.84% <100.00%> (+6.74%) ⬆️
instrumentations-bucket-5 50.17% <100.00%> (-7.07%) ⬇️
instrumentations-bucket-6 60.59% <100.00%> (+0.30%) ⬆️
instrumentations-bucket-7 58.17% <100.00%> (+0.11%) ⬆️
instrumentations-bucket-8 59.18% <100.00%> (+0.14%) ⬆️
instrumentations-bucket-9 57.50% <100.00%> (-3.49%) ⬇️
instrumentations-instrumentation-couchbase ?
instrumentations-integration-esbuild 34.29% <0.00%> (+0.35%) ⬆️
llmobs-ai_anthropic_bedrock 62.91% <100.00%> (+0.42%) ⬆️
llmobs-bucket-1 61.39% <100.00%> (+0.05%) ⬆️
llmobs-openai 61.88% <100.00%> (+0.04%) ⬆️
llmobs-openai-agents_vertex-ai 59.88% <100.00%> (+0.07%) ⬆️
llmobs-sdk 66.67% <100.00%> (+0.48%) ⬆️
master-coverage 94.92% <100.00%> (?)
openfeature 55.76% <0.00%> (+0.15%) ⬆️
openfeature-unit 53.25% <100.00%> (+0.12%) ⬆️
platform-core_esbuild_instrumentations-misc 41.21% <100.00%> (+0.69%) ⬆️
platform-integration 60.57% <0.00%> (+0.06%) ⬆️
platform-shimmer_unit-guardrails_webpack 38.97% <100.00%> (+0.22%) ⬆️
plugins-bucket-0 56.97% <100.00%> (+0.16%) ⬆️
plugins-bucket-1 54.08% <0.00%> (+0.18%) ⬆️
plugins-bucket-11 61.99% <100.00%> (+0.12%) ⬆️
plugins-bucket-18 61.58% <100.00%> (+0.16%) ⬆️
plugins-bucket-19 59.81% <100.00%> (+0.19%) ⬆️
plugins-bucket-20 61.75% <100.00%> (+0.12%) ⬆️
plugins-bucket-4 58.41% <100.00%> (+0.20%) ⬆️
plugins-bullmq_cassandra_cookie 61.47% <100.00%> (+0.19%) ⬆️
plugins-cookie-parser_crypto_dd-trace-api 56.40% <100.00%> (+0.05%) ⬆️
plugins-fetch_fs_generic-pool 58.31% <100.00%> (+0.06%) ⬆️
plugins-google-cloud-pubsub_grpc_handlebars 64.27% <100.00%> (+0.12%) ⬆️
plugins-hapi_hono_ioredis 59.98% <100.00%> (+0.18%) ⬆️
plugins-jest_knex_langgraph 55.41% <100.00%> (+0.07%) ⬆️
plugins-ldapjs_light-my-request_limitd-client 58.34% <100.00%> (+0.21%) ⬆️
plugins-lodash_mariadb_memcached 57.68% <100.00%> (+<0.01%) ⬆️
plugins-moleculer_mongodb_mongodb-core 61.54% <100.00%> (+0.14%) ⬆️
plugins-mongoose_multer_mysql 59.30% <100.00%> (+0.62%) ⬆️
plugins-mysql2_nats_node-serialize 60.99% <100.00%> (+0.77%) ⬆️
plugins-opensearch_passport-http_pino 59.20% <100.00%> (+0.08%) ⬆️
plugins-postgres_process_pug 58.33% <100.00%> (+0.05%) ⬆️
plugins-redis_router_sequelize 61.63% <100.00%> (+0.14%) ⬆️
plugins-test-and-upstream-rhea_undici_url 61.20% <100.00%> (+0.19%) ⬆️
plugins-valkey_vm_winston 57.74% <100.00%> (+0.11%) ⬆️
plugins-ws 59.34% <100.00%> (+0.19%) ⬆️
profiling 61.64% <100.00%> (+0.13%) ⬆️
serverless-aws-sdk-aws-sdk 55.01% <100.00%> (+0.10%) ⬆️
serverless-aws-sdk-base-inject-field 50.93% <100.00%> (+0.17%) ⬆️
serverless-aws-sdk-bedrockruntime 54.68% <100.00%> (+0.17%) ⬆️
serverless-aws-sdk-client 56.26% <100.00%> (+0.14%) ⬆️
serverless-aws-sdk-dynamodb 55.53% <100.00%> (+0.16%) ⬆️
serverless-aws-sdk-eventbridge 49.58% <100.00%> (+0.22%) ⬆️
serverless-aws-sdk-kinesis 59.15% <100.00%> (+0.23%) ⬆️
serverless-aws-sdk-lambda 57.28% <100.00%> (+0.22%) ⬆️
serverless-aws-sdk-s3 55.62% <100.00%> (+0.15%) ⬆️
serverless-aws-sdk-serverless-peer-service 59.41% <100.00%> (+0.08%) ⬆️
serverless-aws-sdk-sns 59.96% <100.00%> (+0.21%) ⬆️
serverless-aws-sdk-sqs 60.38% <100.00%> (+0.20%) ⬆️
serverless-aws-sdk-stepfunctions 55.45% <100.00%> (+0.16%) ⬆️
serverless-aws-sdk-util 51.47% <100.00%> (+0.16%) ⬆️
serverless-bucket-0 54.16% <0.00%> (+0.18%) ⬆️
serverless-bucket-1 58.93% <100.00%> (+0.06%) ⬆️
test-optimization-cucumber 71.57% <100.00%> (+0.11%) ⬆️
test-optimization-cypress 65.28% <0.00%> (+0.02%) ⬆️
test-optimization-jest 73.02% <100.00%> (-0.03%) ⬇️
test-optimization-mocha 72.61% <100.00%> (+<0.01%) ⬆️
test-optimization-playwright-playwright-atr 60.23% <0.00%> (+0.09%) ⬆️
test-optimization-playwright-playwright-efd 60.37% <0.00%> (+0.09%) ⬆️
test-optimization-playwright-playwright-final-status 60.53% <0.00%> (+0.08%) ⬆️
test-optimization-playwright-playwright-impacted-tests 60.07% <0.00%> (+0.25%) ⬆️
test-optimization-playwright-playwright-reporting 61.24% <0.00%> (-0.03%) ⬇️
test-optimization-playwright-playwright-test-management 61.26% <0.00%> (+0.18%) ⬆️
test-optimization-playwright-playwright-test-span 60.28% <0.00%> (+0.02%) ⬆️
test-optimization-selenium 59.47% <0.00%> (-0.16%) ⬇️
test-optimization-testopt 57.91% <0.00%> (+0.11%) ⬆️
test-optimization-vitest 73.73% <100.00%> (+0.04%) ⬆️
test-optimization-vitest-browser 59.22% <0.00%> (+0.18%) ⬆️
test-optimization-webdriverio 64.92% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

service.name was omitted from OTLP trace-metrics data points whenever
a span's service matched the default/global service, mirroring the
status.code fix earlier in this branch: required attributes must be
unconditional, not skipped as an optimization.
@pr-commenter

pr-commenter Bot commented Aug 4, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-08-06 19:17:03

Comparing candidate commit d5a78d3 in PR branch munir/otlp-trace-metrics-fixes with baseline commit d70e6a0 in branch master.

📊 Benchmarking dashboard

Found 0 performance improvements and 0 performance regressions! Performance is the same for 2328 metrics, 30 unstable metrics.

Explanation

This is an A/B test comparing a candidate commit's performance against that of a baseline commit. Performance changes are noted in the tables below as:

  • 🟩 = significantly better candidate vs. baseline
  • 🟥 = significantly worse candidate vs. baseline

We compute a confidence interval (CI) over the relative difference of means between metrics from the candidate and baseline commits, considering the baseline as the reference.

If the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD), the change is considered significant.

Feel free to reach out to #apm-benchmarking-platform on Slack if you have any questions.

More details about the CI and significant changes

You can imagine this CI as a range of values that is likely to contain the true difference of means between the candidate and baseline commits.

CIs of the difference of means are often centered around 0%, because often changes are not that big:

---------------------------------(------|---^--------)-------------------------------->
                              -0.6%    0%  0.3%     +1.2%
                                 |          |        |
         lower bound of the CI --'          |        |
sample mean (center of the CI) -------------'        |
         upper bound of the CI ----------------------'

As described above, a change is considered significant if the CI is entirely outside the configured SIGNIFICANT_IMPACT_THRESHOLD (or the deprecated UNCONFIDENCE_THRESHOLD).

For instance, for an execution time metric, this confidence interval indicates a significantly worse performance:

----------------------------------------|---------|---(---------^---------)---------->
                                       0%        1%  1.3%      2.2%      3.1%
                                                  |   |         |         |
       significant impact threshold --------------'   |         |         |
                      lower bound of CI --------------'         |         |
       sample mean (center of the CI) --------------------------'         |
                      upper bound of CI ----------------------------------'

Unstable benchmarks

These benchmarks have a confidence interval too wide to call a change; treat them as noise rather than signal.

scenario:appsec-appsec-enabled-24

  • unstable execution_time [-213.783ms; +215.850ms] or [-8.000%; +8.077%]

scenario:appsec-appsec-enabled-26

  • unstable execution_time [-234.049ms; +230.339ms] or [-9.159%; +9.014%]

scenario:appsec-appsec-enabled-with-attacks-24

  • unstable execution_time [-162494.101µs; +163832.034µs] or [-5.246%; +5.289%]

scenario:appsec-appsec-enabled-with-attacks-26

  • unstable execution_time [-191.798ms; +185.312ms] or [-6.580%; +6.357%]

scenario:appsec-control-20

  • unstable execution_time [-116.230ms; +128.688ms] or [-7.061%; +7.818%]

scenario:appsec-control-24

  • unstable execution_time [-116196.045µs; +116053.479µs] or [-9.303%; +9.292%]

scenario:appsec-control-26

  • unstable execution_time [-126.749ms; +121.696ms] or [-10.183%; +9.777%]

scenario:appsec-iast-no-vulnerability-control-20

  • unstable execution_time [-18.045ms; +13.793ms] or [-6.928%; +5.296%]

scenario:appsec-iast-with-vulnerability-iast-enabled-always-active-20

  • unstable cpu_usage_percentage [-5.691%; +4.596%]
  • unstable execution_time [-32.405ms; +41.060ms] or [-5.832%; +7.390%]

scenario:appsec-iast-with-vulnerability-iast-enabled-default-config-20

  • unstable execution_time [-25.891ms; +33.183ms] or [-4.710%; +6.037%]

scenario:debugger-line-probe-with-snapshot-default-26

  • unstable cpu_user_time [-3.559s; +0.492s] or [-34.477%; +4.764%]
  • unstable execution_time [-3.581s; +0.488s] or [-32.354%; +4.413%]
  • unstable instructions [-32.0G instructions; +4.3G instructions] or [-36.990%; +4.981%]
  • unstable throughput [-99.654op/s; +700.341op/s] or [-3.246%; +22.813%]

scenario:debugger-line-probe-without-snapshot-26

  • unstable cpu_user_time [-2305.029ms; +755.866ms] or [-24.218%; +7.941%]
  • unstable execution_time [-2308.369ms; +766.966ms] or [-22.521%; +7.483%]
  • unstable instructions [-20.6G instructions; +6.6G instructions] or [-25.903%; +8.327%]
  • unstable throughput [-155.976op/s; +455.886op/s] or [-4.820%; +14.089%]

scenario:dogstatsd-with-tags-20

  • unstable cpu_user_time [-315.669ms; +332.518ms] or [-6.450%; +6.794%]
  • unstable execution_time [-316.279ms; +329.588ms] or [-6.368%; +6.636%]
  • unstable throughput [-117045.418op/s; +109743.211op/s] or [-6.928%; +6.496%]

scenario:plugin-graphql-long-with-depth-and-collapse-off-20

  • unstable max_rss_usage [-16.563MB; +27.625MB] or [-4.246%; +7.082%]

scenario:plugin-graphql-long-with-depth-off-26

  • unstable max_rss_usage [-2.413MB; +23.299MB] or [-1.103%; +10.650%]

scenario:plugin-graphql-long-with-depth-on-max-20

  • unstable cpu_user_time [-591.556ms; +584.840ms] or [-5.125%; +5.067%]
  • unstable execution_time [-601.902ms; +608.615ms] or [-5.108%; +5.165%]
  • unstable throughput [-3.547op/s; +3.537op/s] or [-5.195%; +5.181%]

scenario:plugin-mongodb-core-deep-aggregate-26

  • unstable execution_time [-117.240ms; +159.295ms] or [-4.320%; +5.870%]

scenario:plugin-pg-service-26

  • unstable cpu_user_time [-29.572ms; +59.487ms] or [-3.371%; +6.782%]
  • unstable execution_time [-27.779ms; +60.649ms] or [-3.150%; +6.877%]

@mabdinur
mabdinur marked this pull request as ready for review August 5, 2026 20:14
@mabdinur
mabdinur requested a review from a team as a code owner August 5, 2026 20:14
@mabdinur
mabdinur requested review from BridgeAR and removed request for a team August 5, 2026 20:14

@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: b9775eee23

ℹ️ 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 packages/dd-trace/src/span_stats.js Outdated
Comment thread packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js Outdated

@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: 85f040093a

ℹ️ 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 packages/dd-trace/src/span_stats.js Outdated

@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: 3065873246

ℹ️ 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 packages/dd-trace/src/opentelemetry/metrics/otlp_span_stats_transformer.js Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos semver-patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant