Skip to content

feat(agentless): add compute_stats, trace_root, and top_level tags#7716

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomasterfrom
bengl/agentless-tags
Mar 9, 2026
Merged

feat(agentless): add compute_stats, trace_root, and top_level tags#7716
gh-worker-dd-mergequeue-cf854d[bot] merged 1 commit intomasterfrom
bengl/agentless-tags

Conversation

@bengl
Copy link
Copy Markdown
Collaborator

@bengl bengl commented Mar 9, 2026

Summary

  • Enriches agentless JSON-encoded spans with metadata required by the intake to compute APM stats server-side
  • Adds _dd.compute_stats meta tag on the first span of each trace
  • Adds _trace_root metric on root spans (parent_id == 0)
  • Adds _top_level metric on top-level spans (where _dd.top_level is set)

Equivalent to DataDog/dd-trace-py#16790 for the JS tracer.
Continuation of #7632.

Test plan

  • Unit tests for _dd.compute_stats on first span only (single and multi-encode calls)
  • Unit tests for _trace_root on root vs child spans
  • Unit tests for _top_level on top-level vs non-top-level spans
  • Unit test for falsy _dd.top_level (value 0) not triggering _top_level
  • Unit test for malformed first span falling through to next span for _dd.compute_stats
  • All 21 tests passing

🤖 Generated with Claude Code

@bengl bengl requested review from a team as code owners March 9, 2026 16:55
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 9, 2026

Overall package size

Self size: 4.94 MB
Deduped: 5.78 MB
No deduping: 5.78 MB

Dependency sizes | name | version | self size | total size | |------|---------|-----------|------------| | import-in-the-middle | 3.0.0 | 81.15 kB | 815.98 kB | | dc-polyfill | 0.1.10 | 26.73 kB | 26.73 kB |

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

@bengl bengl added AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos semver-patch labels Mar 9, 2026
… agentless encoder

Enriches agentless JSON-encoded spans with metadata required by the
intake to compute APM stats server-side:
- _dd.compute_stats on the first span of each trace
- _trace_root on root spans (parent_id == 0)
- _top_level on top-level spans

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@bengl bengl force-pushed the bengl/agentless-tags branch from 1c20f95 to 470470c Compare March 9, 2026 16:58
Copy link
Copy Markdown
Member

@brettlangdon brettlangdon left a comment

Choose a reason for hiding this comment

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

packages/dd-trace/src/encode/agentless-json.js lgtm and matches what Python is doing

@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Mar 9, 2026

Benchmarks

Benchmark execution time: 2026-03-09 17:11:19

Comparing candidate commit 470470c in PR branch bengl/agentless-tags with baseline commit 87c2ec0 in branch master.

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

scenario:appsec-iast-with-vulnerability-control-22

  • 🟩 execution_time [-57.370ms; -46.402ms] or [-6.787%; -5.490%]

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.36%. Comparing base (87c2ec0) to head (470470c).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7716   +/-   ##
=======================================
  Coverage   80.35%   80.36%           
=======================================
  Files         741      741           
  Lines       32004    32011    +7     
=======================================
+ Hits        25718    25725    +7     
  Misses       6286     6286           
