Skip to content

Commit ce00441

Browse files
committed
Add min max fields to Histogram
Fixes #2582
1 parent 6e282d2 commit ce00441

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

exporter/opentelemetry-exporter-otlp-proto-grpc/src/opentelemetry/exporter/otlp/proto/grpc/metric_exporter/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ def _translate_data(
146146
sum=data_point.sum,
147147
bucket_counts=data_point.bucket_counts,
148148
explicit_bounds=data_point.explicit_bounds,
149+
max=data_point.max,
150+
min=data_point.min,
149151
)
150152
pb2_metric.histogram.aggregation_temporality = (
151153
metric.data.aggregation_temporality

exporter/opentelemetry-exporter-otlp-proto-grpc/tests/metrics/test_otlp_metrics_exporter.py

+11
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,8 @@ def test_translate_histogram(self):
720720
explicit_bounds=[10.0, 20.0],
721721
exemplars=[],
722722
flags=pb2.DataPointFlags.FLAG_NONE,
723+
max=18.0,
724+
min=8.0,
723725
)
724726
],
725727
aggregation_temporality=AggregationTemporality.DELTA,
@@ -736,6 +738,7 @@ def test_translate_histogram(self):
736738
self.assertEqual(expected, actual)
737739

738740
def test_translate_multiple_scope_histogram(self):
741+
self.maxDiff = None
739742
expected = ExportMetricsServiceRequest(
740743
resource_metrics=[
741744
pb2.ResourceMetrics(
@@ -782,6 +785,8 @@ def test_translate_multiple_scope_histogram(self):
782785
explicit_bounds=[10.0, 20.0],
783786
exemplars=[],
784787
flags=pb2.DataPointFlags.FLAG_NONE,
788+
max=18.0,
789+
min=8.0,
785790
)
786791
],
787792
aggregation_temporality=AggregationTemporality.DELTA,
@@ -816,6 +821,8 @@ def test_translate_multiple_scope_histogram(self):
816821
explicit_bounds=[10.0, 20.0],
817822
exemplars=[],
818823
flags=pb2.DataPointFlags.FLAG_NONE,
824+
max=18.0,
825+
min=8.0,
819826
)
820827
],
821828
aggregation_temporality=AggregationTemporality.DELTA,
@@ -857,6 +864,8 @@ def test_translate_multiple_scope_histogram(self):
857864
explicit_bounds=[10.0, 20.0],
858865
exemplars=[],
859866
flags=pb2.DataPointFlags.FLAG_NONE,
867+
max=18.0,
868+
min=8.0,
860869
)
861870
],
862871
aggregation_temporality=AggregationTemporality.DELTA,
@@ -898,6 +907,8 @@ def test_translate_multiple_scope_histogram(self):
898907
explicit_bounds=[10.0, 20.0],
899908
exemplars=[],
900909
flags=pb2.DataPointFlags.FLAG_NONE,
910+
max=18.0,
911+
min=8.0,
901912
)
902913
],
903914
aggregation_temporality=AggregationTemporality.DELTA,

0 commit comments

Comments
 (0)