Skip to content

feat(process-tags): Propagate Service Naming Context via Process Tags#7762

Merged
pabloerhard merged 8 commits intomasterfrom
pabloerhard/process-tags
Mar 16, 2026
Merged

feat(process-tags): Propagate Service Naming Context via Process Tags#7762
pabloerhard merged 8 commits intomasterfrom
pabloerhard/process-tags

Conversation

@pabloerhard
Copy link
Contributor

What does this PR do?

This PR adds configuration dependent process tags, specifically svc.auto:<default_service_name> and svc.user.

Whenever a user sets the service name, we need to set a process tag indicating that. In this case, svc.user would be set to true. Whenever service name is inferred by the tracer, we should set svc.auto:<default_service_name>, with <default_service_name> replaced by the inferred service name.

Motivation

Additional Notes

Some modifications were required to add configuration dependent process tags to the processTags object, since it was originally a singleton that initialized itself at require time, which happened before config was built.

@pabloerhard pabloerhard requested review from a team as code owners March 12, 2026 15:15
@pabloerhard pabloerhard requested review from BridgeAR and removed request for a team March 12, 2026 15:15
@github-actions
Copy link
Contributor

github-actions bot commented Mar 12, 2026

Overall package size

Self size: 4.96 MB
Deduped: 5.81 MB
No deduping: 5.81 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

@codecov
Copy link

codecov bot commented Mar 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.44%. Comparing base (71bbeb7) to head (204a5e1).
⚠️ Report is 11 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7762      +/-   ##
==========================================
+ Coverage   80.39%   80.44%   +0.05%     
==========================================
  Files         741      741              
  Lines       32087    32170      +83     
==========================================
+ Hits        25795    25878      +83     
  Misses       6292     6292              
