Registry /
observability / opentelemetry-instrumentation-system-metrics
Install & Compatibility
Where this runs
tested against v0.65b0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.532s · 24.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.0s · import 0.454s · 25MB
23MB installed
● package 23MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SystemMetricsInstrumentor
✓ from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor
MeterProvider
✓ from opentelemetry.sdk.metrics import MeterProvider
PeriodicExportingMetricReader
✓ from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
ConsoleMetricExporter
✓ from opentelemetry.sdk.metrics.export import ConsoleMetricExporter
set_meter_provider
✓ from opentelemetry.sdk.metrics import set_meter_provider
This quickstart demonstrates how to set up the OpenTelemetry SDK with a `MeterProvider` and a `ConsoleMetricExporter` to print collected metrics to the console. It then instruments system metrics using `SystemMetricsInstrumentor().instrument()`, which starts collecting CPU, memory, disk, and network metrics asynchronously.
import time
from opentelemetry.sdk.metrics import MeterProvider, set_meter_provider
from opentelemetry.sdk.metrics.export import ConsoleMetricExporter, PeriodicExportingMetricReader
from opentelemetry.instrumentation.system_metrics import SystemMetricsInstrumentor
# Configure MeterProvider
exporter = ConsoleMetricExporter()
reader = PeriodicExportingMetricReader(exporter, export_interval_millis=1000)
set_meter_provider(MeterProvider([reader]))
# Instrument system metrics
SystemMetricsInstrumentor().instrument()
print("Collecting system metrics... Press Ctrl+C to exit.")
try:
while True:
time.sleep(5) # Metrics are collected asynchronously
except KeyboardInterrupt:
print("Exiting.")
Debug
Known issues
deprecatedOut-of-spec `process.runtime` prefixed metrics are deprecated and will be removed in future versions. Users are encouraged to migrate to standard process metrics.fixReview your metric consumers for usage of `process.runtime.*` metrics and update to the recommended standard process metrics. Refer to OpenTelemetry semantic conventions for current metric names.
affects: All versions up to 0.61b0
gotchaThe instrumentation library is still in beta, indicating that its API and collected telemetry might undergo breaking changes in future releases as the OpenTelemetry specification evolves.fixMonitor release notes of `opentelemetry-python-contrib` for breaking changes and adjust your code and configurations accordingly. Consider pinning to specific minor versions for stability.
affects: All beta versions (e.x., <1.0.0)
gotchaSpecific system and process metrics can be excluded from collection using the `OTEL_PYTHON_SYSTEM_METRICS_EXCLUDED_METRICS` environment variable. This is useful for reducing telemetry cardinality or focusing on specific metrics.fixSet the `OTEL_PYTHON_SYSTEM_METRICS_EXCLUDED_METRICS` environment variable with a comma-separated list of glob patterns matching metric names to exclude (e.g., `export OTEL_PYTHON_SYSTEM_METRICS_EXCLUDED_METRICS="system.cpu.*,process.memory.usage"`).
affects: All versions
gotchaIn versions prior to `v0.48b0`, the `process.runtime.cpu.utilization` metric might report values outside the expected range of 0 to 1.fixUpgrade to `opentelemetry-instrumentation-system-metrics` version `0.48b0` or newer to ensure `process.runtime.cpu.utilization` values are correctly normalized to the 0-1 range.
affects: <0.48b0
Upgrade
Version history
0.65b0latest on PyPI · released Jul 16, 2026
Audit
Dependencies
opentelemetry-apirequiredCore OpenTelemetry API for defining telemetry.
opentelemetry-sdkrequiredOpenTelemetry SDK for processing and exporting telemetry.
psutilrequiredRequired for collecting system and process metrics.