From f078af17bf85240214b5bb491b516f75ba41fdaa Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Fri, 8 Sep 2023 12:03:13 +0200 Subject: [PATCH] Revert "WIP" This reverts commit db737921d32ea1f38c7426fa8de4ec6fcadc5e28. --- .../opentelemetry/sdk/metrics/_internal/aggregation.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py index ea48aa70239..ae21db907dd 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py @@ -288,13 +288,11 @@ def collect( """ Atomically return a point for the current value of the metric. """ - with self._lock: + if not any(self._bucket_counts): + return None - bucket_counts = [ - bucket_count for bucket_count in self._bucket_counts - ] - + bucket_counts = self._bucket_counts start_time_unix_nano = self._start_time_unix_nano sum_ = self._sum max_ = self._max