File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,11 @@ void TracerTelemetry::capture_metrics() {
9393 clock_ ().wall .time_since_epoch ())
9494 .count ();
9595 for (auto & m : metrics_snapshots_) {
96- m.second .emplace_back (timepoint, m.first .get ().value ());
96+ auto value = m.first .get ().value ();
97+ if (value == 0 ) {
98+ continue ;
99+ }
100+ m.second .emplace_back (timepoint, value);
97101 }
98102
99103 for (auto & m : metrics_snapshots_) {
@@ -118,14 +122,18 @@ std::string TracerTelemetry::heartbeat_and_telemetry() {
118122 for (auto & m : metrics_snapshots_) {
119123 auto & metric = m.first .get ();
120124 auto & points = m.second ;
125+ if (points.empty ()) {
126+ continue ;
127+ }
128+
121129 metrics.emplace_back (nlohmann::json::object ({
122130 {" metric" , metric.name ()},
131+ {" tags" , metric.tags ()},
123132 {" type" , metric.type ()},
124133 {" interval" , 60 },
125134 {" points" , points},
126135 {" common" , metric.common ()},
127136 }));
128- m.second .clear ();
129137 }
130138
131139 auto generate_metrics = nlohmann::json::object ({
You can’t perform that action at this time.
0 commit comments