diff --git a/opentelemetry-sdk/CHANGELOG.md b/opentelemetry-sdk/CHANGELOG.md index 47ae86852a0..55d4e01d3cb 100644 --- a/opentelemetry-sdk/CHANGELOG.md +++ b/opentelemetry-sdk/CHANGELOG.md @@ -8,6 +8,7 @@ ([#1314](https://github.com/open-telemetry/opentelemetry-python/pull/1314)) - Update exception handling optional parameters, add escaped attribute to record_exception ([#1365](https://github.com/open-telemetry/opentelemetry-python/pull/1365)) +- Rename Record in Metrics SDK to Accumulation ([#1373](https://github.com/open-telemetry/opentelemetry-python/pull/1373)) ## Version 0.15b0 diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py index 8207aa57553..5e6f9f0f6c0 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py @@ -325,7 +325,7 @@ class ValueObserver(Observer, metrics_api.ValueObserver): """See `opentelemetry.metrics.ValueObserver`.""" -class Record: +class Accumulation: """Container class used for processing in the `Processor`""" def __init__( @@ -382,10 +382,10 @@ def _collect_metrics(self) -> None: bound_instrument, ) in metric.bound_instruments.items(): for view_data in bound_instrument.view_datas: - record = Record( + accumulation = Accumulation( metric, view_data.labels, view_data.aggregator ) - self.processor.process(record) + self.processor.process(accumulation) if bound_instrument.ref_count() == 0: to_remove.append(labels) @@ -404,8 +404,8 @@ def _collect_observers(self) -> None: continue for labels, aggregator in observer.aggregators.items(): - record = Record(observer, labels, aggregator) - self.processor.process(record) + accumulation = Accumulation(observer, labels, aggregator) + self.processor.process(accumulation) def record_batch( self, diff --git a/opentelemetry-sdk/tests/metrics/export/test_export.py b/opentelemetry-sdk/tests/metrics/export/test_export.py index 635409770d1..632570a09df 100644 --- a/opentelemetry-sdk/tests/metrics/export/test_export.py +++ b/opentelemetry-sdk/tests/metrics/export/test_export.py @@ -139,8 +139,8 @@ def test_processor_process_exists(self): _batch_map[batch_key] = aggregator aggregator2.update(1.0) processor._batch_map = _batch_map - record = metrics.Record(metric, labels, aggregator2) - processor.process(record) + accumulation = metrics.Accumulation(metric, labels, aggregator2) + processor.process(accumulation) self.assertEqual(len(processor._batch_map), 1) self.assertIsNotNone(processor._batch_map.get(batch_key)) self.assertEqual(processor._batch_map.get(batch_key).current, 0) @@ -159,8 +159,8 @@ def test_processor_process_not_exists(self): batch_key = (metric, SumAggregator, tuple(), labels) aggregator.update(1.0) processor._batch_map = _batch_map - record = metrics.Record(metric, labels, aggregator) - processor.process(record) + accumulation = metrics.Accumulation(metric, labels, aggregator) + processor.process(accumulation) self.assertEqual(len(processor._batch_map), 1) self.assertIsNotNone(processor._batch_map.get(batch_key)) self.assertEqual(processor._batch_map.get(batch_key).current, 0) @@ -182,8 +182,8 @@ def test_processor_process_not_stateful(self): batch_key = (metric, SumAggregator, tuple(), labels) aggregator.update(1.0) processor._batch_map = _batch_map - record = metrics.Record(metric, labels, aggregator) - processor.process(record) + accumulation = metrics.Accumulation(metric, labels, aggregator) + processor.process(accumulation) self.assertEqual(len(processor._batch_map), 1) self.assertIsNotNone(processor._batch_map.get(batch_key)) self.assertEqual(processor._batch_map.get(batch_key).current, 0)