Skip to content

Commit 7a46aef

Browse files
committed
Move mean calculation to where it's used
1 parent bd06767 commit 7a46aef

File tree

1 file changed

+3
-3
lines changed
  • opentelemetry-exporter-gcp-monitoring/src/opentelemetry/exporter/cloud_monitoring

1 file changed

+3
-3
lines changed

opentelemetry-exporter-gcp-monitoring/src/opentelemetry/exporter/cloud_monitoring/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ def _to_point(
286286
)
287287
elif isinstance(data_point, ExponentialHistogramDataPoint):
288288
# Adapted from https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/v1.8.0/exporter/collector/metrics.go#L582
289-
mean = (
290-
data_point.sum / data_point.count if data_point.count else 0.0
291-
)
292289

293290
# Calculate underflow bucket (zero count + negative buckets)
294291
underflow = data_point.zero_count
@@ -325,6 +322,9 @@ def _to_point(
325322
)
326323
)
327324

325+
mean = (
326+
data_point.sum / data_point.count if data_point.count else 0.0
327+
)
328328
point_value = TypedValue(
329329
distribution_value=Distribution(
330330
count=data_point.count,

0 commit comments

Comments
 (0)