Flag Coverage Δ
aiguard-macos 38.85% <90.00%> (-0.13%) ⬇️
aiguard-ubuntu 38.96% <90.00%> (-0.13%) ⬇️
aiguard-windows 38.69% <90.00%> (-0.13%) ⬇️
apm-capabilities-tracing-macos 48.91% <100.00%> (+0.01%) ⬆️
apm-capabilities-tracing-ubuntu 48.95% <100.00%> (+0.01%) ⬆️
apm-capabilities-tracing-windows 48.67% <100.00%> (-0.01%) ⬇️
apm-integrations-child-process 38.41% <90.00%> (-0.13%) ⬇️
apm-integrations-couchbase-18 37.33% <90.00%> (-0.12%) ⬇️
apm-integrations-couchbase-eol 37.80% <90.00%> (-0.13%) ⬇️
apm-integrations-oracledb 37.63% <90.00%> (-0.12%) ⬇️
appsec-express 55.20% <90.00%> (+<0.01%) ⬆️
appsec-fastify 51.55% <90.00%> (-0.01%) ⬇️
appsec-graphql 51.74% <90.00%> (-0.01%) ⬇️
appsec-kafka 44.28% <90.00%> (+<0.01%) ⬆️
appsec-ldapjs 43.94% <90.00%> (-0.04%) ⬇️
appsec-lodash 43.60% <90.00%> (-0.04%) ⬇️
appsec-macos 58.21% <90.00%> (-0.02%) ⬇️
appsec-mongodb-core 48.71% <90.00%> (-0.04%) ⬇️
appsec-mongoose 49.37% <90.00%> (-0.05%) ⬇️
appsec-mysql 50.81% <90.00%> (+<0.01%) ⬆️
appsec-node-serialize 43.12% <90.00%> (-0.04%) ⬇️
appsec-passport 47.56% <90.00%> (+<0.01%) ⬆️
appsec-postgres 50.53% <90.00%> (-0.03%) ⬇️
appsec-sourcing 42.52% <90.00%> (-0.04%) ⬇️
appsec-template 43.28% <90.00%> (-0.04%) ⬇️
appsec-ubuntu 58.29% <90.00%> (-0.02%) ⬇️
appsec-windows 58.07% <90.00%> (-0.02%) ⬇️
instrumentations-instrumentation-bluebird 32.28% <90.00%> (-0.12%) ⬇️
instrumentations-instrumentation-body-parser 40.43% <90.00%> (-0.04%) ⬇️
instrumentations-instrumentation-child_process 37.73% <90.00%> (-0.13%) ⬇️
instrumentations-instrumentation-cookie-parser 34.26% <90.00%> (-0.11%) ⬇️
instrumentations-instrumentation-express 34.58% <90.00%> (-0.11%) ⬇️
instrumentations-instrumentation-express-mongo-sanitize 34.39% <90.00%> (-0.11%) ⬇️
instrumentations-instrumentation-express-session 40.06% <90.00%> (-0.04%) ⬇️
instrumentations-instrumentation-fs 31.90% <90.00%> (-0.12%) ⬇️
instrumentations-instrumentation-generic-pool 29.69% <ø> (-0.20%) ⬇️
instrumentations-instrumentation-http 39.70% <90.00%> (-0.13%) ⬇️
instrumentations-instrumentation-knex 32.29% <90.00%> (-0.12%) ⬇️
instrumentations-instrumentation-mongoose 33.41% <90.00%> (-0.11%) ⬇️
instrumentations-instrumentation-multer 40.18% <90.00%> (-0.04%) ⬇️
instrumentations-instrumentation-mysql2 38.18% <90.00%> (-0.13%) ⬇️
instrumentations-instrumentation-passport 43.98% <90.00%> (+0.02%) ⬆️
instrumentations-instrumentation-passport-http 43.65% <90.00%> (+0.01%) ⬆️
instrumentations-instrumentation-passport-local 44.18% <90.00%> (+0.01%) ⬆️
instrumentations-instrumentation-pg 37.62% <90.00%> (-0.13%) ⬇️
instrumentations-instrumentation-promise ?
instrumentations-instrumentation-promise-js 32.22% <90.00%> (-0.12%) ⬇️
instrumentations-instrumentation-q 32.26% <90.00%> (-0.12%) ⬇️
instrumentations-instrumentation-url 32.19% <90.00%> (-0.12%) ⬇️
instrumentations-instrumentation-when 32.23% <90.00%> (-0.12%) ⬇️
llmobs-ai 42.17% <90.00%> (-0.13%) ⬇️
llmobs-anthropic 40.16% <90.00%> (-0.12%) ⬇️
llmobs-bedrock 39.14% <90.00%> (-0.11%) ⬇️
llmobs-google-genai 39.70% <90.00%> (-0.12%) ⬇️
llmobs-langchain 39.94% <90.00%> (-0.10%) ⬇️
llmobs-openai 43.88% <90.00%> (-0.12%) ⬇️
llmobs-vertex-ai 39.95% <90.00%> (-0.12%) ⬇️
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.17% <90.00%> (-0.10%) ⬇️
plugins-cassandra 37.67% <90.00%> (-0.12%) ⬇️
plugins-cookie 26.89% <ø> (ø)
plugins-cookie-parser 26.67% <ø> (ø)
plugins-crypto 26.79% <ø> (ø)
plugins-dd-trace-api 38.24% <90.00%> (-0.13%) ⬇️
plugins-express-mongo-sanitize 26.82% <ø> (ø)
plugins-express-session 26.63% <ø> (ø)
plugins-fastify 42.15% <95.00%> (-0.04%) ⬇️
plugins-fetch 38.24% <90.00%> (-0.12%) ⬇️
plugins-fs 38.51% <90.00%> (-0.13%) ⬇️
plugins-generic-pool 25.87% <ø> (ø)
plugins-google-cloud-pubsub 45.34% <90.00%> (-0.05%) ⬇️
plugins-grpc 40.82% <90.00%> (-0.09%) ⬇️
plugins-handlebars 26.86% <ø> (ø)
plugins-hapi 40.06% <90.00%> (-0.04%) ⬇️
plugins-hono 40.32% <90.00%> (-0.04%) ⬇️
plugins-ioredis 38.32% <90.00%> (-0.13%) ⬇️
plugins-knex 26.50% <ø> (ø)
plugins-ldapjs 24.36% <ø> (ø)
plugins-light-my-request 26.23% <ø> (ø)
plugins-limitd-client 32.56% <90.00%> (-0.12%) ⬇️
plugins-lodash 25.96% <ø> (ø)
plugins-mariadb 39.37% <90.00%> (-0.13%) ⬇️
plugins-memcached 38.04% <90.00%> (-0.13%) ⬇️
plugins-microgateway-core 39.13% <90.00%> (-0.11%) ⬇️
plugins-moleculer 40.42% <90.00%> (-0.09%) ⬇️
plugins-mongodb 39.16% <90.00%> (-0.02%) ⬇️
plugins-mongodb-core 38.89% <90.00%> (-0.13%) ⬇️
plugins-mongoose 38.75% <90.00%> (-0.12%) ⬇️
plugins-multer 26.63% <ø> (ø)
plugins-mysql 39.05% <90.00%> (-0.13%) ⬇️
plugins-mysql2 39.15% <90.00%> (-0.13%) ⬇️
plugins-node-serialize 26.93% <ø> (ø)
plugins-opensearch 37.51% <90.00%> (-0.12%) ⬇️
plugins-passport-http 26.68% <ø> (ø)
plugins-postgres 35.55% <90.00%> (-0.19%) ⬇️
plugins-process 26.79% <ø> (ø)
plugins-pug 26.89% <ø> (ø)
plugins-redis 38.78% <90.00%> (-0.12%) ⬇️
plugins-router 43.00% <90.00%> (+0.10%) ⬆️
plugins-sequelize 25.47% <ø> (ø)
plugins-test-and-upstream-amqp10 38.40% <90.00%> (-0.13%) ⬇️
plugins-test-and-upstream-amqplib 43.76% <90.00%> (-0.10%) ⬇️
plugins-test-and-upstream-apollo 39.02% <90.00%> (+<0.01%) ⬆️
plugins-test-and-upstream-avsc 38.55% <80.00%> (-0.15%) ⬇️
plugins-test-and-upstream-bunyan 33.82% <90.00%> (-0.12%) ⬇️
plugins-test-and-upstream-connect 40.72% <90.00%> (-0.04%) ⬇️
plugins-test-and-upstream-graphql 40.01% <90.00%> (-0.13%) ⬇️
plugins-test-and-upstream-koa 40.31% <90.00%> (-0.03%) ⬇️
plugins-test-and-upstream-protobufjs 38.77% <80.00%> (-0.15%) ⬇️
plugins-test-and-upstream-rhea 43.95% <90.00%> (-0.10%) ⬇️
plugins-undici 39.01% <90.00%> (-0.12%) ⬇️
plugins-url 26.79% <ø> (ø)
plugins-valkey 37.99% <90.00%> (-0.13%) ⬇️
plugins-vm 26.79% <ø> (ø)
plugins-winston 34.01% <90.00%> (-0.26%) ⬇️
plugins-ws 41.77% <90.00%> (-0.09%) ⬇️
profiling-macos 39.80% <80.00%> (-0.15%) ⬇️
profiling-ubuntu 39.92% <80.00%> (-0.15%) ⬇️
profiling-windows 41.11% <80.00%> (-0.15%) ⬇️
serverless-azure-functions-client 25.54% <ø> (ø)
serverless-azure-functions-eventhubs ?
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.

