Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/datadog_conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ struct datadog_main_conf_t {
// module configuration, instead we grab the values from the environment
// of the master process and apply them later in the worker processes after
// `fork()`.
std::string root_session_id;
std::vector<environment_variable_t> environment_variables;
// If `propagation_styles` is empty, then use the defaults instead.
// `propagation_styles` is populated by the "datadog_propagation_styles"
Expand Down
3 changes: 3 additions & 0 deletions src/ngx_http_datadog_module.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "ngx_http_datadog_module.h"

#include <datadog/runtime_id.h>

#include <cassert>
#include <cstdlib>
#include <exception>
Expand Down Expand Up @@ -408,6 +410,7 @@ static void *create_datadog_main_conf(ngx_conf_t *conf) noexcept {
if (register_destructor(conf->pool, main_conf)) {
return nullptr; // error
}
main_conf->root_session_id = dd::RuntimeID::generate().string();
return main_conf;
}

Expand Down
4 changes: 4 additions & 0 deletions src/tracing_library.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ dd::Expected<dd::Tracer> TracingLibrary::make_tracer(
config.integration_version = NGINX_VERSION;
config.service = "nginx";

if (!nginx_conf.root_session_id.empty()) {
config.root_session_id = nginx_conf.root_session_id;
}

if (nginx_conf.apm_tracing_enabled != NGX_CONF_UNSET) {
config.tracing_enabled = {nginx_conf.apm_tracing_enabled == 1};
}
Expand Down
Loading