Skip to content

Commit 10b8f75

Browse files
committed
Fixes to gather metrics from processes with some metrics unavailable (due an execution within a container instance)
1 parent 1099a06 commit 10b8f75

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

treecript/collector.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def analyse_list_of_processes(
103103
"name",
104104
"cmdline",
105105
"cpu_times",
106+
"memory_info",
106107
"memory_full_info",
107108
"io_counters",
108109
"net_connections",
@@ -120,8 +121,8 @@ def analyse_list_of_processes(
120121
# The process suddenly disappeared
121122
if (
122123
child_d["cpu_times"] is not None
123-
and child_d["memory_full_info"] is not None
124124
and child_d["cmdline"] is not None
125+
and child_d["memory_info"] is not None
125126
):
126127
threads_processor_num: "Set[int]" = set()
127128
threads_core_num: "Set[str]" = set()
@@ -530,7 +531,12 @@ def process_metrics_collector(
530531
)
531532

532533
c_cpu = child_d["cpu_times"]
533-
c_mem = c_full_mem = child_d["memory_full_info"]
534+
c_full_mem = child_d["memory_full_info"]
535+
c_mem = child_d["memory_info"]
536+
if c_full_mem is None:
537+
c_full_mem = c_mem
538+
else:
539+
c_mem = c_full_mem
534540
c_io = child_d["io_counters"]
535541
c_conn = child_d["net_connections"]
536542
# The process suddenly disappeared

0 commit comments

Comments
 (0)