Fix callbacks in system metrics instrumentation (#1057)

This commit is contained in:
Leighton Chen
2022-04-15 13:55:52 -07:00
committed by GitHub
parent abdd25f644
commit 3690006954
2 changed files with 20 additions and 20 deletions

View File

@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: f81381cf8aca64a707d934f20c6c27d40b949dce
CORE_REPO_SHA: d52b80124ac0c9ea9515a1d90dfec37c532f8cd9
jobs:
build:

View File

@ -156,43 +156,43 @@ class SystemMetricsInstrumentor(BaseInstrumentor):
)
self._meter.create_observable_counter(
callback=self._get_system_cpu_time,
name="system.cpu.time",
callbacks=[self._get_system_cpu_time],
description="System CPU time",
unit="seconds",
)
self._meter.create_observable_gauge(
callback=self._get_system_cpu_utilization,
name="system.cpu.utilization",
callbacks=[self._get_system_cpu_utilization],
description="System CPU utilization",
unit="1",
)
self._meter.create_observable_gauge(
callback=self._get_system_memory_usage,
name="system.memory.usage",
callbacks=[self._get_system_memory_usage],
description="System memory usage",
unit="bytes",
)
self._meter.create_observable_gauge(
callback=self._get_system_memory_utilization,
name="system.memory.utilization",
callbacks=[self._get_system_memory_utilization],
description="System memory utilization",
unit="1",
)
self._meter.create_observable_gauge(
callback=self._get_system_swap_usage,
name="system.swap.usage",
callbacks=[self._get_system_swap_usage],
description="System swap usage",
unit="pages",
)
self._meter.create_observable_gauge(
callback=self._get_system_swap_utilization,
name="system.swap.utilization",
callbacks=[self._get_system_swap_utilization],
description="System swap utilization",
unit="1",
)
@ -200,8 +200,8 @@ class SystemMetricsInstrumentor(BaseInstrumentor):
# TODO Add _get_system_swap_page_faults
# self._meter.create_observable_counter(
# callback=self._get_system_swap_page_faults,
# name="system.swap.page_faults",
# callbacks=[self._get_system_swap_page_faults],
# description="System swap page faults",
# unit="faults",
# value_type=int,
@ -209,30 +209,30 @@ class SystemMetricsInstrumentor(BaseInstrumentor):
# TODO Add _get_system_swap_page_operations
# self._meter.create_observable_counter(
# callback=self._get_system_swap_page_operations,
# name="system.swap.page_operations",
# callbacks=self._get_system_swap_page_operations,
# description="System swap page operations",
# unit="operations",
# value_type=int,
# )
self._meter.create_observable_counter(
callback=self._get_system_disk_io,
name="system.disk.io",
callbacks=[self._get_system_disk_io],
description="System disk IO",
unit="bytes",
)
self._meter.create_observable_counter(
callback=self._get_system_disk_operations,
name="system.disk.operations",
callbacks=[self._get_system_disk_operations],
description="System disk operations",
unit="operations",
)
self._meter.create_observable_counter(
callback=self._get_system_disk_time,
name="system.disk.time",
callbacks=[self._get_system_disk_time],
description="System disk time",
unit="seconds",
)
@ -260,57 +260,57 @@ class SystemMetricsInstrumentor(BaseInstrumentor):
# OSs, how to do the same in Windows?
self._meter.create_observable_counter(
callback=self._get_system_network_dropped_packets,
name="system.network.dropped_packets",
callbacks=[self._get_system_network_dropped_packets],
description="System network dropped_packets",
unit="packets",
)
self._meter.create_observable_counter(
callback=self._get_system_network_packets,
name="system.network.packets",
callbacks=[self._get_system_network_packets],
description="System network packets",
unit="packets",
)
self._meter.create_observable_counter(
callback=self._get_system_network_errors,
name="system.network.errors",
callbacks=[self._get_system_network_errors],
description="System network errors",
unit="errors",
)
self._meter.create_observable_counter(
callback=self._get_system_network_io,
name="system.network.io",
callbacks=[self._get_system_network_io],
description="System network io",
unit="bytes",
)
self._meter.create_observable_up_down_counter(
callback=self._get_system_network_connections,
name="system.network.connections",
callbacks=[self._get_system_network_connections],
description="System network connections",
unit="connections",
)
self._meter.create_observable_counter(
callback=self._get_runtime_memory,
name=f"runtime.{self._python_implementation}.memory",
callbacks=[self._get_runtime_memory],
description=f"Runtime {self._python_implementation} memory",
unit="bytes",
)
self._meter.create_observable_counter(
callback=self._get_runtime_cpu_time,
name=f"runtime.{self._python_implementation}.cpu_time",
callbacks=[self._get_runtime_cpu_time],
description=f"Runtime {self._python_implementation} CPU time",
unit="seconds",
)
self._meter.create_observable_counter(
callback=self._get_runtime_gc_count,
name=f"runtime.{self._python_implementation}.gc_count",
callbacks=[self._get_runtime_gc_count],
description=f"Runtime {self._python_implementation} GC count",
unit="bytes",
)