Skip to content

Commit

Permalink
Fix callbacks in system metrics instrumentation (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzchen authored Apr 15, 2022
1 parent abdd25f commit 3690006
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'release/*'
pull_request:
env:
CORE_REPO_SHA: f81381cf8aca64a707d934f20c6c27d40b949dce
CORE_REPO_SHA: d52b80124ac0c9ea9515a1d90dfec37c532f8cd9

jobs:
build:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,83 +156,83 @@ def _instrument(self, **kwargs):
)

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",
)

# 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,
# )

# 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",
)
Expand Down Expand Up @@ -260,57 +260,57 @@ def _instrument(self, **kwargs):
# 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",
)
Expand Down

0 comments on commit 3690006

Please sign in to comment.