Skip to content

Commit a3b7684

Browse files
khanayan123claude
andcommitted
Remove _DD_ROOT_CPP_SESSION_ID env var in favour of SHM carrier
SHM is now the sole propagation mechanism. The env var was only ever written and read by C++ itself, so there was no cross-SDK interop value in keeping it. Removes: the registry entry, environment::set(), the write in Tracer constructor, the fallback read in finalize_config, and the supported-configurations.json entry. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 10f744c commit a3b7684

File tree

5 files changed

+2
-28
lines changed

5 files changed

+2
-28
lines changed

include/datadog/environment.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ namespace environment {
8181
MACRO(DD_APM_TRACING_ENABLED, BOOLEAN, true) \
8282
MACRO(DD_TRACE_RESOURCE_RENAMING_ENABLED, BOOLEAN, false) \
8383
MACRO(DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT, BOOLEAN, false) \
84-
MACRO(DD_EXTERNAL_ENV, STRING, "") \
85-
MACRO(_DD_ROOT_CPP_SESSION_ID, STRING, "")
84+
MACRO(DD_EXTERNAL_ENV, STRING, "")
8685

8786
#define ENV_DEFAULT_RESOLVED_IN_CODE(X) X
8887
#define WITH_COMMA(ARG, TYPE, DEFAULT_VALUE) ARG,
@@ -111,9 +110,6 @@ StringView name(Variable variable);
111110
// `nullopt` if that variable is not set in the environment.
112111
Optional<StringView> lookup(Variable variable);
113112

114-
// Set the specified environment `variable` to `value`. Does not overwrite if
115-
// already set (equivalent to setenv(..., 0) on POSIX).
116-
void set(Variable variable, StringView value);
117113

118114
std::string to_json();
119115

src/datadog/environment.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,6 @@ Optional<StringView> lookup(Variable variable) {
1919
return StringView{value};
2020
}
2121

22-
void set(Variable variable, StringView value) {
23-
const char* name = variable_names[variable];
24-
#ifdef _WIN32
25-
_putenv_s(name, value.data());
26-
#else
27-
setenv(name, value.data(), /*overwrite=*/0);
28-
#endif
29-
}
3022

3123
std::string to_json() {
3224
auto result = nlohmann::json::object({});

src/datadog/tracer.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,10 @@ Tracer::Tracer(const FinalizedTracerConfig& config,
6666
tracing_enabled_(config.tracing_enabled),
6767
resource_renaming_mode_(config.resource_renaming_mode) {
6868
// Create a shared memory carrier so exec'd children can inherit the root
69-
// session ID without relying solely on environment variables.
69+
// session ID.
7070
if (auto carrier = SessionCarrier::create(signature_.root_session_id)) {
7171
session_carrier_ = std::make_shared<SessionCarrier>(std::move(*carrier));
7272
}
73-
// Also set the env var for interop with SDKs that still use it.
74-
environment::set(environment::_DD_ROOT_CPP_SESSION_ID,
75-
signature_.root_session_id);
7673

7774
telemetry::init(config.telemetry, signature_, logger_, config.http_client,
7875
config.event_scheduler, config.agent_url);

src/datadog/tracer_config.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,8 @@ Expected<FinalizedTracerConfig> finalize_config(const TracerConfig& user_config,
407407
final_config.runtime_id = user_config.runtime_id;
408408
}
409409

410-
// Prefer shared memory carrier (set by a C++ parent); fall back to the
411-
// environment variable for interop with SDKs that still use env vars.
412410
if (auto shm = read_inherited_session_id()) {
413411
final_config.root_session_id = std::move(*shm);
414-
} else if (auto env = lookup(environment::_DD_ROOT_CPP_SESSION_ID)) {
415-
final_config.root_session_id = std::string{*env};
416412
}
417413

418414
final_config.process_tags = user_config.process_tags;

supported-configurations.json

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@
2828
"type": "STRING"
2929
}
3030
],
31-
"_DD_ROOT_CPP_SESSION_ID": [
32-
{
33-
"default": "",
34-
"implementation": "A",
35-
"type": "STRING"
36-
}
37-
],
3831
"DD_INSTRUMENTATION_INSTALL_ID": [
3932
{
4033
"default": "",

0 commit comments

Comments
 (0)