-
Notifications
You must be signed in to change notification settings - Fork 838
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe your environment
opentelemetry-instrumentation-system-metrics==0.49b1
What happened?
The instruments system.network.packets and system.network.io are created if those strings are in the config, but the callbacks look for the wrong key system.network.dropped.packets.
Steps to Reproduce
This script configures each instrument in isolation to find errors like this.
from opentelemetry.instrumentation.system_metrics import (
_DEFAULT_CONFIG,
SystemMetricsInstrumentor,
)
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import InMemoryMetricReader
for k, v in _DEFAULT_CONFIG.items():
meter_provider = MeterProvider([InMemoryMetricReader()])
instrumentor = SystemMetricsInstrumentor(config={k: v})
instrumentor.instrument(meter_provider=meter_provider)
meter_provider.force_flush()
instrumentor.uninstrument()Expected Result
No errors
Actual Result
Callback failed for instrument system.network.packets.
Traceback (most recent call last):
File "/Users/alex/work/logfire/.venv/lib/python3.12/site-packages/opentelemetry/sdk/metrics/_internal/instrument.py", line 136, in callback
for api_measurement in callback(callback_options):
File "/Users/alex/work/logfire/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/system_metrics/__init__.py", line 598, in _get_system_network_packets
for metric in self._config["system.network.dropped.packets"]:
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'system.network.dropped.packets'
Callback failed for instrument system.network.io.
Traceback (most recent call last):
File "/Users/alex/work/logfire/.venv/lib/python3.12/site-packages/opentelemetry/sdk/metrics/_internal/instrument.py", line 136, in callback
for api_measurement in callback(callback_options):
File "/Users/alex/work/logfire/.venv/lib/python3.12/site-packages/opentelemetry/instrumentation/system_metrics/__init__.py", line 629, in _get_system_network_io
for metric in self._config["system.network.dropped.packets"]:
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'system.network.dropped.packets'Additional context
In general the architecture here seems very prone to these kinds of copy-paste mistakes.
Would you like to implement a fix?
No
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working