33#include < cassert>
44#include < chrono>
55#include < string>
6+ #include < typeinfo>
67#include < unordered_map>
78#include < unordered_set>
89
@@ -142,7 +143,8 @@ DatadogAgent::DatadogAgent(const FinalizedDatadogAgentConfig& config,
142143 http_client_(config.http_client),
143144 event_scheduler_(config.event_scheduler),
144145 cancel_scheduled_flush_(event_scheduler_->schedule_recurring_event (
145- config.flush_interval, [this ]() { flush (); })) {
146+ config.flush_interval, [this ]() { flush (); })),
147+ flush_interval_(config.flush_interval) {
146148 assert (logger_);
147149}
148150
@@ -162,6 +164,25 @@ Expected<void> DatadogAgent::send(
162164 return std::nullopt ;
163165}
164166
167+ void DatadogAgent::config_json (nlohmann::json& destination) const {
168+ const auto & url = traces_endpoint_; // brevity
169+ const auto flush_interval_milliseconds =
170+ std::chrono::duration_cast<std::chrono::milliseconds>(flush_interval_)
171+ .count ();
172+
173+ // clang-format off
174+ destination = nlohmann::json::object ({
175+ {" type" , " DatadogAgent" },
176+ {" config" , nlohmann::json::object ({
177+ {" url" , (url.scheme + " ://" + url.authority + url.path )},
178+ {" flush_interval_milliseconds" , flush_interval_milliseconds},
179+ {" http_client_typeid" , typeid (*http_client_).name ()},
180+ {" event_scheduler_typeid" , typeid (*event_scheduler_).name ()},
181+ })},
182+ });
183+ // clang-format on
184+ }
185+
165186void DatadogAgent::flush () {
166187 outgoing_trace_chunks_.clear ();
167188 {
0 commit comments