File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
instrumentation/opentelemetry-instrumentation-system-metrics
src/opentelemetry/instrumentation/system_metrics Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -397,7 +397,10 @@ def _instrument(self, **kwargs):
397397 unit = "switches" ,
398398 )
399399
400- if "process.open_file_descriptor.count" in self ._config :
400+ if (
401+ sys .platform != "win32"
402+ and "process.open_file_descriptor.count" in self ._config
403+ ):
401404 self ._meter .create_observable_up_down_counter (
402405 name = "process.open_file_descriptor.count" ,
403406 callbacks = [self ._get_open_file_descriptors ],
Original file line number Diff line number Diff line change 1414
1515# pylint: disable=protected-access
1616
17+ import sys
1718from collections import namedtuple
1819from platform import python_implementation
1920from unittest import mock , skipIf
@@ -118,16 +119,20 @@ def test_system_metrics_instrument(self):
118119 f"process.runtime.{ self .implementation } .thread_count" ,
119120 f"process.runtime.{ self .implementation } .context_switches" ,
120121 f"process.runtime.{ self .implementation } .cpu.utilization" ,
121- "process.open_file_descriptor.count" ,
122122 ]
123123
124+ on_windows = sys .platform == "win32"
124125 if self .implementation == "pypy" :
125- self .assertEqual (len (metric_names ), 21 )
126+ self .assertEqual (len (metric_names ), 21 if on_windows else 20 )
126127 else :
127- self .assertEqual (len (metric_names ), 22 )
128+ self .assertEqual (len (metric_names ), 22 if on_windows else 21 )
128129 observer_names .append (
129130 f"process.runtime.{ self .implementation } .gc_count" ,
130131 )
132+ if not on_windows :
133+ observer_names .append (
134+ "process.open_file_descriptor.count" ,
135+ )
131136
132137 for observer in metric_names :
133138 self .assertIn (observer , observer_names )
You can’t perform that action at this time.
0 commit comments