From 14403c0fd28721e2d9f6e2570aa758926411fb4e Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Wed, 2 Feb 2022 15:55:01 -0800 Subject: [PATCH] add sum to OTLP histogram Follow up to #2429. Fixes #2430 --- .../exporter/otlp/proto/grpc/_metric_exporter/__init__.py | 1 + .../tests/metrics/test_otlp_metrics_exporter.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_metric_exporter/__init__.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_metric_exporter/__init__.py index df48a15a7bd..92aba2958c2 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_metric_exporter/__init__.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/_metric_exporter/__init__.py @@ -137,6 +137,7 @@ def _translate_data( time_unix_nano=metric.point.time_unix_nano, start_time_unix_nano=metric.point.start_time_unix_nano, count=sum(metric.point.bucket_counts), + sum=metric.point.sum, bucket_counts=metric.point.bucket_counts, explicit_bounds=metric.point.explicit_bounds, ) diff --git a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/metrics/test_otlp_metrics_exporter.py b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/metrics/test_otlp_metrics_exporter.py index 2446138de46..9c00ee43408 100644 --- a/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/metrics/test_otlp_metrics_exporter.py +++ b/exporter/opentelemetry-exporter-otlp-proto-grpc/tests/metrics/test_otlp_metrics_exporter.py @@ -162,6 +162,7 @@ def setUp(self): time_unix_nano=1641946016139533244, start_time_unix_nano=1641946016139533244, bucket_counts=[1, 4], + sum=67, explicit_bounds=[10.0, 20.0], aggregation_temporality=AggregationTemporality.DELTA, ), @@ -588,6 +589,7 @@ def test_translate_histogram(self): start_time_unix_nano=1641946016139533244, time_unix_nano=1641946016139533244, count=5, + sum=67, bucket_counts=[1, 4], explicit_bounds=[10.0, 20.0], exemplars=[],