File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 9292from opentelemetry .metrics import CallbackOptions , Observation , get_meter
9393from 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 :
You can’t perform that action at this time.
0 commit comments