Skip to content

feat(tracer): add svc.user/svc.auto process tags to signal service name origin#4725

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
mainfrom
andrea.marziali/svc-name-process-tag
May 6, 2026
Merged

feat(tracer): add svc.user/svc.auto process tags to signal service name origin#4725
gh-worker-dd-mergequeue-cf854d[bot] merged 5 commits into
mainfrom
andrea.marziali/svc-name-process-tag

Conversation

@amarziali

@amarziali amarziali commented May 5, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds two mutually exclusive process tags that signal to the Datadog backend whether the tracer's default service name was explicitly configured by the user or automatically assigned:

  • svc.user:true — the user explicitly set a service name (via DD_SERVICE, OTEL_SERVICE_NAME, DD_TAGS, WithService(), or WithGlobalTag("service", ...))
  • svc.auto:<name> — the tracer defaulted to the binary name because no service was configured

The tags are set once during tracer.Start() and propagated in all product payloads via the existing process tags mechanism.

Motivation

Let the backend know when a name is auto-assigned or when it's user-defined in order to apply the best renaming rules for all the products that are already using process tags.

Reviewer's Checklist

  • Changed code has unit tests for its functionality at or near 100% coverage.
  • System-Tests covering this feature have been added and enabled with the va.b.c-dev version tag.
  • There is a benchmark for any new code, or changes to existing code.
  • If this interacts with the agent in a new way, a system test has been added.
  • New code is free of linting errors. You can check this by running make lint locally.
  • New code doesn't break existing tests. You can check this by running make test locally.
  • Add an appropriate team label so this PR gets put in the right place for the release notes.
  • All generated files are up to date. You can check this by running make generate locally.
  • Non-trivial go.mod changes, e.g. adding new modules, are reviewed by @DataDog/dd-trace-go-guild. Make sure all nested modules are up to date by running make fix-modules locally.

Unsure? Have a question? Request a review!

@amarziali
amarziali requested review from a team as code owners May 5, 2026 08:45
@amarziali
amarziali requested a review from raphaelgavache May 5, 2026 08:45
@amarziali amarziali added apm:core AI Generated Largely based on code generated by an AI or LLM. This label is the same across all dd-trace-* repos labels May 5, 2026

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

ℹ️ 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 ddtrace/tracer/option.go
} else {
globalconfig.SetServiceName(c.internalConfig.ServiceName())
}
processtags.SetServiceNameTag(c.internalConfig.ServiceName(), svcIsUserDefined)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Set service process tags outside tracer-only config

When an application enables only the profiler, this hook never runs, but profiler uploads still serialize processtags.GlobalTags().String() (profiler/upload.go) and the profiler derives its service from DD_SERVICE or filepath.Base(os.Args[0]) in profiler/options.go. Those standalone profile payloads will therefore continue to omit both svc.user and svc.auto, so the new signal is not actually propagated to all existing process-tag product payloads unless the tracer is also started.

Useful? React with 👍 / 👎.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented May 5, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 61.35% (-0.04%)

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

@pr-commenter

pr-commenter Bot commented May 5, 2026

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-05-06 07:53:04

Comparing candidate commit 6674510 in PR branch andrea.marziali/svc-name-process-tag with baseline commit 3e8a286 in branch main.

Found 3 performance improvements and 2 performance regressions! Performance is the same for 219 metrics, 9 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 ----------------------------------'

scenario:BenchmarkOTLPProtoSize/100spans-25

  • 🟩 execution_time [-775.399ns; -634.001ns] or [-2.527%; -2.066%]

scenario:BenchmarkOTLPProtoSize/10spans-25

  • 🟩 execution_time [-105.408ns; -89.792ns] or [-3.343%; -2.848%]

scenario:BenchmarkOTLPProtoSize/1span-25

  • 🟩 execution_time [-25.325ns; -8.395ns] or [-6.537%; -2.167%]

scenario:BenchmarkOTelApiWithCustomTags/datadog_otel_api-25

  • 🟥 allocated_mem [+376 bytes; +382 bytes] or [+11.221%; +11.385%]

scenario:BenchmarkOTelApiWithCustomTags/otel_api-25

  • 🟥 allocated_mem [+363 bytes; +375 bytes] or [+7.761%; +8.018%]

@kakkoyun kakkoyun 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.

Looking good.

Let's use checklocks annotations.

Comment thread internal/processtags/processtags.go
@amarziali
amarziali requested a review from kakkoyun May 5, 2026 13:44
@codecov

codecov Bot commented May 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.07%. Comparing base (3e8a286) to head (6674510).

Additional details and impacted files
Files with missing lines Coverage Δ
ddtrace/tracer/option.go 85.12% <100.00%> (-2.09%) ⬇️
internal/processtags/processtags.go 88.50% <100.00%> (-3.05%) ⬇️

... and 275 files with indirect coverage changes

🚀 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.

@kakkoyun kakkoyun 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.

LGTM

@amarziali

Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351

gh-worker-devflow-routing-ef8351 Bot commented May 6, 2026

Copy link
Copy Markdown

View all feedbacks in Devflow UI.

2026-05-06 09:25:34 UTC ℹ️ Start processing command /merge


2026-05-06 09:25:36 UTC ❌ MergeQueue

PR already in the queue with status in_progress

@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot merged commit 0643eb5 into main May 6, 2026
223 of 224 checks passed
@gh-worker-dd-mergequeue-cf854d
gh-worker-dd-mergequeue-cf854d Bot deleted the andrea.marziali/svc-name-process-tag branch May 6, 2026 09:37
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 apm:core mergequeue-status: done

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants