mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 04:23:54 +01:00
Split callback metric lambda functions down onto their own lines to keep line lengths under 90
This commit is contained in:
parent
1071c7d963
commit
b01aaadd48
1 changed files with 16 additions and 8 deletions
|
@ -133,29 +133,36 @@ def register_process_collector():
|
||||||
|
|
||||||
if HAVE_PROC_SELF_STAT:
|
if HAVE_PROC_SELF_STAT:
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"cpu_user_seconds_total", lambda: float(stats["utime"]) / TICKS_PER_SEC
|
"cpu_user_seconds_total",
|
||||||
|
lambda: float(stats["utime"]) / TICKS_PER_SEC
|
||||||
)
|
)
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"cpu_system_seconds_total", lambda: float(stats["stime"]) / TICKS_PER_SEC
|
"cpu_system_seconds_total",
|
||||||
|
lambda: float(stats["stime"]) / TICKS_PER_SEC
|
||||||
)
|
)
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"cpu_seconds_total", lambda: (float(stats["utime"] + stats["stime"])) / TICKS_PER_SEC
|
"cpu_seconds_total",
|
||||||
|
lambda: (float(stats["utime"] + stats["stime"])) / TICKS_PER_SEC
|
||||||
)
|
)
|
||||||
|
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"virtual_memory_bytes", lambda: int(stats["vsize"])
|
"virtual_memory_bytes",
|
||||||
|
lambda: int(stats["vsize"])
|
||||||
)
|
)
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"resident_memory_bytes", lambda: int(stats["rss"]) * BYTES_PER_PAGE
|
"resident_memory_bytes",
|
||||||
|
lambda: int(stats["rss"]) * BYTES_PER_PAGE
|
||||||
)
|
)
|
||||||
|
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"start_time_seconds", lambda: boot_time + int(stats["starttime"]) / TICKS_PER_SEC
|
"start_time_seconds",
|
||||||
|
lambda: boot_time + int(stats["starttime"]) / TICKS_PER_SEC
|
||||||
)
|
)
|
||||||
|
|
||||||
if HAVE_PROC_SELF_FD:
|
if HAVE_PROC_SELF_FD:
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"open_fds", lambda: sum(fd_counts.values())
|
"open_fds",
|
||||||
|
lambda: sum(fd_counts.values())
|
||||||
)
|
)
|
||||||
|
|
||||||
if HAVE_PROC_SELF_LIMITS:
|
if HAVE_PROC_SELF_LIMITS:
|
||||||
|
@ -169,5 +176,6 @@ def register_process_collector():
|
||||||
return None
|
return None
|
||||||
|
|
||||||
process_metrics.register_callback(
|
process_metrics.register_callback(
|
||||||
"max_fds", lambda: _get_max_fds()
|
"max_fds",
|
||||||
|
lambda: _get_max_fds()
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue