Skip to content

Commit

Permalink
Fix the app-closing metrics payload
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilmour committed Oct 17, 2023
1 parent 28dd1c4 commit eb04fe8
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/datadog/tracer_telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,26 @@ std::string TracerTelemetry::app_closing() {
auto& metric = m.first.get();
auto& points = m.second;
if (!points.empty()) {
metrics.emplace_back(nlohmann::json::object({
{"metric", metric.name()},
{"tags", metric.tags()},
{"type", metric.type()},
{"interval", 60},
{"points", points},
{"common", metric.common()},
}));
auto type = metric.type();
if (type == "count") {
metrics.emplace_back(nlohmann::json::object({
{"metric", metric.name()},
{"tags", metric.tags()},
{"type", metric.type()},
{"points", points},
{"common", metric.common()},
}));
} else if (type == "gauge") {
// gauge metrics have a interval
metrics.emplace_back(nlohmann::json::object({
{"metric", metric.name()},
{"tags", metric.tags()},
{"type", metric.type()},
{"interval", 10},
{"points", points},
{"common", metric.common()},
}));
}
}
points.clear();
}
Expand Down

0 comments on commit eb04fe8

Please sign in to comment.