@@ -105,44 +105,10 @@ void startupLog(TracerOptions &options) {
105
105
return ;
106
106
<
5D41
/td> }
107
107
108
- json j;
109
- std::time_t t = std::chrono::system_clock::to_time_t (std::chrono::system_clock::now ());
110
- std::stringstream ss;
111
- ss << std::put_time (std::localtime (&t), " %FT%T%z" );
112
- j[" date" ] = ss.str ();
113
- j[" version" ] = datadog::version::tracer_version;
114
- j[" lang" ] = " cpp" ;
115
- j[" lang_version" ] = datadog::version::cpp_version;
116
- j[" env" ] = options.environment ;
117
- j[" enabled" ] = true ;
118
- j[" service" ] = options.service ;
119
- if (!options.agent_url .empty ()) {
120
- j[" agent_url" ] = options.agent_url ;
121
- } else {
122
- j[" agent_url" ] =
123
- std::string (" http://" ) + options.agent_host + " :" + std::to_string (options.agent_port );
124
- }
125
- j[" analytics_enabled" ] = options.analytics_enabled ;
126
- j[" analytics_sample_rate" ] = options.analytics_rate ;
127
- if (!std::isnan (options.sample_rate )) {
128
- j[" sample_rate" ] = options.sample_rate ;
129
- }
130
- j[" sampling_rules" ] = options.sampling_rules ;
131
- j[" sampling_limit_per_second" ] = options.sampling_limit_per_second ;
132
- if (!options.tags .empty ()) {
133
- j[" tags" ] = options.tags ;
134
- }
135
- if (!options.version .empty ()) {
136
- j[" dd_version" ] = options.version ;
137
- }
138
- j[" report_hostname" ] = options.report_hostname ;
139
- if (!options.operation_name_override .empty ()) {
140
- j[" operation_name_override" ] = options.operation_name_override ;
141
- }
142
-
143
108
std::string message;
144
109
message += " DATADOG TRACER CONFIGURATION - " ;
145
- message += j.dump ();
110
+ const bool with_timestamp = true ;
111
+ message += toJSON (options, with_timestamp);
146
112
options.log_func (LogLevel::info, message);
147
113
}
148
114
@@ -370,5 +336,12 @@ ot::expec
5D41
ted<std::unique_ptr<ot::SpanContext>> Tracer::Extract(
370
336
371
337
void Tracer::Close () noexcept { buffer_->flush (std::chrono::seconds (5 )); }
372
338
339
+ const TracerOptions &Tracer::options () const noexcept { return opts_; }
340
+
341
+ const TracerOptions &getOptions (const ot::Tracer &tracer) {
342
+ auto &dd_tracer = static_cast <const Tracer &>(tracer);
343
+ return dd_tracer.options ();
344
+ }
345
+
373
346
} // namespace opentracing
374
347
} // namespace datadog
0 commit comments