Skip to content

Commit eb04fe8

Browse files
committed
Fix the app-closing metrics payload
1 parent 28dd1c4 commit eb04fe8

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/datadog/tracer_telemetry.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -178,14 +178,26 @@ std::string TracerTelemetry::app_closing() {
178178
auto& metric = m.first.get();
179179
auto& points = m.second;
180180
if (!points.empty()) {
181-
metrics.emplace_back(nlohmann::json::object({
182-
{"metric", metric.name()},
183-
{"tags", metric.tags()},
184-
{"type", metric.type()},
185-
{"interval", 60},
186-
{"points", points},
187-
{"common", metric.common()},
188-
}));
181+
auto type = metric.type();
182+
if (type == "count") {
183+
metrics.emplace_back(nlohmann::json::object({
184+
{"metric", metric.name()},
185+
{"tags", metric.tags()},
186+
{"type", metric.type()},
187+
{"points", points},
188+
{"common", metric.common()},
189+
}));
190+
} else if (type == "gauge") {
191+
// gauge metrics have a interval
192+
metrics.emplace_back(nlohmann::json::object({
193+
{"metric", metric.name()},
194+
{"tags", metric.tags()},
195+
{"type", metric.type()},
196+
{"interval", 10},
197+
{"points", points},
198+
{"common", metric.common()},
199+
}));
200+
}
189201
}
190202
points.clear();
191203
}

0 commit comments

Comments
 (0)