@datadog-datadog-prod-us1-2
Copy link

datadog-datadog-prod-us1-2 bot commented Mar 12, 2026

⚠️ Tests

Fix all issues with BitsAI or with Cursor

⚠️ Warnings

🧪 1 Test failed

Instrumentation promise with promise >=7 (7.0.0) "before all" hook for "should run the then() callbacks in the context where then() was called" from with promise >=7 (7.0.0) (Datadog) (Fix with Cursor)
Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-instrumentations/test/promise.spec.js)

Error: Timeout of 5000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/dd-trace-js/dd-trace-js/packages/datadog-instrumentations/test/promise.spec.js)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 204a5e1 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback!

@pabloerhard pabloerhard marked this pull request as draft March 12, 2026 15:20
@pr-commenter
Copy link

pr-commenter bot commented Mar 12, 2026

Benchmarks

Benchmark execution time: 2026-03-12 16:32:16

Comparing candidate commit 204a5e1 in PR branch pabloerhard/process-tags with baseline commit 71bbeb7 in branch master.

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

@pabloerhard pabloerhard marked this pull request as ready for review March 12, 2026 16:39
@pabloerhard pabloerhard requested a review from a team as a code owner March 12, 2026 16:39
Copy link
Contributor

@amarziali amarziali left a comment

Choose a reason for hiding this comment

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

Looks good to me from a functional standpoint. Thanks

if (config?.isServiceNameInferred) {
tags.push(['svc.auto', config.service])
} else if (config) {
tags.push(['svc.user', true])
Copy link
Member

Choose a reason for hiding this comment

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

If process tags are used for renaming services would it ever make sense to have a value of "true"?

Copy link
Contributor Author

@pabloerhard pabloerhard Mar 13, 2026

Choose a reason for hiding this comment

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

I'm not sure I get what you mean? From my understanding whenever the user actually did the naming of the service, we intend to not do any renaming.

@pabloerhard pabloerhard merged commit dcde0e0 into master Mar 16, 2026
844 of 846 checks passed
@pabloerhard pabloerhard deleted the pabloerhard/process-tags branch March 16, 2026 14:46
dd-octo-sts bot pushed a commit that referenced this pull request Mar 17, 2026
…#7762)

* initial work for service naming process tag

* reworked process tags implementation

* lint fix

* removed testing leftovers

* fix grammar mistake

* fix test being undefined

* added missing inits

* debugger fix
@dd-octo-sts dd-octo-sts bot mentioned this pull request Mar 17, 2026
juan-fernandez pushed a commit that referenced this pull request Mar 18, 2026
…#7762)

* initial work for service naming process tag

* reworked process tags implementation

* lint fix

* removed testing leftovers

* fix grammar mistake

* fix test being undefined

* added missing inits

* debugger fix
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