Skip to content

Commit 2dfda7f

Browse files
authored
feat: seed root session ID in master for stable telemetry headers (#345)
chore: update dd-trace-cpp submodule to stable session ID headers branch Points to ayan.khan/stable-session-id-headers tip for integration validation of DD-Session-ID and DD-Root-Session-ID telemetry headers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> feat: seed root session ID in master before workers fork Generate root_session_id in create_datadog_main_conf (master process) and pass it to TracerConfig in make_tracer (worker process). All workers inherit the same root via fork memory copy, ensuring consistent DD-Root-Session-ID across telemetry from all workers. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> chore: update dd-trace-cpp submodule to latest Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> fix: remove submodule pin, keep only src changes Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Merge branch 'master' into ayan.khan/stable-session-id-headers chore: update dd-trace-cpp submodule to main (includes #295) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Merge branch 'master' into ayan.khan/stable-session-id-headers Co-authored-by: ayan.khan <ayan.khan@datadoghq.com>
1 parent 5e9ab01 commit 2dfda7f

4 files changed

Lines changed: 9 additions & 1 deletion

File tree

src/datadog_conf.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct datadog_main_conf_t {
9494
// module configuration, instead we grab the values from the environment
9595
// of the master process and apply them later in the worker processes after
9696
// `fork()`.
97+
std::string root_session_id;
9798
std::vector<environment_variable_t> environment_variables;
9899
// If `propagation_styles` is empty, then use the defaults instead.
99100
// `propagation_styles` is populated by the "datadog_propagation_styles"

src/ngx_http_datadog_module.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#include "ngx_http_datadog_module.h"
22

3+
#include <datadog/runtime_id.h>
4+
35
#include <cassert>
46
#include <cstdlib>
57
#include <exception>
@@ -408,6 +410,7 @@ static void *create_datadog_main_conf(ngx_conf_t *conf) noexcept {
408410
if (register_destructor(conf->pool, main_conf)) {
409411
return nullptr; // error
410412
}
413+
main_conf->root_session_id = dd::RuntimeID::generate().string();
411414
return main_conf;
412415
}
413416

src/tracing_library.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ dd::Expected<dd::Tracer> TracingLibrary::make_tracer(
5555
config.integration_version = NGINX_VERSION;
5656
config.service = "nginx";
5757

58+
if (!nginx_conf.root_session_id.empty()) {
59+
config.root_session_id = nginx_conf.root_session_id;
60+
}
61+
5862
if (nginx_conf.apm_tracing_enabled != NGX_CONF_UNSET) {
5963
config.tracing_enabled = {nginx_conf.apm_tracing_enabled == 1};
6064
}

0 commit comments

Comments
 (0)