Skip to content

Commit 3690006

Browse files
authored
Fix callbacks in system metrics instrumentation (#1057)
1 parent abdd25f commit 3690006

File tree

2 files changed

+20
-20
lines changed
  • .github/workflows
  • instrumentation/opentelemetry-instrumentation-system-metrics/src/opentelemetry/instrumentation/system_metrics

2 files changed

+20
-20
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
- 'release/*'
77
pull_request:
88
env:
9-
CORE_REPO_SHA: f81381cf8aca64a707d934f20c6c27d40b949dce
9+
CORE_REPO_SHA: d52b80124ac0c9ea9515a1d90dfec37c532f8cd9
1010

1111
jobs:
1212
build:

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

+19-19
Original file line numberDiff line numberDiff line change
@@ -156,83 +156,83 @@ def _instrument(self, **kwargs):
156156
)
157157

158158
self._meter.create_observable_counter(
159-
callback=self._get_system_cpu_time,
160159
name="system.cpu.time",
160+
callbacks=[self._get_system_cpu_time],
161161
description="System CPU time",
162162
unit="seconds",
163163
)
164164

165165
self._meter.create_observable_gauge(
166-
callback=self._get_system_cpu_utilization,
167166
name="system.cpu.utilization",
167+
callbacks=[self._get_system_cpu_utilization],
168168
description="System CPU utilization",
169169
unit="1",
170170
)
171171

172172
self._meter.create_observable_gauge(
173-
callback=self._get_system_memory_usage,
174173
name="system.memory.usage",
174+
callbacks=[self._get_system_memory_usage],
175175
description="System memory usage",
176176
unit="bytes",
177177
)
178178

179179
self._meter.create_observable_gauge(
180-
callback=self._get_system_memory_utilization,
181180
name="system.memory.utilization",
181+
callbacks=[self._get_system_memory_utilization],
182182
description="System memory utilization",
183183
unit="1",
184184
)
185185

186186
self._meter.create_observable_gauge(
187-
callback=self._get_system_swap_usage,
188187
name="system.swap.usage",
188+
callbacks=[self._get_system_swap_usage],
189189
description="System swap usage",
190190
unit="pages",
191191
)
192192

193193
self._meter.create_observable_gauge(
194-
callback=self._get_system_swap_utilization,
195194
name="system.swap.utilization",
195+
callbacks=[self._get_system_swap_utilization],
196196
description="System swap utilization",
197197
unit="1",
198198
)
199199

200200
# TODO Add _get_system_swap_page_faults
201201

202202
# self._meter.create_observable_counter(
203-
# callback=self._get_system_swap_page_faults,
204203
# name="system.swap.page_faults",
204+
# callbacks=[self._get_system_swap_page_faults],
205205
# description="System swap page faults",
206206
# unit="faults",
207207
# value_type=int,
208208
# )
209209

210210
# TODO Add _get_system_swap_page_operations
211211
# self._meter.create_observable_counter(
212-
# callback=self._get_system_swap_page_operations,
213212
# name="system.swap.page_operations",
213+
# callbacks=self._get_system_swap_page_operations,
214214
# description="System swap page operations",
215215
# unit="operations",
216216
# value_type=int,
217217
# )
218218

219219
self._meter.create_observable_counter(
220-
callback=self._get_system_disk_io,
221220
name="system.disk.io",
221+
callbacks=[self._get_system_disk_io],
222222
description="System disk IO",
223223
unit="bytes",
224224
)
225225

226226
self._meter.create_observable_counter(
227-
callback=self._get_system_disk_operations,
228227
name="system.disk.operations",
228+
callbacks=[self._get_system_disk_operations],
229229
description="System disk operations",
230230
unit="operations",
231231
)
232232

233233
self._meter.create_observable_counter(
234-
callback=self._get_system_disk_time,
235234
name="system.disk.time",
235+
callbacks=[self._get_system_disk_time],
236236
description="System disk time",
237237
unit="seconds",
238238
)
@@ -260,57 +260,57 @@ def _instrument(self, **kwargs):
260260
# OSs, how to do the same in Windows?
261261

262262
self._meter.create_observable_counter(
263-
callback=self._get_system_network_dropped_packets,
264263
name="system.network.dropped_packets",
264+
callbacks=[self._get_system_network_dropped_packets],
265265
description="System network dropped_packets",
266266
unit="packets",
267267
)
268268

269269
self._meter.create_observable_counter(
270-
callback=self._get_system_network_packets,
271270
name="system.network.packets",
271+
callbacks=[self._get_system_network_packets],
272272
description="System network packets",
273273
unit="packets",
274274
)
275275

276276
self._meter.create_observable_counter(
277-
callback=self._get_system_network_errors,
278277
name="system.network.errors",
278+
callbacks=[self._get_system_network_errors],
279279
description="System network errors",
280280
unit="errors",
281281
)
282282

283283
self._meter.create_observable_counter(
284-
callback=self._get_system_network_io,
285284
name="system.network.io",
285+
callbacks=[self._get_system_network_io],
286286
description="System network io",
287287
unit="bytes",
288288
)
289289

290290
self._meter.create_observable_up_down_counter(
291-
callback=self._get_system_network_connections,
292291
name="system.network.connections",
292+
callbacks=[self._get_system_network_connections],
293293
description="System network connections",
294294
unit="connections",
295295
)
296296

297297
self._meter.create_observable_counter(
298-
callback=self._get_runtime_memory,
299298
name=f"runtime.{self._python_implementation}.memory",
299+
callbacks=[self._get_runtime_memory],
300300
description=f"Runtime {self._python_implementation} memory",
301301
unit="bytes",
302302
)
303303

304304
self._meter.create_observable_counter(
305-
callback=self._get_runtime_cpu_time,
306305
name=f"runtime.{self._python_implementation}.cpu_time",
306+
callbacks=[self._get_runtime_cpu_time],
307307
description=f"Runtime {self._python_implementation} CPU time",
308308
unit="seconds",
309309
)
310310

311311
self._meter.create_observable_counter(
312-
callback=self._get_runtime_gc_count,
313312
name=f"runtime.{self._python_implementation}.gc_count",
313+
callbacks=[self._get_runtime_gc_count],
314314
description=f"Runtime {self._python_implementation} GC count",
315315
unit="bytes",
316316
)

0 commit comments

Comments
 (0)