Skip to content

Fix(tracing): autodetect default Agent socket - #370

Merged
xlamorlette-datadog merged 5 commits into
mainfrom
Seanbon0611/autodetect_socket_path_when_unset
Sep 25, 2026
Merged

xlamorlette-datadog merged 5 commits into
mainfrom
Seanbon0611/autodetect_socket_path_when_unset

Conversation

@Seanbon0611

@Seanbon0611 Seanbon0611 commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Add automatic detection of the default Datadog Agent Unix domain socket at /var/run/datadog/apm.socket.

When no Agent URL, host, or port is configured, the tracer now uses: unix:///var/run/datadog/apm.socket
if the socket path exists. Otherwise, it continues to use http://localhost:8126.
Configuration precedence remains:

  1. Environment variables
  2. Programmatic configuration
  3. Default Agent socket
  4. http://localhost:8126

Motivation

APMS-20562

Single-step instrumentation mounts the Agent socket at /var/run/datadog/apm.socket without necessarily setting DD_TRACE_AGENT_URL.
The C++ tracer previously ignored this socket and attempted to connect to localhost:8126, unlike other supported tracers. This prevented tracing from working in affected SSI environments.

Additional Notes

  • Windows behavior is unchanged.
  • Added deterministic tests for socket detection, fallback behavior, empty environment variables, and configuration precedence.
  • Full test suite passes: 134 test cases.

Jira ticket: APMS-20562

@Seanbon0611
Seanbon0611 requested review from a team as code owners September 22, 2026 18:52
@Seanbon0611
Seanbon0611 requested review from e-n-0 and removed request for a team September 22, 2026 18:52

@xlamorlette-datadog xlamorlette-datadog left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Neat!

Comment thread test/common/environment.h
Comment thread src/datadog/datadog_agent_config.cpp Outdated
@pr-commenter

pr-commenter Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Benchmarks

Benchmark execution time: 2026-09-25 09:39:44

Comparing candidate commit 1011db8 in PR branch Seanbon0611/autodetect_socket_path_when_unset with baseline commit d7a2e2a in branch main.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 1 metrics, 7 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 ----------------------------------'

@datadog-prod-us1-5

This comment has been minimized.

@xlamorlette-datadog
xlamorlette-datadog force-pushed the Seanbon0611/autodetect_socket_path_when_unset branch from 9a11cd6 to 1011db8 Compare September 25, 2026 09:30
@xlamorlette-datadog
xlamorlette-datadog removed the request for review from e-n-0 September 25, 2026 12:52
@xlamorlette-datadog
xlamorlette-datadog merged commit 57bbe30 into main Sep 25, 2026
38 checks passed
@xlamorlette-datadog
xlamorlette-datadog deleted the Seanbon0611/autodetect_socket_path_when_unset branch September 25, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants