gala-gopher/some-bugfix.patch
Zhen Chen 4a36a5936f sync bugfix patches from openeuler/gala-gopher
- fix ksliprobe get invalid args occasionally at startup
- fix error print when starting gala-gopher
- add system_uuid field to distinguish client when post to pyroscope server
- repair stackprobe caused cpu rush
- add support to pyroscope
- bugfix: add check if thread is 0
- fix stackprobe memory allocation and deallocation errors
- normalize time format in flamegraph svg filename

(cherry picked from commit 6aef5cc8e4e2a34324c3f01663d2b61c0462f4ac)
2023-01-17 22:29:44 +08:00

59 lines
3.0 KiB
Diff

From 0b1750325993ec3af54aee27a63cb0ecbf625c6f Mon Sep 17 00:00:00 2001
From: dowzyx <zhaoyuxing2@huawei.com>
Date: Wed, 28 Dec 2022 09:49:32 +0800
Subject: [PATCH] some bugfix
---
src/probes/extends/ebpf.probe/build.sh | 2 +-
.../ebpf.probe/src/taskprobe/taskprobe.c | 4 +--
.../cadvisor.probe/cadvisor_probe.py | 5 +++-
5 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/src/probes/extends/ebpf.probe/build.sh b/src/probes/extends/ebpf.probe/build.sh
index 4094ed5..eb15fb4 100755
--- a/src/probes/extends/ebpf.probe/build.sh
+++ b/src/probes/extends/ebpf.probe/build.sh
@@ -81,7 +81,7 @@ function compile_probe()
echo "please create vmlinux.h manually."
echo "methods:"
echo " 1. generate linux_xxx.h by compile the kernel, refer to gen_vmlinux_h.sh;"
- echo " 2. ln -s vmlinux.h linux_xxx.h, (there are some include files in directory src/include)"
+ echo " 2. ln -s linux_xxx.h vmlinux.h, (there are some include files in directory src/include)"
echo " if your kernel version is similar to the include files provided, you can use method 2"
echo "=========================================================================================="
exit
diff --git a/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c b/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c
index dfa24d3..ec67d10 100644
--- a/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c
+++ b/src/probes/extends/ebpf.probe/src/taskprobe/taskprobe.c
@@ -105,8 +105,8 @@ static void get_wl_proc(struct task_probe_s* probep)
char comm[TASK_COMM_LEN];
char cmdline[PROC_CMDLINE_LEN];
char command[COMMAND_LEN];
- const char *get_comm_fmt = "/usr/bin/cat /proc/%u/comm";
- const char *get_cmdline_fmt = "/usr/bin/cat /proc/%u/cmdline";
+ const char *get_comm_fmt = "/usr/bin/cat /proc/%u/comm 2>/dev/null";
+ const char *get_cmdline_fmt = "/usr/bin/cat /proc/%u/cmdline 2>/dev/null";
dir = opendir("/proc");
if (dir == NULL) {
diff --git a/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py b/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py
index 8b12aac..bbca1b7 100644
--- a/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py
+++ b/src/probes/extends/python.probe/cadvisor.probe/cadvisor_probe.py
@@ -360,7 +360,10 @@ def print_metrics():
value = ""
else:
if field_type == COUNTER:
- value = str(record[field_name][1] - record[field_name][0])
+ if record[field_name][1] > record[field_name][0]:
+ value = str(record[field_name][1] - record[field_name][0])
+ else:
+ value = "0"
record[field_name][0] = record[field_name][1]
else:
value = record[field_name]
--
2.33.0