Skip to content

Commit 1f8a254

Browse files
khanayan123claude
andcommitted
Match registry: _DD_ROOT_CPP_SESSION_ID implementation B, default ""
The central registry has this config as implementation B with an empty string default. Update environment.h to use "" and teach config-inversion to emit "B" for this var via an override map. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent d805351 commit 1f8a254

3 files changed

Lines changed: 17 additions & 15 deletions

File tree

include/datadog/environment.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ namespace environment {
8282
MACRO(DD_TRACE_RESOURCE_RENAMING_ENABLED, BOOLEAN, false) \
8383
MACRO(DD_TRACE_RESOURCE_RENAMING_ALWAYS_SIMPLIFIED_ENDPOINT, BOOLEAN, false) \
8484
MACRO(DD_EXTERNAL_ENV, STRING, "") \
85-
MACRO(_DD_ROOT_CPP_SESSION_ID, STRING, nullptr)
85+
MACRO(_DD_ROOT_CPP_SESSION_ID, STRING, "")
8686

8787
#define ENV_DEFAULT_RESOLVED_IN_CODE(X) X
8888
#define WITH_COMMA(ARG, TYPE, DEFAULT_VALUE) ARG,

supported-configurations.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@
282282
],
283283
"_DD_ROOT_CPP_SESSION_ID": [
284284
{
285-
"default": null,
286-
"implementation": "A",
285+
"default": "",
286+
"implementation": "B",
287287
"type": "STRING"
288288
}
289289
]

tools/config-inversion/main.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
#include <iostream>
55
#include <nlohmann/json.hpp>
66
#include <sstream>
7+
#include <unordered_map>
78

89
#include "datadog/environment.h"
910

1011
namespace fs = std::filesystem;
1112
namespace env = datadog::tracing::environment;
1213

1314
template <typename T>
14-
nlohmann::json to_json_default(const T& value) {
15+
std::string to_string_any(const T& value) {
1516
std::ostringstream oss;
1617
oss << value;
1718
return oss.str();
1819
}
1920

20-
template <>
21-
nlohmann::json to_json_default(std::nullptr_t const&) {
22-
return nullptr;
23-
}
21+
// Variables whose registry implementation letter differs from the default "A".
22+
static const std::unordered_map<std::string, const char*> implementation_overrides = {
23+
{"_DD_ROOT_CPP_SESSION_ID", "B"},
24+
};
2425

2526
nlohmann::json build_configuration() {
2627
nlohmann::json j;
@@ -33,13 +34,14 @@ nlohmann::json build_configuration() {
3334

3435
#define ENV_DEFAULT_RESOLVED_IN_CODE(X) ""
3536

36-
#define X(NAME, TYPE, DEFAULT_VALUE) \
37-
do { \
38-
auto obj = nlohmann::json::object(); \
39-
obj["default"] = to_json_default(DEFAULT_VALUE); \
40-
obj["implementation"] = "A"; \
41-
obj["type"] = QUOTED(TYPE); \
42-
supported_configurations[QUOTED(NAME)] = nlohmann::json::array({obj}); \
37+
#define X(NAME, TYPE, DEFAULT_VALUE) \
38+
do { \
39+
auto obj = nlohmann::json::object(); \
40+
obj["default"] = to_string_any(DEFAULT_VALUE); \
41+
auto it = implementation_overrides.find(QUOTED(NAME)); \
42+
obj["implementation"] = (it != implementation_overrides.end()) ? it->second : "A"; \
43+
obj["type"] = QUOTED(TYPE); \
44+
supported_configurations[QUOTED(NAME)] = nlohmann::json::array({obj}); \
4345
} while (0);
4446

4547
DD_LIST_ENVIRONMENT_VARIABLES(X)

0 commit comments

Comments
 (0)