Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renaming Meter to Accumulator in Metrics SDK context #1372

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion opentelemetry-instrumentation/tests/test_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
5 changes: 4 additions & 1 deletion opentelemetry-sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +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 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

Expand Down
6 changes: 3 additions & 3 deletions opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -339,7 +339,7 @@ def __init__(
self.aggregator = aggregator


class Meter(metrics_api.Meter):
class Accumulator(metrics_api.Meter):
"""See `opentelemetry.metrics.Meter`.

Args:
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update the description. I believe it's incorrect that any meter from any SDK will work in this architecture.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this more accurate?
accumulator: The meter from the Metrics API used to collect metrics.

exporter: The exporter used to export metrics.
interval: The collect/export interval in seconds.
"""

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()
Expand All @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"""

Expand Down