From 65f11002b738823985276df0e447debb614fe6b3 Mon Sep 17 00:00:00 2001 From: Azfaar Qureshi Date: Mon, 9 Nov 2020 17:30:16 -0500 Subject: [PATCH 1/3] renaming meter to accumulator in metrics sdk context and fixing usages in tests --- opentelemetry-instrumentation/tests/test_metric.py | 2 +- .../src/opentelemetry/sdk/metrics/__init__.py | 6 +++--- .../opentelemetry/sdk/metrics/export/controller.py | 12 ++++++------ .../opentelemetry/sdk/metrics/export/processor.py | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/opentelemetry-instrumentation/tests/test_metric.py b/opentelemetry-instrumentation/tests/test_metric.py index 14c39d85e09..8e676c737e2 100644 --- a/opentelemetry-instrumentation/tests/test_metric.py +++ b/opentelemetry-instrumentation/tests/test_metric.py @@ -41,7 +41,7 @@ def test_init(self): mixin = MetricMixin() mixin.init_metrics("test", 1.0) meter = mixin.meter - self.assertTrue(isinstance(meter, metrics.Meter)) + self.assertTrue(isinstance(meter, metrics.Accumulator)) self.assertEqual(meter.instrumentation_info.name, "test") self.assertEqual(meter.instrumentation_info.version, 1.0) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py index 5e6f9f0f6c0..a2d16719a82 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py @@ -145,7 +145,7 @@ def __init__( description: str, unit: str, value_type: Type[metrics_api.ValueT], - meter: "Meter", + meter: "Accumulator", enabled: bool = True, ): self.name = name @@ -339,7 +339,7 @@ def __init__( self.aggregator = aggregator -class Meter(metrics_api.Meter): +class Accumulator(metrics_api.Meter): """See `opentelemetry.metrics.Meter`. Args: @@ -561,7 +561,7 @@ def get_meter( if not instrumenting_module_name: # Reject empty strings too. instrumenting_module_name = "ERROR:MISSING MODULE NAME" logger.error("get_meter called with missing module name.") - return Meter( + return Accumulator( self, InstrumentationInfo( instrumenting_module_name, instrumenting_library_version diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py index e095ebbb72c..7c69468e617 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/controller.py @@ -26,7 +26,7 @@ class PushController(threading.Thread): exports them and performs some post-processing. Args: - meter: The meter used to collect metrics. + accumulator: The meter used to collect metrics. exporter: The exporter used to export metrics. interval: The collect/export interval in seconds. """ @@ -34,10 +34,10 @@ class PushController(threading.Thread): daemon = True def __init__( - self, meter: Meter, exporter: MetricsExporter, interval: float + self, accumulator: Meter, exporter: MetricsExporter, interval: float ): super().__init__() - self.meter = meter + self.accumulator = accumulator self.exporter = exporter self.interval = interval self.finished = threading.Event() @@ -54,10 +54,10 @@ def shutdown(self): def tick(self): # Collect all of the meter's metrics to be exported - self.meter.collect() + self.accumulator.collect() # Export the collected metrics token = attach(set_value("suppress_instrumentation", True)) - self.exporter.export(self.meter.processor.checkpoint_set()) + self.exporter.export(self.accumulator.processor.checkpoint_set()) detach(token) # Perform post-exporting logic - self.meter.processor.finished_collection() + self.accumulator.processor.finished_collection() diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/processor.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/processor.py index 765c94e2c5e..5575ce1666c 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/processor.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/export/processor.py @@ -23,7 +23,7 @@ class Processor: """Base class for all processor types. The processor is responsible for storing the aggregators and aggregated - values received from updates from metrics in the meter. The stored values + values received from updates from metrics in the accumulator. The stored values will be sent to an exporter for exporting. """ From 86038f4885b99caea55d09de5176bb97d6ba3d91 Mon Sep 17 00:00:00 2001 From: Azfaar Qureshi Date: Thu, 12 Nov 2020 11:46:22 -0500 Subject: [PATCH 2/3] adding changes to CHANGELOG --- opentelemetry-sdk/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/opentelemetry-sdk/CHANGELOG.md b/opentelemetry-sdk/CHANGELOG.md index 55d4e01d3cb..f787e4cdd58 100644 --- a/opentelemetry-sdk/CHANGELOG.md +++ b/opentelemetry-sdk/CHANGELOG.md @@ -9,6 +9,7 @@ - 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)) +- Rename Meter class to Accumulator in Metrics SDK ([#1372](https://github.com/open-telemetry/opentelemetry-python/pull/1372)) ## Version 0.15b0 From 54b8ab4d19e348b0d65d7ce7716105d1474be036 Mon Sep 17 00:00:00 2001 From: Azfaar Qureshi Date: Tue, 17 Nov 2020 10:40:51 -0500 Subject: [PATCH 3/3] fixing lint for changelog --- opentelemetry-sdk/CHANGELOG.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opentelemetry-sdk/CHANGELOG.md b/opentelemetry-sdk/CHANGELOG.md index f787e4cdd58..851073bcd51 100644 --- a/opentelemetry-sdk/CHANGELOG.md +++ b/opentelemetry-sdk/CHANGELOG.md @@ -8,8 +8,10 @@ ([#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)) -- Rename Meter class to Accumulator in Metrics SDK ([#1372](https://github.com/open-telemetry/opentelemetry-python/pull/1372)) +- Rename Record in Metrics SDK to Accumulation + ([#1373](https://github.com/open-telemetry/opentelemetry-python/pull/1373)) +- Rename Meter class to Accumulator in Metrics SDK + ([#1372](https://github.com/open-telemetry/opentelemetry-python/pull/1372)) ## Version 0.15b0