Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f751396

Browse files
author
Alex Boten
committedApr 4, 2022
update name to SystemMetricsInstrumentor
1 parent 32687f8 commit f751396

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed
 

‎instrumentation/opentelemetry-instrumentation-system-metrics/setup.cfg

+4
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,7 @@ test =
5050

5151
[options.packages.find]
5252
where = src
53+
54+
[options.entry_points]
55+
opentelemetry_instrumentor =
56+
system_metrics = opentelemetry.instrumentation.system_metrics:SystemMetricsInstrumentor

‎instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@
4343
.. code:: python
4444
4545
from opentelemetry._metrics import set_meter_provider
46-
from opentelemetry.instrumentation.system_metrics import SystemMetrics
46+
from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor
4747
from opentelemetry.sdk._metrics import MeterProvider
4848
from opentelemetry.sdk._metrics.export import ConsoleMetricExporter, PeriodicExportingMetricReader
4949
5050
exporter = ConsoleMetricExporter()
5151
5252
set_meter_provider(MeterProvider(PeriodicExportingMetricReader(exporter)))
53-
SystemMetrics()
53+
SystemMetricsInstrumentor().instrument()
5454
5555
# metrics are collected asynchronously
5656
input("...")
@@ -63,7 +63,7 @@
6363
"runtime.memory": ["rss", "vms"],
6464
"runtime.cpu.time": ["user", "system"],
6565
}
66-
SystemMetrics(config=configuration)
66+
SystemMetricsInstrumentor(config=configuration).instrument()
6767
6868
API
6969
---
@@ -86,7 +86,7 @@
8686
from opentelemetry.sdk.util import get_dict_as_key
8787

8888

89-
class SystemMetrics(BaseInstrumentor):
89+
class SystemMetricsInstrumentor(BaseInstrumentor):
9090
# pylint: disable=too-many-statements
9191
def __init__(
9292
self,

‎instrumentation/opentelemetry-instrumentation-system-metrics/tests/test_system_metrics.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
from opentelemetry._metrics import get_meter_provider
2222
from opentelemetry._metrics.measurement import Measurement
23-
from opentelemetry.instrumentation.system_metrics import SystemMetrics
23+
from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor
2424
from opentelemetry.sdk._metrics import MeterProvider
2525
from opentelemetry.sdk._metrics.export import InMemoryMetricReader
2626
from opentelemetry.test.test_base import TestBase
@@ -59,12 +59,12 @@ def setUp(self):
5959
def tearDown(self):
6060
super().tearDown()
6161
self._patch_net_connections.stop()
62-
SystemMetrics().uninstrument()
62+
SystemMetricsInstrumentor().uninstrument()
6363

6464
def test_system_metrics_instrument(self):
6565
reader = InMemoryMetricReader()
6666
meter_provider = MeterProvider(metric_readers=[reader])
67-
system_metrics = SystemMetrics()
67+
system_metrics = SystemMetricsInstrumentor()
6868
system_metrics.instrument(meter_provider=meter_provider)
6969
metrics = reader.get_metrics()
7070
metric_names = list({x.name for x in metrics })
@@ -117,7 +117,7 @@ def _test_metrics(self, observer_name, expected):
117117
reader = InMemoryMetricReader()
118118
meter_provider = MeterProvider(metric_readers=[reader])
119119

120-
system_metrics = SystemMetrics()
120+
system_metrics = SystemMetricsInstrumentor()
121121
system_metrics.instrument(meter_provider=meter_provider)
122122
self._assert_metrics(observer_name, reader, expected)
123123
system_metrics.uninstrument()

0 commit comments

Comments
 (0)
Please sign in to comment.