summaryrefslogtreecommitdiffstats
path: root/collectors
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2021-02-11 12:38:34 +0000
committerGitHub <noreply@github.com>2021-02-11 12:38:34 +0000
commitb7543176283b6e555aab14c131cccb4c54767725 (patch)
treea67331cb92237551249418daf029722fd34a3a8f /collectors
parent420f6c5ac7dfc5a5a7c3e7aa45768093e7812cc4 (diff)
Change eBPF plugin internal (#10442)
Remove unused variables.
Diffstat (limited to 'collectors')
-rw-r--r--collectors/ebpf.plugin/ebpf.c48
-rw-r--r--collectors/ebpf.plugin/ebpf.h19
-rw-r--r--collectors/ebpf.plugin/ebpf_apps.c4
-rw-r--r--collectors/ebpf.plugin/ebpf_apps.h1
-rw-r--r--collectors/ebpf.plugin/ebpf_process.c218
-rw-r--r--collectors/ebpf.plugin/ebpf_process.h37
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.c104
-rw-r--r--collectors/ebpf.plugin/ebpf_socket.h9
8 files changed, 220 insertions, 220 deletions
diff --git a/collectors/ebpf.plugin/ebpf.c b/collectors/ebpf.plugin/ebpf.c
index 56e084e973..26bcfcf179 100644
--- a/collectors/ebpf.plugin/ebpf.c
+++ b/collectors/ebpf.plugin/ebpf.c
@@ -56,6 +56,7 @@ char *ebpf_user_config_dir = CONFIG_DIR;
char *ebpf_stock_config_dir = LIBCONFIG_DIR;
static char *ebpf_configured_log_dir = LOG_DIR;
+char *ebpf_algorithms[] = {"absolute", "incremental"};
int update_every = 1;
static int thread_finished = 0;
int close_ebpf_plugin = 0;
@@ -100,6 +101,19 @@ ebpf_network_viewer_options_t network_viewer_opt;
*****************************************************************/
/**
+ * Cleanup publish syscall
+ *
+ * @param nps list of structures to clean
+ */
+void ebpf_cleanup_publish_syscall(netdata_publish_syscall_t *nps)
+{
+ while (nps) {
+ freez(nps->algorithm);
+ nps = nps->next;
+ }
+}
+
+/**
* Clean port Structure
*
* Clean the allocated list.
@@ -307,17 +321,21 @@ void write_err_chart(char *name, char *family, netdata_publish_syscall_t *move,
/**
* Call the necessary functions to create a chart.
*
+ * @param chart the chart name
* @param family the chart family
- * @param move the pointer with the values that will be published
+ * @param dwrite the dimension name
+ * @param vwrite the value for previous dimension
+ * @param dread the dimension name
+ * @param vread the value for previous dimension
*
* @return It returns a variable tha maps the charts that did not have zero values.
*/
-void write_io_chart(char *chart, char *family, char *dwrite, char *dread, netdata_publish_vfs_common_t *pvc)
+void write_io_chart(char *chart, char *family, char *dwrite, long long vwrite, char *dread, long long vread)
{
write_begin_chart(family, chart);
- write_chart_dimension(dwrite, (long long)pvc->write);
- write_chart_dimension(dread, (long long)pvc->read);
+ write_chart_dimension(dwrite, vwrite);
+ write_chart_dimension(dread, vread);
write_end_chart();
}
@@ -349,12 +367,13 @@ void ebpf_write_chart_cmd(char *type, char *id, char *title, char *units, char *
/**
* Write the dimension command on standard output
*
- * @param n the dimension name
- * @param d the dimension information
+ * @param name the dimension name
+ * @param id the dimension id
+ * @param algo the dimension algorithm
*/
-void ebpf_write_global_dimension(char *n, char *d)
+void ebpf_write_global_dimension(char *name, char *id, char *algorithm)
{
- printf("DIMENSION %s %s absolute 1 1\n", n, d);
+ printf("DIMENSION %s %s %s 1 1\n", name, id, algorithm);
}
/**
@@ -369,7 +388,7 @@ void ebpf_create_global_dimension(void *ptr, int end)
int i = 0;
while (move && i < end) {
- ebpf_write_global_dimension(move->name, move->dimension);
+ ebpf_write_global_dimension(move->name, move->dimension, move->algorithm);
move = move->next;
i++;
@@ -411,16 +430,18 @@ void ebpf_create_chart(char *type,
* @param units the value displayed on vertical axis.
* @param family Submenu that the chart will be attached on dashboard.
* @param order the chart order
+ * @param algorithm the algorithm used by dimension
* @param root structure used to create the dimensions.
*/
-void ebpf_create_charts_on_apps(char *id, char *title, char *units, char *family, int order, struct target *root)
+void ebpf_create_charts_on_apps(char *id, char *title, char *units, char *family, int order,
+ char *algorithm, struct target *root)
{
struct target *w;
ebpf_write_chart_cmd(NETDATA_APPS_FAMILY, id, title, units, family, "stacked", order);
for (w = root; w; w = w->next) {
if (unlikely(w->exposed))
- fprintf(stdout, "DIMENSION %s '' absolute 1 1\n", w->name);
+ fprintf(stdout, "DIMENSION %s '' %s 1 1\n", w->name, algorithm);
}
}
@@ -437,9 +458,11 @@ void ebpf_create_charts_on_apps(char *id, char *title, char *units, char *family
* @param pio structure used to generate charts.
* @param dim a pointer for the dimensions name
* @param name a pointer for the tensor with the name of the functions.
+ * @param algorithm a vector with the algorithms used to make the charts
* @param end the number of elements in the previous 4 arguments.
*/
-void ebpf_global_labels(netdata_syscall_stat_t *is, netdata_publish_syscall_t *pio, char **dim, char **name, int end)
+void ebpf_global_labels(netdata_syscall_stat_t *is, netdata_publish_syscall_t *pio, char **dim,
+ char **name, int *algorithm, int end)
{
int i;
@@ -453,6 +476,7 @@ void ebpf_global_labels(netdata_syscall_stat_t *is, netdata_publish_syscall_t *p
pio[i].dimension = dim[i];
pio[i].name = name[i];
+ pio[i].algorithm = strdupz(ebpf_algorithms[algorithm[i]]);
if (publish_prev) {
publish_prev->next = &pio[i];
}
diff --git a/collectors/ebpf.plugin/ebpf.h b/collectors/ebpf.plugin/ebpf.h
index 1f58229515..35013c2b2e 100644
--- a/collectors/ebpf.plugin/ebpf.h
+++ b/collectors/ebpf.plugin/ebpf.h
@@ -43,6 +43,7 @@ typedef uint64_t netdata_idx_t;
typedef struct netdata_publish_syscall {
char *dimension;
char *name;
+ char *algorithm;
unsigned long nbyte;
unsigned long pbyte;
uint64_t ncall;
@@ -98,6 +99,11 @@ extern ebpf_module_t ebpf_modules[];
#define EBPF_SYS_CLONE_IDX 11
#define EBPF_MAX_MAPS 32
+enum ebpf_algorithms_list {
+ NETDATA_EBPF_ABSOLUTE_IDX,
+ NETDATA_EBPF_INCREMENTAL_IDX
+};
+
// Threads
extern void *ebpf_process_thread(void *ptr);
extern void *ebpf_socket_thread(void *ptr);
@@ -118,6 +124,7 @@ extern void ebpf_global_labels(netdata_syscall_stat_t *is,
netdata_publish_syscall_t *pio,
char **dim,
char **name,
+ int *algorithm,
int end);
extern void ebpf_write_chart_cmd(char *type,
@@ -128,7 +135,7 @@ extern void ebpf_write_chart_cmd(char *type,
char *charttype,
int order);
-extern void ebpf_write_global_dimension(char *n, char *d);
+extern void ebpf_write_global_dimension(char *name, char *id, char *algorithm);
extern void ebpf_create_global_dimension(void *ptr, int end);
@@ -150,7 +157,8 @@ extern void write_count_chart(char *name, char *family, netdata_publish_syscall_
extern void write_err_chart(char *name, char *family, netdata_publish_syscall_t *move, int end);
-extern void write_io_chart(char *chart, char *family, char *dwrite, char *dread, netdata_publish_vfs_common_t *pvc);
+extern void write_io_chart(char *chart, char *family, char *dwrite, long long vwrite,
+ char *dread, long long vread);
extern void fill_ebpf_data(ebpf_data_t *ef);
@@ -159,17 +167,21 @@ extern void ebpf_create_charts_on_apps(char *name,
char *units,
char *family,
int order,
+ char *algorithm,
struct target *root);
extern void write_end_chart();
+extern void ebpf_cleanup_publish_syscall(netdata_publish_syscall_t *nps);
+
#define EBPF_GLOBAL_SECTION "global"
#define EBPF_PROGRAMS_SECTION "ebpf programs"
#define EBPF_NETWORK_VIEWER_SECTION "network connections"
#define EBPF_SERVICE_NAME_SECTION "service name"
#define EBPF_COMMON_DIMENSION_CALL "calls/s"
-#define EBPF_COMMON_DIMENSION_BYTESS "bytes/s"
+#define EBPF_COMMON_DIMENSION_BITS "kilobits/s"
+#define EBPF_COMMON_DIMENSION_BYTES "bytes/s"
#define EBPF_COMMON_DIMENSION_DIFFERENCE "difference"
#define EBPF_COMMON_DIMENSION_PACKETS "packets"
@@ -178,6 +190,7 @@ extern char *ebpf_user_config_dir;
extern char *ebpf_stock_config_dir;
extern int debug_enabled;
extern struct pid_stat *root_of_pids;
+extern char *ebpf_algorithms[];
// Socket functions and variables
// Common functions
diff --git a/collectors/ebpf.plugin/ebpf_apps.c b/collectors/ebpf.plugin/ebpf_apps.c
index 062c9a4e40..844ce23b83 100644
--- a/collectors/ebpf.plugin/ebpf_apps.c
+++ b/collectors/ebpf.plugin/ebpf_apps.c
@@ -931,13 +931,11 @@ void cleanup_exited_pids()
freez(current_apps_data[r]);
current_apps_data[r] = NULL;
- prev_apps_data[r] = NULL;
// Clean socket structures
if (socket_bandwidth_curr) {
freez(socket_bandwidth_curr[r]);
socket_bandwidth_curr[r] = NULL;
- socket_bandwidth_prev[r] = NULL;
}
} else {
if (unlikely(p->keep))
@@ -1055,13 +1053,11 @@ void collect_data_for_all_processes(int tbl_pid_stats_fd)
freez(current_apps_data[key]);
current_apps_data[key] = NULL;
- prev_apps_data[key] = NULL;
// Clean socket structures
if (socket_bandwidth_curr) {
freez(socket_bandwidth_curr[key]);
socket_bandwidth_curr[key] = NULL;
- socket_bandwidth_prev[key] = NULL;
}
pids = pids->next;
diff --git a/collectors/ebpf.plugin/ebpf_apps.h b/collectors/ebpf.plugin/ebpf_apps.h
index 46d36966e9..f8cb7ac725 100644
--- a/collectors/ebpf.plugin/ebpf_apps.h
+++ b/collectors/ebpf.plugin/ebpf_apps.h
@@ -426,6 +426,5 @@ extern void collect_data_for_all_processes(int tbl_pid_stats_fd);
extern ebpf_process_stat_t **global_process_stats;
extern ebpf_process_publish_apps_t **current_apps_data;
-extern ebpf_process_publish_apps_t **prev_apps_data;
#endif /* NETDATA_EBPF_APPS_H */
diff --git a/collectors/ebpf.plugin/ebpf_process.c b/collectors/ebpf.plugin/ebpf_process.c
index 9a1d69c066..27e39d1a5e 100644
--- a/collectors/ebpf.plugin/ebpf_process.c
+++ b/collectors/ebpf.plugin/ebpf_process.c
@@ -11,9 +11,9 @@
*
*****************************************************************/
-static char *process_dimension_names[NETDATA_MAX_MONITOR_VECTOR] = { "open", "close", "delete", "read", "write",
+static char *process_dimension_names[NETDATA_KEY_PUBLISH_PROCESS_END] = { "open", "close", "delete", "read", "write",
"process", "task", "process", "thread" };
-static char *process_id_names[NETDATA_MAX_MONITOR_VECTOR] = { "do_sys_open", "__close_fd", "vfs_unlink",
+static char *process_id_names[NETDATA_KEY_PUBLISH_PROCESS_END] = { "do_sys_open", "__close_fd", "vfs_unlink",
"vfs_read", "vfs_write", "do_exit",
"release_task", "_do_fork", "sys_clone" };
static char *status[] = { "process", "zombie" };
@@ -26,7 +26,6 @@ static ebpf_data_t process_data;
ebpf_process_stat_t **global_process_stats = NULL;
ebpf_process_publish_apps_t **current_apps_data = NULL;
-ebpf_process_publish_apps_t **prev_apps_data = NULL;
int process_enabled = 0;
@@ -51,67 +50,36 @@ static void ebpf_update_global_publish(
netdata_publish_syscall_t *publish, netdata_publish_vfs_common_t *pvc, netdata_syscall_stat_t *input)
{
netdata_publish_syscall_t *move = publish;
+ int selector = NETDATA_KEY_PUBLISH_PROCESS_OPEN;
while (move) {
- if (input->call != move->pcall) {
- //This condition happens to avoid initial values with dimensions higher than normal values.
- if (move->pcall) {
- move->ncall = (input->call > move->pcall) ? input->call - move->pcall : move->pcall - input->call;
- move->nbyte = (input->bytes > move->pbyte) ? input->bytes - move->pbyte : move->pbyte - input->bytes;
- move->nerr = (input->ecall > move->nerr) ? input->ecall - move->perr : move->perr - input->ecall;
- } else {
- move->ncall = 0;
- move->nbyte = 0;
- move->nerr = 0;
- }
+ // Until NETDATA_KEY_PUBLISH_PROCESS_READ we are creating accumulators, so it is possible
+ // to use incremental charts, but after this we will do some math with the values, so we are storing
+ // absolute values
+ if (selector < NETDATA_KEY_PUBLISH_PROCESS_READ) {
+ move->ncall = input->call;
+ move->nbyte = input->bytes;
+ move->nerr = input->ecall;
+ } else {
+ move->ncall = (input->call > move->pcall) ? input->call - move->pcall : move->pcall - input->call;
+ move->nbyte = (input->bytes > move->pbyte) ? input->bytes - move->pbyte : move->pbyte - input->bytes;
+ move->nerr = (input->ecall > move->nerr) ? input->ecall - move->perr : move->perr - input->ecall;
move->pcall = input->call;
move->pbyte = input->bytes;
move->perr = input->ecall;
- } else {
- move->ncall = 0;
- move->nbyte = 0;
- move->nerr = 0;
}
input = input->next;
move = move->next;
+ selector++;
}
- pvc->write = -((long)publish[2].nbyte);
- pvc->read = (long)publish[3].nbyte;
-
- pvc->running = (long)publish[7].ncall - (long)publish[8].ncall;
- publish[6].ncall = -publish[6].ncall; // release
- pvc->zombie = (long)publish[5].ncall + (long)publish[6].ncall;
-}
-
-/**
- * Update apps dimension to publish.
- *
- * @param curr Last values read from memory.
- * @param prev Previous values read from memory.
- * @param first was it allocated now?
- */
-static void
-ebpf_process_update_apps_publish(ebpf_process_publish_apps_t *curr, ebpf_process_publish_apps_t *prev, int first)
-{
- if (first)
- return;
+ pvc->write = -((long)publish[NETDATA_KEY_PUBLISH_PROCESS_WRITE].nbyte);
+ pvc->read = (long)publish[NETDATA_KEY_PUBLISH_PROCESS_READ].nbyte;
- curr->publish_open = curr->call_sys_open - prev->call_sys_open;
- curr->publish_closed = curr->call_close_fd - prev->call_close_fd;
- curr->publish_deleted = curr->call_vfs_unlink - prev->call_vfs_unlink;
- curr->publish_write_call = curr->call_write - prev->call_write;
- curr->publish_write_bytes = curr->bytes_written - prev->bytes_written;
- curr->publish_read_call = curr->call_read - prev->call_read;
- curr->publish_read_bytes = curr->bytes_read - prev->bytes_read;
- curr->publish_process = curr->call_do_fork - prev->call_do_fork;
- curr->publish_thread = curr->call_sys_clone - prev->call_sys_clone;
- curr->publish_task = curr->call_release_task - prev->call_release_task;
- curr->publish_open_error = curr->ecall_sys_open - prev->ecall_sys_open;
- curr->publish_close_error = curr->ecall_close_fd - prev->ecall_close_fd;
- curr->publish_write_error = curr->ecall_write - prev->ecall_write;
- curr->publish_read_error = curr->ecall_read - prev->ecall_read;
+ pvc->running = (long)publish[NETDATA_KEY_PUBLISH_PROCESS_FORK].ncall - (long)publish[NETDATA_KEY_PUBLISH_PROCESS_CLONE].ncall;
+ publish[NETDATA_KEY_PUBLISH_PROCESS_RELEASE_TASK].ncall = -publish[NETDATA_KEY_PUBLISH_PROCESS_RELEASE_TASK].ncall;
+ pvc->zombie = (long)publish[NETDATA_KEY_PUBLISH_PROCESS_EXIT].ncall + (long)publish[NETDATA_KEY_PUBLISH_PROCESS_RELEASE_TASK].ncall;
}
/**
@@ -164,7 +132,9 @@ static void ebpf_process_send_data(ebpf_module_t *em)
NETDATA_PROCESS_ERROR_NAME, NETDATA_EBPF_FAMILY, &process_publish_aggregated[NETDATA_PROCESS_START], 2);
}
- write_io_chart(NETDATA_VFS_IO_FILE_BYTES, NETDATA_EBPF_FAMILY, process_id_names[3], process_id_names[4], &pvc);
+ write_io_chart(NETDATA_VFS_IO_FILE_BYTES, NETDATA_EBPF_FAMILY,
+ process_id_names[NETDATA_KEY_PUBLISH_PROCESS_WRITE], (long long) pvc.write,
+ process_id_names[NETDATA_KEY_PUBLISH_PROCESS_READ], (long long)pvc.read);
}
/**
@@ -230,7 +200,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN);
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
- value = ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_open));
+ value = ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, call_sys_open));
write_chart_dimension(w->name, value);
}
}
@@ -241,7 +211,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_open_error));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, ecall_sys_open));
write_chart_dimension(w->name, value);
}
}
@@ -252,7 +222,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value =
- ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_closed));
+ ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, call_close_fd));
write_chart_dimension(w->name, value);
}
}
@@ -263,7 +233,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_close_error));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, ecall_close_fd));
write_chart_dimension(w->name, value);
}
}
@@ -274,7 +244,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value =
- ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_deleted));
+ ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, call_vfs_unlink));
write_chart_dimension(w->name, value);
}
}
@@ -284,7 +254,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_write_call));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, call_write));
write_chart_dimension(w->name, value);
}
}
@@ -295,7 +265,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_write_error));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, ecall_write));
write_chart_dimension(w->name, value);
}
}
@@ -306,7 +276,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value =
- ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_read_call));
+ ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, call_read));
write_chart_dimension(w->name, value);
}
}
@@ -317,7 +287,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_read_error));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, ecall_read));
write_chart_dimension(w->name, value);
}
}
@@ -328,7 +298,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_write_bytes));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, bytes_written));
write_chart_dimension(w->name, value);
}
}
@@ -338,7 +308,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value = ebpf_process_sum_values_for_pids(
- w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_read_bytes));
+ w->root_pid, offsetof(ebpf_process_publish_apps_t, bytes_read));
write_chart_dimension(w->name, value);
}
}
@@ -348,7 +318,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value =
- ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_process));
+ ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, call_do_fork));
write_chart_dimension(w->name, value);
}
}
@@ -358,7 +328,7 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
value =
- ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_thread));
+ ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, call_sys_clone));
write_chart_dimension(w->name, value);
}
}
@@ -367,7 +337,8 @@ void ebpf_process_send_apps_data(ebpf_module_t *em, struct target *root)
write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_SYSCALL_APPS_TASK_CLOSE);
for (w = root; w; w = w->next) {
if (unlikely(w->exposed && w->processes)) {
- value = ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t, publish_task));
+ value = ebpf_process_sum_values_for_pids(w->root_pid, offsetof(ebpf_process_publish_apps_t,
+ call_release_task));
write_chart_dimension(w->name, value);
}
}
@@ -405,27 +376,27 @@ static void read_hash_global_tables()
}
}
- process_aggregated_data[0].call = res[NETDATA_KEY_CALLS_DO_SYS_OPEN];
- process_aggregated_data[1].call = res[NETDATA_KEY_CALLS_CLOSE_FD];
- process_aggregated_data[2].call = res[NETDATA_KEY_CALLS_VFS_UNLINK];
- process_aggregated_data[3].call = res[NETDATA_KEY_CALLS_VFS_READ] + res[NETDATA_KEY_CALLS_VFS_READV];
- process_aggregated_data[4].call = res[NETDATA_KEY_CALLS_VFS_WRITE] + res[NETDATA_KEY_CALLS_VFS_WRITEV];
- process_aggregated_data[5].call = res[NETDATA_KEY_CALLS_DO_EXIT];
- process_aggregated_data[6].call = res[NETDATA_KEY_CALLS_RELEASE_TASK];
- process_aggregated_data[7].call = res[NETDATA_KEY_CALLS_DO_FORK];
- process_aggregated_data[8].call = res[NETDATA_KEY_CALLS_SYS_CLONE];
-
- process_aggregated_data[0].ecall = res[NETDATA_KEY_ERROR_DO_SYS_OPEN];
- process_aggregated_data[1].ecall = res[NETDATA_KEY_ERROR_CLOSE_FD];
- process_aggregated_data[2].ecall = res[NETDATA_KEY_ERROR_VFS_UNLINK];
- process_aggregated_data[3].ecall = res[NETDATA_KEY_ERROR_VFS_READ] + res[NETDATA_KEY_ERROR_VFS_READV];
- process_aggregated_data[4].ecall = res[NETDATA_KEY_ERROR_VFS_WRITE] + res[NETDATA_KEY_ERROR_VFS_WRITEV];
- process_aggregated_data[7].ecall = res[NETDATA_KEY_ERROR_DO_FORK];
- process_aggregated_data[8].ecall = res[NETDATA_KEY_ERROR_SYS_CLONE];
-
- process_aggregated_data[2].bytes = (uint64_t)res[NETDATA_KEY_BYTES_VFS_WRITE] +
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_OPEN].call = res[NETDATA_KEY_CALLS_DO_SYS_OPEN];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_CLOSE].call = res[NETDATA_KEY_CALLS_CLOSE_FD];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_UNLINK].call = res[NETDATA_KEY_CALLS_VFS_UNLINK];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_READ].call = res[NETDATA_KEY_CALLS_VFS_READ] + res[NETDATA_KEY_CALLS_VFS_READV];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_WRITE].call = res[NETDATA_KEY_CALLS_VFS_WRITE] + res[NETDATA_KEY_CALLS_VFS_WRITEV];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_EXIT].call = res[NETDATA_KEY_CALLS_DO_EXIT];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_RELEASE_TASK].call = res[NETDATA_KEY_CALLS_RELEASE_TASK];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_FORK].call = res[NETDATA_KEY_CALLS_DO_FORK];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_CLONE].call = res[NETDATA_KEY_CALLS_SYS_CLONE];
+
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_OPEN].ecall = res[NETDATA_KEY_ERROR_DO_SYS_OPEN];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_CLOSE].ecall = res[NETDATA_KEY_ERROR_CLOSE_FD];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_UNLINK].ecall = res[NETDATA_KEY_ERROR_VFS_UNLINK];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_READ].ecall = res[NETDATA_KEY_ERROR_VFS_READ] + res[NETDATA_KEY_ERROR_VFS_READV];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_WRITE].ecall = res[NETDATA_KEY_ERROR_VFS_WRITE] + res[NETDATA_KEY_ERROR_VFS_WRITEV];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_FORK].ecall = res[NETDATA_KEY_ERROR_DO_FORK];
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_CLONE].ecall = res[NETDATA_KEY_ERROR_SYS_CLONE];
+
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_WRITE].bytes = (uint64_t)res[NETDATA_KEY_BYTES_VFS_WRITE] +
(uint64_t)res[NETDATA_KEY_BYTES_VFS_WRITEV];
- process_aggregated_data[3].bytes = (uint64_t)res[NETDATA_KEY_BYTES_VFS_READ] +
+ process_aggregated_data[NETDATA_KEY_PUBLISH_PROCESS_READ].bytes = (uint64_t)res[NETDATA_KEY_BYTES_VFS_READ] +
(uint64_t)res[NETDATA_KEY_BYTES_VFS_READV];
}
@@ -444,18 +415,9 @@ static void ebpf_process_update_apps_data()
}
ebpf_process_publish_apps_t *cad = current_apps_data[current_pid];
- ebpf_process_publish_apps_t *pad = prev_apps_data[current_pid];
- int lstatus;
if (!cad) {
- ebpf_process_publish_apps_t *ptr = callocz(2, sizeof(ebpf_process_publish_apps_t));
- cad = &ptr[0];
+ cad = callocz(1, sizeof(ebpf_process_publish_apps_t));
current_apps_data[current_pid] = cad;
- pad = &ptr[1];
- prev_apps_data[current_pid] = pad;
- lstatus = 1;
- } else {
- memcpy(pad, cad, sizeof(ebpf_process_publish_apps_t));
- lstatus = 0;
}
//Read data
@@ -480,8 +442,6 @@ static void ebpf_process_update_apps_data()
cad->bytes_written = (uint64_t)ps->write_bytes + (uint64_t)ps->write_bytes;
cad->bytes_read = (uint64_t)ps->read_bytes + (uint64_t)ps->readv_bytes;
- ebpf_process_update_apps_publish(cad, pad, lstatus);
-
pids = pids->next;
}
}
@@ -500,8 +460,9 @@ static void ebpf_process_update_apps_data()
* @param axis the axis label
* @param web the group name used to attach the chart on dashaboard
* @param order the order number of the specified chart
+ * @param algorithm the algorithm used to make the charts.
*/
-static void ebpf_create_io_chart(char *family, char *name, char *axis, char *web, int order)
+static void ebpf_create_io_chart(char *family, char *name, char *axis, char *web, int order, int algorithm)
{
printf("CHART %s.%s '' 'Bytes written and read' '%s' '%s' '' line %d %d\n",
family,
@@ -511,8 +472,14 @@ static void ebpf_create_io_chart(char *family, char *name, char *axis, char *web
order,
update_every);
- printf("DIMENSION %s %s absolute 1 1\n", process_id_names[3], NETDATA_VFS_DIM_OUT_FILE_BYTES);
- printf("DIMENSION %s %s absolute 1 1\n", process_id_names[4], NETDATA_VFS_DIM_IN_FILE_BYTES);
+ printf("DIMENSION %s %s %s 1 1\n",
+ process_id_names[NETDATA_KEY_PUBLISH_PROCESS_READ],
+ process_dimension_names[NETDATA_KEY_PUBLISH_PROCESS_READ],
+ ebpf_algorithms[algorithm]);
+ printf("DIMENSION %s %s %s 1 1\n",
+ process_id_names[NETDATA_KEY_PUBLISH_PROCESS_WRITE],
+ process_dimension_names[NETDATA_KEY_PUBLISH_PROCESS_WRITE],
+ ebpf_algorithms[algorithm]);
}
/**
@@ -524,7 +491,8 @@ static void ebpf_create_io_chart(char *family, char *name, char *axis, char *web
* @param web the group name used to attach the chart on dashaboard
* @param order the order number of the specified chart
*/
-static void ebpf_process_status_chart(char *family, char *name, char *axis, char *web, int order)
+static void ebpf_process_status_chart(char *family, char *name, char *axis,
+ char *web, char *algorithm, int order)
{
printf("CHART %s.%s '' 'Process not closed' '%s' '%s' '' line %d %d ''\n",
family,
@@ -534,8 +502,8 @@ static void ebpf_process_status_chart(char *family, char *name, char *axis, char
order,
update_every);
- printf("DIMENSION %s '' absolute 1 1\n", status[0]);
- printf("DIMENSION %s '' absolute 1 1\n", status[1]);
+ printf("DIMENSION %s '' %s 1 1\n", status[0], algorithm);
+ printf("DIMENSION %s '' %s 1 1\n", status[1], algorithm);
}
/**
@@ -590,10 +558,10 @@ static void ebpf_create_global_charts(ebpf_module_t *em)
2);
ebpf_create_io_chart(NETDATA_EBPF_FAMILY,
- NETDATA_VFS_IO_FILE_BYTES,
- EBPF_COMMON_DIMENSION_BYTESS,
+ NETDATA_VFS_IO_FILE_BYTES, EBPF_COMMON_DIMENSION_BYTES,
NETDATA_VFS_GROUP,
- 21004);
+ 21004,
+ NETDATA_EBPF_ABSOLUTE_IDX);
if (em->mode < MODE_ENTRY) {
ebpf_create_chart(NETDATA_EBPF_FAMILY,
@@ -631,6 +599,7 @@ static void ebpf_create_global_charts(ebpf_module_t *em)
NETDATA_PROCESS_STATUS_NAME,
EBPF_COMMON_DIMENSION_DIFFERENCE,
NETDATA_PROCESS_GROUP,
+ ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX],
21008);
if (em->mode < MODE_ENTRY) {
@@ -661,6 +630,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_GROUP,
20061,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
if (em->mode < MODE_ENTRY) {
@@ -669,6 +639,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_GROUP,
20062,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
}
@@ -677,6 +648,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_GROUP,
20063,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
if (em->mode < MODE_ENTRY) {
@@ -685,6 +657,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_GROUP,
20064,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
}
@@ -693,6 +666,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_VFS_GROUP,
20065,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
ebpf_create_charts_on_apps(NETDATA_SYSCALL_APPS_VFS_WRITE_CALLS,
@@ -700,6 +674,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_VFS_GROUP,
20066,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
apps_groups_root_target);
if (em->mode < MODE_ENTRY) {
@@ -708,6 +683,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_VFS_GROUP,
20067,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
}
@@ -716,6 +692,7 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_VFS_GROUP,
20068,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
if (em->mode < MODE_ENTRY) {
@@ -724,21 +701,22 @@ static void ebpf_process_create_apps_charts(ebpf_module_t *em, struct target *ro
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_VFS_GROUP,
20069,
+ ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
root);
}
ebpf_create_charts_on_apps(NETDATA_SYSCALL_APPS_VFS_WRITE_BYTES,
- "Bytes written on disk",