From ca7a3fab278e8c8222b3a46d6e2e52af9dd5462f Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Tue, 14 Jun 2022 02:12:02 +0100 Subject: [PATCH] Add min max fields to Histogram (#2759) --- CHANGELOG.md | 2 ++ .../otlp/proto/grpc/metric_exporter/__init__.py | 2 ++ .../tests/metrics/test_otlp_metrics_exporter.py | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d449a57e2c..cfc30d5886a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](https://github.com/open-telemetry/opentelemetry-python/compare/v1.12.0rc1-0.31b0...HEAD) +- Add min/max fields to Histogram + ([#2759](https://github.com/open-telemetry/opentelemetry-python/pull/2759)) - `opentelemetry-exporter-otlp-proto-http` Add support for OTLP/HTTP log exporter ([#2462](https://github.com/open-telemetry/opentelemetry-python/pull/2462)) - Fix yield of `None`-valued points 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 83846da81fc..c5f4acad06c 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 @@ -146,6 +146,8 @@ def _translate_data( sum=data_point.sum, bucket_counts=data_point.bucket_counts, explicit_bounds=data_point.explicit_bounds, + max=data_point.max, + min=data_point.min, ) pb2_metric.histogram.aggregation_temporality = ( metric.data.aggregation_temporality 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 0d4418030ba..8936272bef0 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 @@ -720,6 +720,8 @@ def test_translate_histogram(self): explicit_bounds=[10.0, 20.0], exemplars=[], flags=pb2.DataPointFlags.FLAG_NONE, + max=18.0, + min=8.0, ) ], aggregation_temporality=AggregationTemporality.DELTA, @@ -782,6 +784,8 @@ def test_translate_multiple_scope_histogram(self): explicit_bounds=[10.0, 20.0], exemplars=[], flags=pb2.DataPointFlags.FLAG_NONE, + max=18.0, + min=8.0, ) ], aggregation_temporality=AggregationTemporality.DELTA, @@ -816,6 +820,8 @@ def test_translate_multiple_scope_histogram(self): explicit_bounds=[10.0, 20.0], exemplars=[], flags=pb2.DataPointFlags.FLAG_NONE, + max=18.0, + min=8.0, ) ], aggregation_temporality=AggregationTemporality.DELTA, @@ -857,6 +863,8 @@ def test_translate_multiple_scope_histogram(self): explicit_bounds=[10.0, 20.0], exemplars=[], flags=pb2.DataPointFlags.FLAG_NONE, + max=18.0, + min=8.0, ) ], aggregation_temporality=AggregationTemporality.DELTA, @@ -898,6 +906,8 @@ def test_translate_multiple_scope_histogram(self): explicit_bounds=[10.0, 20.0], exemplars=[], flags=pb2.DataPointFlags.FLAG_NONE, + max=18.0, + min=8.0, ) ], aggregation_temporality=AggregationTemporality.DELTA,