Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "additional_payload" from telemetry #68

Merged
merged 3 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion src/datadog/tracer_telemetry.h
Original file line number Diff line number Diff line change
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
3 changes: 1 addition & 2 deletions test/test_tracer_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ TEST_CASE("Tracer telemetry") {
RuntimeID::generate()};

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