Flag Coverage Δ
aiguard-macos 39.01% <ø> (-0.10%) ⬇️
aiguard-ubuntu 39.13% <ø> (-0.10%) ⬇️
aiguard-windows 38.85% <ø> (-0.10%) ⬇️
apm-capabilities-tracing-macos 48.79% <100.00%> (+0.01%) ⬆️
apm-capabilities-tracing-ubuntu 48.83% <100.00%> (+0.01%) ⬆️
apm-capabilities-tracing-windows 48.56% <100.00%> (+0.06%) ⬆️
apm-integrations-child-process 38.56% <ø> (-0.10%) ⬇️
apm-integrations-couchbase-18 37.50% <ø> (+0.07%) ⬆️
apm-integrations-couchbase-eol 37.94% <ø> (-0.10%) ⬇️
apm-integrations-oracledb 37.78% <ø> (-0.10%) ⬇️
appsec-express 55.30% <ø> (-0.07%) ⬇️
appsec-fastify 51.63% <ø> (-0.07%) ⬇️
appsec-graphql 51.81% <ø> (-0.07%) ⬇️
appsec-kafka 44.33% <ø> (-0.08%) ⬇️
appsec-ldapjs 44.03% <ø> (-0.08%) ⬇️
appsec-lodash 43.68% <ø> (-0.08%) ⬇️
appsec-macos 58.30% <ø> (-0.07%) ⬇️
appsec-mongodb-core 48.83% <ø> (-0.07%) ⬇️
appsec-mongoose 49.49% <ø> (-0.07%) ⬇️
appsec-mysql 50.87% <ø> (-0.07%) ⬇️
appsec-node-serialize 43.20% <ø> (-0.08%) ⬇️
appsec-passport 47.63% <ø> (-0.09%) ⬇️
appsec-postgres 50.61% <ø> (-0.09%) ⬇️
appsec-sourcing 42.61% <ø> (-0.08%) ⬇️
appsec-template 43.37% <ø> (-0.08%) ⬇️
appsec-ubuntu 58.37% <ø> (-0.07%) ⬇️
appsec-windows 58.13% <ø> (-0.07%) ⬇️
instrumentations-instrumentation-bluebird 32.39% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-body-parser 40.50% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-child_process 37.87% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-cookie-parser 34.37% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express 34.69% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.50% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-express-session 40.14% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-fs 32.00% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-generic-pool 29.91% <ø> (ø)
instrumentations-instrumentation-http 39.86% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-knex 32.39% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mongoose 33.52% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-multer 40.25% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-mysql2 38.34% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-passport 44.01% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-http 43.69% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-passport-local 44.22% <ø> (-0.09%) ⬇️
instrumentations-instrumentation-pg 37.77% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise 32.32% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-promise-js 32.33% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-q 32.37% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-url 32.29% <ø> (-0.10%) ⬇️
instrumentations-instrumentation-when 32.34% <ø> (-0.10%) ⬇️
llmobs-ai 42.34% <ø> (-0.10%) ⬇️
llmobs-anthropic 40.31% <ø> (-0.09%) ⬇️
llmobs-bedrock 39.27% <ø> (-0.08%) ⬇️
llmobs-google-genai 39.84% <ø> (-0.09%) ⬇️
llmobs-langchain 40.07% <ø> (-0.08%) ⬇️
llmobs-openai 44.06% <ø> (-0.09%) ⬇️
llmobs-vertex-ai 40.24% <ø> (+0.04%) ⬆️
platform-core 31.53% <ø> (ø)
platform-esbuild 34.48% <ø> (ø)
platform-instrumentations-misc 48.40% <ø> (ø)
platform-shimmer 37.63% <ø> (ø)
platform-unit-guardrails 32.95% <ø> (ø)
plugins-azure-event-hubs 25.83% <ø> (ø)
plugins-azure-service-bus 25.19% <ø> (ø)
plugins-bullmq 44.14% <ø> (-0.10%) ⬇️
plugins-cassandra 37.81% <ø> (-0.10%) ⬇️
plugins-cookie 26.89% <ø> (ø)
plugins-cookie-parser 26.67% <ø> (ø)
plugins-crypto 26.79% <ø> (ø)
plugins-dd-trace-api 38.39% <ø> (-0.10%) ⬇️
plugins-express-mongo-sanitize 26.82% <ø> (ø)
plugins-express-session 26.63% <ø> (ø)
plugins-fastify 42.23% <ø> (-0.09%) ⬇️
plugins-fetch 38.38% <ø> (-0.10%) ⬇️
plugins-fs 38.67% <ø> (-0.10%) ⬇️
plugins-generic-pool 25.87% <ø> (ø)
plugins-google-cloud-pubsub 45.37% <ø> (-0.09%) ⬇️
plugins-grpc 40.94% <ø> (-0.09%) ⬇️
plugins-handlebars 26.86% <ø> (ø)
plugins-hapi 40.28% <ø> (+0.04%) ⬆️
plugins-hono 40.40% <ø> (-0.10%) ⬇️
plugins-ioredis 38.47% <ø> (-0.10%) ⬇️
plugins-knex 26.50% <ø> (ø)
plugins-ldapjs 24.36% <ø> (ø)
plugins-light-my-request 26.23% <ø> (ø)
plugins-limitd-client 32.67% <ø> (-0.10%) ⬇️
plugins-lodash 25.96% <ø> (ø)
plugins-mariadb 39.53% <ø> (-0.10%) ⬇️
plugins-memcached 38.19% <ø> (-0.10%) ⬇️
plugins-microgateway-core 39.26% <ø> (-0.10%) ⬇️
plugins-moleculer 40.54% <ø> (-0.10%) ⬇️
plugins-mongodb 39.21% <ø> (-0.10%) ⬇️
plugins-mongodb-core 39.05% <ø> (-0.10%) ⬇️
plugins-mongoose 38.90% <ø> (-0.10%) ⬇️
plugins-multer 26.63% <ø> (ø)
plugins-mysql 39.18% <ø> (-0.13%) ⬇️
plugins-mysql2 39.31% <ø> (-0.10%) ⬇️
plugins-node-serialize 26.93% <ø> (ø)
plugins-opensearch 37.65% <ø> (-0.10%) ⬇️
plugins-passport-http 26.68% <ø> (ø)
plugins-postgres 35.75% <ø> (-0.09%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 26.89% <ø> (ø)
plugins-redis 38.94% <ø> (-0.10%) ⬇️
plugins-router 43.09% <ø> (+0.04%) ⬆️
plugins-sequelize 25.47% <ø> (ø)
plugins-test-and-upstream-amqp10 38.51% <ø> (+0.04%) ⬆️
plugins-test-and-upstream-amqplib 43.83% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.04% <ø> (-0.09%) ⬇️
plugins-test-and-upstream-avsc 38.73% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-bunyan 33.94% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-connect 40.79% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-graphql 40.17% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-koa 40.38% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-protobufjs 38.95% <ø> (-0.10%) ⬇️
plugins-test-and-upstream-rhea 44.00% <ø> (-0.13%) ⬇️
plugins-undici 39.15% <ø> (-0.09%) ⬇️
plugins-url 26.79% <ø> (ø)
plugins-valkey 38.14% <ø> (-0.10%) ⬇️
plugins-vm 26.79% <ø> (ø)
plugins-winston 34.13% <ø> (-0.10%) ⬇️
plugins-ws 41.90% <ø> (-0.10%) ⬇️
profiling-macos 39.84% <ø> (-0.10%) ⬇️
profiling-ubuntu 39.97% <ø> (-0.10%) ⬇️
profiling-windows 41.16% <ø> (-0.10%) ⬇️
serverless-azure-functions-client 25.54% <ø> (ø)
serverless-azure-functions-eventhubs 25.54% <ø> (ø)
serverless-azure-functions-servicebus 25.54% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

@bengl
Copy link
Copy Markdown
Collaborator Author

bengl commented Mar 9, 2026

/remove

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Mar 9, 2026

View all feedbacks in Devflow UI.

2026-03-09 17:50:57 UTC ℹ️ Start processing command /remove


2026-03-09 17:51:00 UTC ℹ️ Devflow: /remove

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit f89ed61 into master Mar 9, 2026
790 of 791 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the bengl/agentless-tags branch March 9, 2026 18:15
dd-octo-sts bot pushed a commit that referenced this pull request Mar 10, 2026
… agentless encoder (#7716)

feat(agentless): add compute_stats, trace_root, and top_level tags to agentless encoder

Enriches agentless JSON-encoded spans with metadata required by the
intake to compute APM stats server-side:
- _dd.compute_stats on the first span of each trace
- _trace_root on root spans (parent_id == 0)
- _top_level on top-level spans

Co-Authored-By: Claude Opus 4.6 <[email protected]>

Co-authored-by: bryan.english <[email protected]>
@dd-octo-sts dd-octo-sts bot mentioned this pull request Mar 10, 2026
juan-fernandez pushed a commit that referenced this pull request Mar 10, 2026
… agentless encoder (#7716)

feat(agentless): add compute_stats, trace_root, and top_level tags to agentless encoder

Enriches agentless JSON-encoded spans with metadata required by the
intake to compute APM stats server-side:
- _dd.compute_stats on the first span of each trace
- _trace_root on root spans (parent_id == 0)
- _top_level on top-level spans

Co-Authored-By: Claude Opus 4.6 <[email protected]>

Co-authored-by: bryan.english <[email protected]>
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.

3 participants