From cd4ccab1841347102b412bdc209a74133b766cea Mon Sep 17 00:00:00 2001 From: Diego Hurtado Date: Wed, 28 Sep 2022 13:57:42 +0100 Subject: [PATCH] Update default explicit bucket histogram boundaries (#2952) --- CHANGELOG.md | 5 ++++- .../sdk/metrics/_internal/aggregation.py | 10 +++++++++ .../tests/metrics/test_aggregation.py | 22 +++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 605a68ed0bb..ea4f873b37d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased](/~https://github.com/open-telemetry/opentelemetry-python/compare/v1.13.0-0.34b0...HEAD) -## [1.13.0-0.34b0](/~https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.13.0-0.34b0) - 2022-09-26 +- Update explicit histogram bucket boundaries + ([#2947](/~https://github.com/open-telemetry/opentelemetry-python/pull/2947)) + +## [1.13.0-0.34b0](/~https://github.com/open-telemetry/opentelemetry-python/releases/tag/v1.13.0) - 2022-09-26 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py index d7d825c9c5a..4fb9041d4c6 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/_internal/aggregation.py @@ -227,7 +227,12 @@ def __init__( 100.0, 250.0, 500.0, + 750.0, 1000.0, + 2500.0, + 5000.0, + 7500.0, + 10000.0, ), record_min_max: bool = True, ): @@ -454,7 +459,12 @@ def __init__( 100.0, 250.0, 500.0, + 750.0, 1000.0, + 2500.0, + 5000.0, + 7500.0, + 10000.0, ), record_min_max: bool = True, ) -> None: diff --git a/opentelemetry-sdk/tests/metrics/test_aggregation.py b/opentelemetry-sdk/tests/metrics/test_aggregation.py index 5acf701b18c..9c9de1f2cbb 100644 --- a/opentelemetry-sdk/tests/metrics/test_aggregation.py +++ b/opentelemetry-sdk/tests/metrics/test_aggregation.py @@ -378,6 +378,28 @@ def test_collect(self): second_histogram.time_unix_nano, first_histogram.time_unix_nano ) + def test_boundaries(self): + self.assertEqual( + _ExplicitBucketHistogramAggregation(Mock(), 0)._boundaries, + ( + 0.0, + 5.0, + 10.0, + 25.0, + 50.0, + 75.0, + 100.0, + 250.0, + 500.0, + 750.0, + 1000.0, + 2500.0, + 5000.0, + 7500.0, + 10000.0, + ), + ) + class TestAggregationFactory(TestCase): def test_sum_factory(self):