summaryrefslogtreecommitdiffstats
path: root/collectors/ebpf.plugin/ebpf_fd.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /collectors/ebpf.plugin/ebpf_fd.c
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_fd.c')
-rw-r--r--collectors/ebpf.plugin/ebpf_fd.c290
1 files changed, 163 insertions, 127 deletions
diff --git a/collectors/ebpf.plugin/ebpf_fd.c b/collectors/ebpf.plugin/ebpf_fd.c
index 49c19ca7..3c8f30d3 100644
--- a/collectors/ebpf.plugin/ebpf_fd.c
+++ b/collectors/ebpf.plugin/ebpf_fd.c
@@ -386,45 +386,49 @@ static void ebpf_obsolete_fd_services(ebpf_module_t *em)
{
ebpf_write_chart_obsolete(NETDATA_SERVICE_FAMILY,
NETDATA_SYSCALL_APPS_FILE_OPEN,
+ "",
"Number of open files",
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_CGROUP_GROUP,
NETDATA_EBPF_CHART_TYPE_STACKED,
NETDATA_CGROUP_FD_OPEN_CONTEXT,
- 20061,
+ 20270,
em->update_every);
if (em->mode < MODE_ENTRY) {
ebpf_write_chart_obsolete(NETDATA_SERVICE_FAMILY,
NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR,
+ "",
"Fails to open files",
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_CGROUP_GROUP,
NETDATA_EBPF_CHART_TYPE_STACKED,
NETDATA_CGROUP_FD_OPEN_ERR_CONTEXT,
- 20062,
+ 20271,
em->update_every);
}
ebpf_write_chart_obsolete(NETDATA_SERVICE_FAMILY,
NETDATA_SYSCALL_APPS_FILE_CLOSED,
+ "",
"Files closed",
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_CGROUP_GROUP,
NETDATA_EBPF_CHART_TYPE_STACKED,
NETDATA_CGROUP_FD_CLOSE_CONTEXT,
- 20063,
+ 20272,
em->update_every);
if (em->mode < MODE_ENTRY) {
ebpf_write_chart_obsolete(NETDATA_SERVICE_FAMILY,
NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR,
+ "",
"Fails to close files",
EBPF_COMMON_DIMENSION_CALL,
NETDATA_APPS_FILE_CGROUP_GROUP,
NETDATA_EBPF_CHART_TYPE_STACKED,
NETDATA_CGROUP_FD_CLOSE_ERR_CONTEXT,
- 20064,
+ 20273,
em->update_every);
}
}
@@ -460,48 +464,60 @@ static inline void ebpf_obsolete_fd_cgroup_charts(ebpf_module_t *em) {
*/
void ebpf_obsolete_fd_apps_charts(struct ebpf_module *em)
{
- ebpf_write_chart_obsolete(NETDATA_APPS_FAMILY,
- NETDATA_SYSCALL_APPS_FILE_OPEN,
- "Number of open files",
- EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
- NETDATA_EBPF_CHART_TYPE_STACKED,
- NULL,
- 20061,
- em->update_every);
+ struct ebpf_target *w;
+ int update_every = em->update_every;
+ for (w = apps_groups_root_target; w; w = w->next) {
+ if (unlikely(!(w->charts_created & (1<<EBPF_MODULE_FD_IDX))))
+ continue;
- if (em->mode < MODE_ENTRY) {
- ebpf_write_chart_obsolete(NETDATA_APPS_FAMILY,
- NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR,
- "Fails to open files",
+ ebpf_write_chart_obsolete(NETDATA_APP_FAMILY,
+ w->clean_name,
+ "_ebpf_file_open",
+ "Number of open files",
EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
+ NETDATA_APPS_FILE_FDS,
NETDATA_EBPF_CHART_TYPE_STACKED,
- NULL,
- 20062,
- em->update_every);
- }
-
- ebpf_write_chart_obsolete(NETDATA_APPS_FAMILY,
- NETDATA_SYSCALL_APPS_FILE_CLOSED,
- "Files closed",
- EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
- NETDATA_EBPF_CHART_TYPE_STACKED,
- NULL,
- 20063,
- em->update_every);
+ "app.ebpf_file_open",
+ 20220,
+ update_every);
+
+ if (em->mode < MODE_ENTRY) {
+ ebpf_write_chart_obsolete(NETDATA_APP_FAMILY,
+ w->clean_name,
+ "_ebpf_file_open_error",
+ "Fails to open files.",
+ EBPF_COMMON_DIMENSION_CALL,
+ NETDATA_APPS_FILE_FDS,
+ NETDATA_EBPF_CHART_TYPE_STACKED,
+ "app.ebpf_file_open_error",
+ 20221,
+ update_every);
+ }
- if (em->mode < MODE_ENTRY) {
ebpf_write_chart_obsolete(NETDATA_APPS_FAMILY,
- NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR,
- "Fails to close files",
+ w->clean_name,
+ "_ebpf_file_closed",
+ "Files closed.",
EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
+ NETDATA_APPS_FILE_FDS,
NETDATA_EBPF_CHART_TYPE_STACKED,
- NULL,
- 20064,
- em->update_every);
+ "app.ebpf_file_closed",
+ 20222,
+ update_every);
+
+ if (em->mode < MODE_ENTRY) {
+ ebpf_write_chart_obsolete(NETDATA_APPS_FAMILY,
+ w->clean_name,
+ "_ebpf_file_close_error",
+ "Fails to close files.",
+ EBPF_COMMON_DIMENSION_CALL,
+ NETDATA_APPS_FILE_FDS,
+ NETDATA_EBPF_CHART_TYPE_STACKED,
+ "app.ebpf_fd_close_error",
+ 20223,
+ update_every);
+ }
+ w->charts_created &= ~(1<<EBPF_MODULE_FD_IDX);
}
}
@@ -516,6 +532,7 @@ static void ebpf_obsolete_fd_global(ebpf_module_t *em)
{
ebpf_write_chart_obsolete(NETDATA_FILESYSTEM_FAMILY,
NETDATA_FILE_OPEN_CLOSE_COUNT,
+ "",
"Open and close calls",
EBPF_COMMON_DIMENSION_CALL,
NETDATA_FILE_GROUP,
@@ -527,6 +544,7 @@ static void ebpf_obsolete_fd_global(ebpf_module_t *em)
if (em->mode < MODE_ENTRY) {
ebpf_write_chart_obsolete(NETDATA_FILESYSTEM_FAMILY,
NETDATA_FILE_OPEN_ERR_COUNT,
+ "",
"Open fails",
EBPF_COMMON_DIMENSION_CALL,
NETDATA_FILE_GROUP,
@@ -802,45 +820,30 @@ void ebpf_fd_send_apps_data(ebpf_module_t *em, struct ebpf_target *root)
{
struct ebpf_target *w;
for (w = root; w; w = w->next) {
- if (unlikely(w->exposed && w->processes)) {
- ebpf_fd_sum_pids(&w->fd, w->root_pid);
- }
- }
+ if (unlikely(!(w->charts_created & (1<<EBPF_MODULE_FD_IDX))))
+ continue;
- write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN);
- for (w = root; w; w = w->next) {
- if (unlikely(w->exposed && w->processes)) {
- write_chart_dimension(w->name, w->fd.open_call);
- }
- }
- write_end_chart();
+ ebpf_fd_sum_pids(&w->fd, w->root_pid);
- if (em->mode < MODE_ENTRY) {
- write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR);
- for (w = root; w; w = w->next) {
- if (unlikely(w->exposed && w->processes)) {
- write_chart_dimension(w->name, w->fd.open_err);
- }
- }
- write_end_chart();
- }
+ ebpf_write_begin_chart(NETDATA_APP_FAMILY, w->clean_name, "_ebpf_file_open");
+ write_chart_dimension("calls", w->fd.open_call);
+ ebpf_write_end_chart();
- write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_SYSCALL_APPS_FILE_CLOSED);
- for (w = root; w; w = w->next) {
- if (unlikely(w->exposed && w->processes)) {
- write_chart_dimension(w->name, w->fd.close_call);
+ if (em->mode < MODE_ENTRY) {
+ ebpf_write_begin_chart(NETDATA_APP_FAMILY, w->clean_name, "_ebpf_file_open_error");
+ write_chart_dimension("calls", w->fd.open_err);
+ ebpf_write_end_chart();
}
- }
- write_end_chart();
- if (em->mode < MODE_ENTRY) {
- write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR);
- for (w = root; w; w = w->next) {
- if (unlikely(w->exposed && w->processes)) {
- write_chart_dimension(w->name, w->fd.close_err);
- }
+ ebpf_write_begin_chart(NETDATA_APP_FAMILY, w->clean_name, "_ebpf_file_closed");
+ write_chart_dimension("calls", w->fd.close_call);
+ ebpf_write_end_chart();
+
+ if (em->mode < MODE_ENTRY) {
+ ebpf_write_begin_chart(NETDATA_APP_FAMILY, w->clean_name, "_ebpf_file_close_error");
+ write_chart_dimension("calls", w->fd.close_err);
+ ebpf_write_end_chart();
}
- write_end_chart();
}
}
@@ -933,25 +936,25 @@ static void ebpf_create_specific_fd_charts(char *type, ebpf_module_t *em)
*/
static void ebpf_obsolete_specific_fd_charts(char *type, ebpf_module_t *em)
{
- ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_OPEN, "Number of open files",
+ ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_OPEN, "", "Number of open files",
EBPF_COMMON_DIMENSION_CALL, NETDATA_APPS_FILE_GROUP,
NETDATA_EBPF_CHART_TYPE_LINE, NETDATA_CGROUP_FD_OPEN_CONTEXT,
NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 5400, em->update_every);
if (em->mode < MODE_ENTRY) {
- ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR, "Fails to open files",
+ ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR, "", "Fails to open files",
EBPF_COMMON_DIMENSION_CALL, NETDATA_APPS_FILE_GROUP,
NETDATA_EBPF_CHART_TYPE_LINE, NETDATA_CGROUP_FD_OPEN_ERR_CONTEXT,
NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 5401, em->update_every);
}
- ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_CLOSED, "Files closed",
+ ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_CLOSED, "", "Files closed",
EBPF_COMMON_DIMENSION_CALL, NETDATA_APPS_FILE_GROUP,
NETDATA_EBPF_CHART_TYPE_LINE, NETDATA_CGROUP_FD_CLOSE_CONTEXT,
NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 5402, em->update_every);
if (em->mode < MODE_ENTRY) {
- ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR, "Fails to close files",
+ ebpf_write_chart_obsolete(type, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR, "", "Fails to close files",
EBPF_COMMON_DIMENSION_CALL, NETDATA_APPS_FILE_GROUP,
NETDATA_EBPF_CHART_TYPE_LINE, NETDATA_CGROUP_FD_CLOSE_ERR_CONTEXT,
NETDATA_CHART_PRIO_CGROUPS_CONTAINERS + 5403, em->update_every);
@@ -968,24 +971,24 @@ static void ebpf_obsolete_specific_fd_charts(char *type, ebpf_module_t *em)
*/
static void ebpf_send_specific_fd_data(char *type, netdata_fd_stat_t *values, ebpf_module_t *em)
{
- write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_OPEN);
+ ebpf_write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_OPEN, "");
write_chart_dimension(fd_publish_aggregated[NETDATA_FD_SYSCALL_OPEN].name, (long long)values->open_call);
- write_end_chart();
+ ebpf_write_end_chart();
if (em->mode < MODE_ENTRY) {
- write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR);
+ ebpf_write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR, "");
write_chart_dimension(fd_publish_aggregated[NETDATA_FD_SYSCALL_OPEN].name, (long long)values->open_err);
- write_end_chart();
+ ebpf_write_end_chart();
}
- write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_CLOSED);
+ ebpf_write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_CLOSED, "");
write_chart_dimension(fd_publish_aggregated[NETDATA_FD_SYSCALL_CLOSE].name, (long long)values->close_call);
- write_end_chart();
+ ebpf_write_end_chart();
if (em->mode < MODE_ENTRY) {
- write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR);
+ ebpf_write_begin_chart(type, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR, "");
write_chart_dimension(fd_publish_aggregated[NETDATA_FD_SYSCALL_CLOSE].name, (long long)values->close_err);
- write_end_chart();
+ ebpf_write_end_chart();
}
}
@@ -1037,40 +1040,40 @@ static void ebpf_create_systemd_fd_charts(ebpf_module_t *em)
static void ebpf_send_systemd_fd_charts(ebpf_module_t *em)
{
ebpf_cgroup_target_t *ect;
- write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN);
+ ebpf_write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN, "");
for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) {
if (unlikely(ect->systemd) && unlikely(ect->updated)) {
write_chart_dimension(ect->name, ect->publish_systemd_fd.open_call);
}
}
- write_end_chart();
+ ebpf_write_end_chart();
if (em->mode < MODE_ENTRY) {
- write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR);
+ ebpf_write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR, "");
for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) {
if (unlikely(ect->systemd) && unlikely(ect->updated)) {
write_chart_dimension(ect->name, ect->publish_systemd_fd.open_err);
}
}
- write_end_chart();
+ ebpf_write_end_chart();
}
- write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_CLOSED);
+ ebpf_write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_CLOSED, "");
for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) {
if (unlikely(ect->systemd) && unlikely(ect->updated)) {
write_chart_dimension(ect->name, ect->publish_systemd_fd.close_call);
}
}
- write_end_chart();
+ ebpf_write_end_chart();
if (em->mode < MODE_ENTRY) {
- write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR);
+ ebpf_write_begin_chart(NETDATA_SERVICE_FAMILY, NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR, "");
for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) {
if (unlikely(ect->systemd) && unlikely(ect->updated)) {
write_chart_dimension(ect->name, ect->publish_systemd_fd.close_err);
}
}
- write_end_chart();
+ ebpf_write_end_chart();
}
}
@@ -1197,44 +1200,77 @@ static void fd_collector(ebpf_module_t *em)
void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr)
{
struct ebpf_target *root = ptr;
- ebpf_create_charts_on_apps(NETDATA_SYSCALL_APPS_FILE_OPEN,
- "Number of open files",
- EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
- NETDATA_EBPF_CHART_TYPE_STACKED,
- 20061,
- ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
- root, em->update_every, NETDATA_EBPF_MODULE_NAME_FD);
+ struct ebpf_target *w;
+ int update_every = em->update_every;
+ for (w = root; w; w = w->next) {
+ if (unlikely(!w->exposed))
+ continue;
- if (em->mode < MODE_ENTRY) {
- ebpf_create_charts_on_apps(NETDATA_SYSCALL_APPS_FILE_OPEN_ERROR,
- "Fails to open files",
- EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
- NETDATA_EBPF_CHART_TYPE_STACKED,
- 20062,
- ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
- root, em->update_every, NETDATA_EBPF_MODULE_NAME_FD);
- }
+ ebpf_write_chart_cmd(NETDATA_APP_FAMILY,
+ w->clean_name,
+ "_ebpf_file_open",
+ "Number of open files",
+ EBPF_COMMON_DIMENSION_CALL,
+ NETDATA_APPS_FILE_FDS,
+ NETDATA_EBPF_CHART_TYPE_STACKED,
+ "app.ebpf_file_open",
+ 20220,
+ update_every,
+ NETDATA_EBPF_MODULE_NAME_FD);
+ ebpf_create_chart_labels("app_group", w->name, 1);
+ ebpf_commit_label();
+ fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);
+
+ if (em->mode < MODE_ENTRY) {
+ ebpf_write_chart_cmd(NETDATA_APP_FAMILY,
+ w->clean_name,
+ "_ebpf_file_open_error",
+ "Fails to open files.",
+ EBPF_COMMON_DIMENSION_CALL,
+ NETDATA_APPS_FILE_FDS,
+ NETDATA_EBPF_CHART_TYPE_STACKED,
+ "app.ebpf_file_open_error",
+ 20221,
+ update_every,
+ NETDATA_EBPF_MODULE_NAME_FD);
+ ebpf_create_chart_labels("app_group", w->name, 1);
+ ebpf_commit_label();
+ fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);
+ }
- ebpf_create_charts_on_apps(NETDATA_SYSCALL_APPS_FILE_CLOSED,
- "Files closed",
- EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
- NETDATA_EBPF_CHART_TYPE_STACKED,
- 20063,
- ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
- root, em->update_every, NETDATA_EBPF_MODULE_NAME_FD);
+ ebpf_write_chart_cmd(NETDATA_APP_FAMILY,
+ w->clean_name,
+ "_ebpf_file_closed",
+ "Files closed.",
+ EBPF_COMMON_DIMENSION_CALL,
+ NETDATA_APPS_FILE_FDS,
+ NETDATA_EBPF_CHART_TYPE_STACKED,
+ "app.ebpf_file_closed",
+ 20222,
+ update_every,
+ NETDATA_EBPF_MODULE_NAME_FD);
+ ebpf_create_chart_labels("app_group", w->name, 1);
+ ebpf_commit_label();
+ fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);
+
+ if (em->mode < MODE_ENTRY) {
+ ebpf_write_chart_cmd(NETDATA_APP_FAMILY,
+ w->clean_name,
+ "_ebpf_file_close_error",
+ "Fails to close files.",
+ EBPF_COMMON_DIMENSION_CALL,
+ NETDATA_APPS_FILE_FDS,
+ NETDATA_EBPF_CHART_TYPE_STACKED,
+ "app.ebpf_file_close_error",
+ 20223,
+ update_every,
+ NETDATA_EBPF_MODULE_NAME_FD);
+ ebpf_create_chart_labels("app_group", w->name, 1);
+ ebpf_commit_label();
+ fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);
+ }
- if (em->mode < MODE_ENTRY) {
- ebpf_create_charts_on_apps(NETDATA_SYSCALL_APPS_FILE_CLOSE_ERROR,
- "Fails to close files",
- EBPF_COMMON_DIMENSION_CALL,
- NETDATA_APPS_FILE_GROUP,
- NETDATA_EBPF_CHART_TYPE_STACKED,
- 20064,
- ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX],
- root, em->update_every, NETDATA_EBPF_MODULE_NAME_FD);
+ w->charts_created |= 1<<EBPF_MODULE_FD_IDX;
}
em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED;