Skip to content

Commit f7c934f

Browse files
committed
Changes requested by external reviewer
Co-authored-by: Suryanarayana Peri <[email protected]> Signed-off-by: Rahul Kumar <[email protected]>
1 parent 9eb44c6 commit f7c934f

File tree

1 file changed

+12
-10
lines changed
  • instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics

1 file changed

+12
-10
lines changed

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

+12-10
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
from opentelemetry.metrics import CallbackOptions, Observation, get_meter
9393
from opentelemetry.sdk.util import get_dict_as_key
9494

95-
logger = logging.getLogger(__name__)
95+
_logger = logging.getLogger(__name__)
9696

9797

9898
_DEFAULT_CONFIG = {
@@ -355,16 +355,18 @@ def _instrument(self, **kwargs):
355355
unit="seconds",
356356
)
357357

358-
if "process.runtime.gc_count" in self._config and self._python_implementation != "pypy":
359-
logger.warning(
360-
"The process.runtime.gc_count metric won't be collected because the interpreter is PyPy"
358+
if "process.runtime.gc_count" in self._config:
359+
if self._python_implementation == "pypy":
360+
_logger.warning(
361+
"The process.runtime.gc_count metric won't be collected because the interpreter is PyPy"
362+
)
363+
else:
364+
self._meter.create_observable_counter(
365+
name=f"process.runtime.{self._python_implementation}.gc_count",
366+
callbacks=[self._get_runtime_gc_count],
367+
description=f"Runtime {self._python_implementation} GC count",
368+
unit="bytes",
361369
)
362-
self._meter.create_observable_counter(
363-
name=f"process.runtime.{self._python_implementation}.gc_count",
364-
callbacks=[self._get_runtime_gc_count],
365-
description=f"Runtime {self._python_implementation} GC count",
366-
unit="bytes",
367-
)
368370

369371

370372
if "process.runtime.thread_count" in self._config:

0 commit comments

Comments
 (0)