Skip to content

Commit

Permalink
Remove "additional_payload" from telemetry
Browse files Browse the repository at this point in the history
This was requested by the team involved in instrumentation telemetry.
  • Loading branch information
cgilmour committed Nov 9, 2023
1 parent 2ee2a7f commit 238ad11
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/datadog/datadog_agent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ void DatadogAgent::flush() {
}
}

void DatadogAgent::send_app_started(nlohmann::json&& tracer_config) {
auto payload = tracer_telemetry_->app_started(std::move(tracer_config));
void DatadogAgent::send_app_started() {
auto payload = tracer_telemetry_->app_started();
auto post_result = http_client_->post(
telemetry_endpoint_, telemetry_set_request_headers_, std::move(payload),
telemetry_on_response_, telemetry_on_error_);
Expand Down
2 changes: 1 addition & 1 deletion src/datadog/datadog_agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class DatadogAgent : public Collector {
std::vector<std::unique_ptr<SpanData>>&& spans,
const std::shared_ptr<TraceSampler>& response_handler) override;

void send_app_started(nlohmann::json&& tracer_config);
void send_app_started();

nlohmann::json config_json() const override;
};
Expand Down
2 changes: 1 addition & 1 deletion src/datadog/tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Tracer::Tracer(const FinalizedTracerConfig& config,
clock, config.logger);
collector_ = agent;
if (tracer_telemetry_->enabled()) {
agent->send_app_started(config_json());
agent->send_app_started();
}
}

Expand Down
9 changes: 1 addition & 8 deletions src/datadog/tracer_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,13 @@ nlohmann::json TracerTelemetry::generate_telemetry_body(
});
}

std::string TracerTelemetry::app_started(nlohmann::json&& tracer_config) {
std::string TracerTelemetry::app_started() {
auto telemetry_body = generate_telemetry_body("app-started");
// TODO: environment variables or finalized config details
telemetry_body["payload"] = nlohmann::json::object({
{"configuration", nlohmann::json::array({})},

});
// TODO: Until we figure out "configuration", above, include a
// JSON dump of the tracer configuration as "additional_payload".
telemetry_body["additional_payload"] =
nlohmann::json::array({nlohmann::json::object({
{"name", "tracer_config_json"},
{"value", tracer_config.dump()},
})});
auto app_started_payload = telemetry_body.dump();
return app_started_payload;
}
Expand Down
4 changes: 2 additions & 2 deletions src/datadog/tracer_telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct SpanDefaults;

class TracerTelemetry {
bool enabled_ = false;
bool debug_ = false;
bool debug_ = true;
Clock clock_;
std::shared_ptr<Logger> logger_;
std::shared_ptr<const SpanDefaults> span_defaults_;
Expand Down Expand Up @@ -108,7 +108,7 @@ class TracerTelemetry {
auto& metrics() { return metrics_; };
// Constructs an `app-started` message using information provided when
// constructed and the tracer_config value passed in.
std::string app_started(nlohmann::json&& tracer_config);
std::string app_started();
// This is used to take a snapshot of the current state of metrics and collect
// timestamped "points" of values. These values are later submitted in
// `generate-metrics` messages.
Expand Down
2 changes: 1 addition & 1 deletion test/test_tracer_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ TEST_CASE("Tracer telemetry") {

SECTION("generates app-started message") {
auto app_started_message =
tracer_telemetry.app_started(nlohmann::json::object());
tracer_telemetry.app_started();
auto app_started = nlohmann::json::parse(app_started_message);
REQUIRE(app_started["request_type"] == "app-started");
}
Expand Down

0 comments on commit 238ad11

Please sign in to comment.