From c68d0ae0c19131fb714068d518cd0451065ad883 Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:22:45 -0500 Subject: [PATCH 1/2] Don't collect system.network.connections due to limitation in psutil causing exceptions --- .../opentelemetry/instrumentation/system_metrics/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py index 3d6a0c6775..91247570f8 100644 --- a/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py +++ b/instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics/__init__.py @@ -77,6 +77,7 @@ import gc import os +import sys import threading from platform import python_implementation from typing import Collection, Dict, Iterable, List, Optional @@ -115,6 +116,10 @@ "process.runtime.context_switches": ["involuntary", "voluntary"], } +if sys.platform == "darwin": + # see https://github.com/giampaolo/psutil/issues/1219 + _DEFAULT_CONFIG.pop("system.network.connections") + class SystemMetricsInstrumentor(BaseInstrumentor): def __init__( From 20ceb98ab075a1b727ed837afd278911edad9b1a Mon Sep 17 00:00:00 2001 From: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com> Date: Wed, 18 Oct 2023 12:26:22 -0500 Subject: [PATCH 2/2] add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2923ebc791..48109a101d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ([#1980](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1980)) - `opentelemetry-resource-detector-azure` Using new Cloud Resource ID attribute. ([#1976](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/1976)) +- Do not collect `system.network.connections` by default on macOS which was causing exceptions in metrics collection. + ([#2008](https://github.com/open-telemetry/opentelemetry-python-contrib/pull/2008)) ## Version 1.20.0/0.41b0 (2023-09-01)