-
Notifications
You must be signed in to change notification settings - Fork 20
Fix(tracing): autodetect default Agent socket #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
xlamorlette-datadog
merged 5 commits into
main
from
Seanbon0611/autodetect_socket_path_when_unset
Sep 25, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
16c61f7
test: allow temporarily unset environment vars
Seanbon0611 a4c7a07
feat: autodetect default Agent socket
Seanbon0611 e461b87
test: cover Agent socket autodetection
Seanbon0611 f73ecd4
refactor to use maybe_unused for socket path
Seanbon0611 1011db8
batch micro benchmark tests to avoid flakiness
xlamorlette-datadog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,10 @@ | ||
| #include <filesystem> | ||
|
|
||
| namespace datadog { | ||
| namespace tracing { | ||
| namespace datadog::tracing { | ||
| class Tracer; | ||
| } // namespace tracing | ||
| } // namespace datadog | ||
| } // namespace datadog::tracing | ||
|
|
||
| // Use the specified `tracer` to create a trace whose structure resembles the | ||
| // file system tree rooted at the specified `path`. | ||
| void sha256_traced(const std::filesystem::path &path, datadog::tracing::Tracer &tracer); | ||
| void sha256_traced(const std::filesystem::path &path, | ||
| datadog::tracing::Tracer &tracer); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #pragma once | ||
|
|
||
| #include <datadog/datadog_agent_config.h> | ||
|
|
||
| #include <filesystem> | ||
| #include <utility> | ||
|
|
||
| namespace datadog::tracing { | ||
|
|
||
| // The well-known path where the Datadog Agent listens on a Unix domain socket. | ||
| // Single-step instrumentation mounts the socket here. | ||
| inline constexpr char default_agent_socket_path[] = | ||
| "/var/run/datadog/apm.socket"; | ||
|
|
||
| // Return the Agent URL configured by the environment, or null if the | ||
| // environment does not configure one. `DD_TRACE_AGENT_URL` wins over | ||
| // `DD_AGENT_HOST` and `DD_TRACE_AGENT_PORT`. Empty values count as unset. | ||
| Optional<std::string> build_agent_url_from_environment_variables(); | ||
|
|
||
| // Return the origin and value of the Agent URL, given the URL from the | ||
| // environment, the URL from programmatic configuration, and the path where the | ||
| // Agent might listen on a Unix domain socket. | ||
| std::pair<ConfigMetadata::Origin, std::string> select_agent_url( | ||
| const Optional<std::string>& environment_url, | ||
| const Optional<std::string>& programmatic_url, | ||
| const std::filesystem::path& default_socket_path); | ||
|
|
||
| } // namespace datadog::tracing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.