Skip to content

Commit bdb9d9f

Browse files
committed
Only send interval for gauge metrics.
1 parent feee3fe commit bdb9d9f

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
@@ -124,14 +124,26 @@ std::string TracerTelemetry::heartbeat_and_telemetry() {
124124
auto& metric = m.first.get();
125125
auto& points = m.second;
126126
if (!points.empty()) {
127-
metrics.emplace_back(nlohmann::json::object({
128-
{"metric", metric.name()},
129-
{"tags", metric.tags()},
130-
{"type", metric.type()},
131-
{"interval", 60},
132-
{"points", points},
133-
{"common", metric.common()},
134-
}));
127+
auto type = metric.type();
128+
if (type == "count") {
129+
metrics.emplace_back(nlohmann::json::object({
130+
{"metric", metric.name()},
131+
{"tags", metric.tags()},
132+
{"type", metric.type()},
133+
{"points", points},
134+
{"common", metric.common()},
135+
}));
136+
} else if (type == "gauge") {
137+
// gauge metrics have a interval
138+
metrics.emplace_back(nlohmann::json::object({
139+
{"metric", metric.name()},
140+
{"tags", metric.tags()},
141+
{"type", metric.type()},
142+
{"interval", 10},
143+
{"points", points},
144+
{"common", metric.common()},
145+
}));
146+
}
135147
}
136148
points.clear();
137149
}

0 commit comments

Comments
 (0)