Skip to content

Commit

Permalink
metrics exporter: don't produce metrics with no [new] data points
Browse files Browse the repository at this point in the history
  • Loading branch information
ays7 committed May 17, 2023
1 parent 1735fb5 commit 5ed4c6c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sdk/src/metrics/state/temporal_metric_storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector,
// Generate the MetricData from the final merged_metrics, and invoke callback over it.

AttributesHashMap *result_to_export = (last_reported_metrics_[collector]).attributes_map.get();
if (!result_to_export->Size ())
{
// no unreported new data points, return.
return true;
}

MetricData metric_data;
metric_data.instrument_descriptor = instrument_descriptor_;
metric_data.aggregation_temporality = aggregation_temporarily;
Expand Down

0 comments on commit 5ed4c6c

Please sign in to comment.