@@ -35,10 +35,12 @@ std::string_view or_default(std::string_view config_json) {
35
35
36
36
} // namespace
37
37
38
- dd::Expected<dd::Tracer> TracingLibrary::make_tracer (const datadog_main_conf_t & nginx_conf) {
38
+ dd::Expected<dd::Tracer> TracingLibrary::make_tracer (const datadog_main_conf_t & nginx_conf) {
39
39
dd::TracerConfig config;
40
40
config.logger = std::make_shared<NgxLogger>();
41
41
config.agent .event_scheduler = std::make_shared<NgxEventScheduler>();
42
+ config.integration_name = " nginx" ;
43
+ config.integration_version = NGINX_VERSION;
42
44
43
45
if (!nginx_conf.propagation_styles .empty ()) {
44
46
config.injection_styles = config.extraction_styles = nginx_conf.propagation_styles ;
@@ -71,11 +73,11 @@ dd::Expected<dd::Tracer> TracingLibrary::make_tracer(const datadog_main_conf_t&
71
73
// order in which we try the rules doesn't change the outcome.
72
74
// Deeper directives are more likely to match a given request, though, and
73
75
// so this can be thought of as an optimization.
74
- const auto by_depth_descending = [](const auto & left, const auto & right) {
76
+ const auto by_depth_descending = [](const auto & left, const auto & right) {
75
77
return *left.depth > *right.depth ;
76
78
};
77
79
std::stable_sort (rules.begin (), rules.end (), by_depth_descending);
78
- for (sampling_rule_t & rule : rules) {
80
+ for (sampling_rule_t & rule : rules) {
79
81
config.trace_sampler .rules .push_back (std::move (rule.rule ));
80
82
}
81
83
@@ -88,7 +90,7 @@ dd::Expected<dd::Tracer> TracingLibrary::make_tracer(const datadog_main_conf_t&
88
90
}
89
91
90
92
dd::Expected<std::vector<std::string_view>> TracingLibrary::propagation_header_names (
91
- const std::vector<dd::PropagationStyle>& configured_styles, dd::Logger& logger) {
93
+ const std::vector<dd::PropagationStyle> & configured_styles, dd::Logger & logger) {
92
94
std::vector<std::string_view> result;
93
95
94
96
// Create a tracer config that contains `configured_styles` (or the default
@@ -105,16 +107,19 @@ dd::Expected<std::vector<std::string_view>> TracingLibrary::propagation_header_n
105
107
minimal_config.extraction_styles = configured_styles;
106
108
}
107
109
auto finalized_config = dd::finalize_config (minimal_config);
108
- if (auto * error = finalized_config.if_error ()) {
110
+ if (auto * error = finalized_config.if_error ()) {
109
111
return std::move (*error);
110
112
}
111
113
112
114
if (!configured_styles.empty () && configured_styles != finalized_config->injection_styles ) {
113
- logger.log_error ([&](std::ostream& log) {
114
- log << " Actual injection propagation styles differ from that specified in the nginx "
115
- " configuration. The datadog_propagation_styles directive indicated the values "
115
+ logger.log_error ([&](std::ostream &log) {
116
+ log << " Actual injection propagation styles differ from that specified "
117
+ " in the nginx "
118
+ " configuration. The datadog_propagation_styles directive "
119
+ " indicated the values "
116
120
<< dd::to_json (configured_styles)
117
- << " , but after applying environment variables, the final values are instead "
121
+ << " , but after applying environment variables, the final values are "
122
+ " instead "
118
123
<< dd::to_json (finalized_config->injection_styles );
119
124
});
120
125
}
@@ -179,10 +184,10 @@ class SpanContextJSONWriter : public dd::DictWriter {
179
184
output_object_[std::move (normalized_key)] = value;
180
185
}
181
186
182
- nlohmann::json& json () { return output_object_; }
187
+ nlohmann::json & json () { return output_object_; }
183
188
};
184
189
185
- std::string span_property (std::string_view key, const dd::Span& span) {
190
+ std::string span_property (std::string_view key, const dd::Span & span) {
186
191
const auto not_found = " -" ;
187
192
188
193
if (key == " trace_id" ) {
0 commit comments