File tree Expand file tree Collapse file tree 4 files changed +8
-9
lines changed
Expand file tree Collapse file tree 4 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ nlohmann::json to_json(const SpanDefaults& defaults) {
2222 TO_JSON (version);
2323 TO_JSON (name);
2424 TO_JSON (tags);
25+ TO_JSON (runtime_id);
2526#undef TO_JSON
2627 return result;
2728}
Original file line number Diff line number Diff line change 88#include < unordered_map>
99
1010#include " json_fwd.hpp"
11+ #include " random.h"
1112
1213namespace datadog {
1314namespace tracing {
@@ -19,6 +20,7 @@ struct SpanDefaults {
1920 std::string version = " " ;
2021 std::string name = " " ;
2122 std::unordered_map<std::string, std::string> tags;
23+ std::string runtime_id = uuid();
2224};
2325
2426nlohmann::json to_json (const SpanDefaults&);
Original file line number Diff line number Diff line change 1616#include " platform_util.h"
1717#include " random.h"
1818#include " span_data.h"
19+ #include " span_defaults.h"
1920#include " span_sampler.h"
2021#include " tag_propagation.h"
2122#include " tags.h"
@@ -28,12 +29,8 @@ namespace {
2829
2930struct Cache {
3031 static int process_id;
31- static std::string runtime_id;
3232
33- static void recalculate_values () {
34- process_id = get_process_id ();
35- runtime_id = uuid ();
36- }
33+ static void recalculate_values () { process_id = get_process_id (); }
3734
3835 Cache () {
3936 recalculate_values ();
@@ -42,7 +39,6 @@ struct Cache {
4239};
4340
4441int Cache::process_id;
45- std::string Cache::runtime_id;
4642
4743// `cache_singleton` exists solely to invoke `Cache`'s constructor.
4844// All data members are static, so use e.g. `Cache::process_id` instead of
@@ -218,7 +214,7 @@ void TraceSegment::span_finished() {
218214 }
219215 span.numeric_tags [tags::internal::process_id] = Cache::process_id;
220216 span.tags [tags::internal::language] = " cpp" ;
221- span.tags [tags::internal::runtime_id] = Cache:: runtime_id;
217+ span.tags [tags::internal::runtime_id] = defaults_-> runtime_id ;
222218 }
223219
224220 const auto result = collector_->send (std::move (spans_), trace_sampler_);
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ std::string TracerTelemetry::app_started(nlohmann::json&& tracer_config) {
5959 {" seq_id" , seq_id},
6060 {" request_type" , " app-started" },
6161 {" tracer_time" , tracer_time},
62- {" runtime_id" , " 0524398a-11e2-4375-a637-619eb9148e8f " },
62+ {" runtime_id" , span_defaults_-> runtime_id },
6363 {" debug" , true },
6464 {" application" ,
6565 nlohmann::json::object ({
@@ -149,7 +149,7 @@ std::string TracerTelemetry::heartbeat_and_telemetry() {
149149 {" seq_id" , seq_id},
150150 {" request_type" , " message-batch" },
151151 {" tracer_time" , tracer_time},
152- {" runtime_id" , " 0524398a-11e2-4375-a637-619eb9148e8f " },
152+ {" runtime_id" , span_defaults_-> runtime_id },
153153 {" debug" , true },
154154 {" application" ,
155155 nlohmann::json::object ({
You can’t perform that action at this time.
0 commit comments