From 03efcb5911b007b597175db3a4be4be890c18346 Mon Sep 17 00:00:00 2001 From: Lalit Kumar Bhasin Date: Tue, 21 Jan 2025 16:54:56 -0800 Subject: [PATCH] review comments --- sdk/src/metrics/state/temporal_metric_storage.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sdk/src/metrics/state/temporal_metric_storage.cc b/sdk/src/metrics/state/temporal_metric_storage.cc index 68d3d22325..85630ef479 100644 --- a/sdk/src/metrics/state/temporal_metric_storage.cc +++ b/sdk/src/metrics/state/temporal_metric_storage.cc @@ -51,15 +51,15 @@ bool TemporalMetricStorage::buildMetrics(CollectorHandle *collector, AggregationTemporality aggregation_temporarily = collector->GetAggregationTemporality(instrument_descriptor_.type_); + // If no metrics, early return + if (delta_metrics->Size() == 0) + { + return true; + } + // Fast path for single collector with delta temporality and counter, updown-counter, histogram - if (collectors.size() == 1 && collector->GetAggregationTemporality( - instrument_descriptor_.type_) == AggregationTemporality::kDelta) + if (collectors.size() == 1 && aggregation_temporarily == AggregationTemporality::kDelta) { - // If no metrics, early return - if (delta_metrics->Size() == 0) - { - return true; - } // Create MetricData directly MetricData metric_data;