Skip to content

Commit

Permalink
set app_group label automatically (#16810)
Browse files Browse the repository at this point in the history
(cherry picked from commit e5de17a)
  • Loading branch information
boxjan authored and tkatsoulas committed Feb 6, 2024
1 parent 2e10ab7 commit 7f2123f
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 65 deletions.
34 changes: 17 additions & 17 deletions collectors/apps.plugin/apps_plugin.c
Expand Up @@ -3892,92 +3892,92 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type
w->exposed = 1;

fprintf(stdout, "CHART %s.%s_cpu_utilization '' '%s CPU utilization (100%% = 1 core)' 'percentage' cpu %s.cpu_utilization stacked 20001 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION user '' absolute 1 %llu\n", time_factor * RATES_DETAIL / 100LLU);
fprintf(stdout, "DIMENSION system '' absolute 1 %llu\n", time_factor * RATES_DETAIL / 100LLU);

#ifndef __FreeBSD__
if (enable_guest_charts) {
fprintf(stdout, "CHART %s.%s_cpu_guest_utilization '' '%s CPU guest utlization (100%% = 1 core)' 'percentage' cpu %s.cpu_guest_utilization line 20005 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION guest '' absolute 1 %llu\n", time_factor * RATES_DETAIL / 100LLU);
}

fprintf(stdout, "CHART %s.%s_cpu_context_switches '' '%s CPU context switches' 'switches/s' cpu %s.cpu_context_switches stacked 20010 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION voluntary '' absolute 1 %llu\n", RATES_DETAIL);
fprintf(stdout, "DIMENSION involuntary '' absolute 1 %llu\n", RATES_DETAIL);

fprintf(stdout, "CHART %s.%s_mem_private_usage '' '%s memory usage without shared' 'MiB' mem %s.mem_private_usage area 20050 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION mem '' absolute %ld %ld\n", 1L, 1024L);
#endif

fprintf(stdout, "CHART %s.%s_mem_usage '' '%s memory RSS usage' 'MiB' mem %s.mem_usage area 20055 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION rss '' absolute %ld %ld\n", 1L, 1024L);

fprintf(stdout, "CHART %s.%s_mem_page_faults '' '%s memory page faults' 'pgfaults/s' mem %s.mem_page_faults stacked 20060 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION major '' absolute 1 %llu\n", RATES_DETAIL);
fprintf(stdout, "DIMENSION minor '' absolute 1 %llu\n", RATES_DETAIL);

fprintf(stdout, "CHART %s.%s_vmem_usage '' '%s virtual memory size' 'MiB' mem %s.vmem_usage line 20065 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION vmem '' absolute %ld %ld\n", 1L, 1024L);

#ifndef __FreeBSD__
fprintf(stdout, "CHART %s.%s_swap_usage '' '%s swap usage' 'MiB' mem %s.swap_usage area 20065 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION swap '' absolute %ld %ld\n", 1L, 1024L);
#endif

#ifndef __FreeBSD__
fprintf(stdout, "CHART %s.%s_disk_physical_io '' '%s disk physical IO' 'KiB/s' disk %s.disk_physical_io area 20100 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION reads '' absolute 1 %llu\n", 1024LLU * RATES_DETAIL);
fprintf(stdout, "DIMENSION writes '' absolute -1 %llu\n", 1024LLU * RATES_DETAIL);

fprintf(stdout, "CHART %s.%s_disk_logical_io '' '%s disk logical IO' 'KiB/s' disk %s.disk_logical_io area 20105 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION reads '' absolute 1 %llu\n", 1024LLU * RATES_DETAIL);
fprintf(stdout, "DIMENSION writes '' absolute -1 %llu\n", 1024LLU * RATES_DETAIL);
#else
fprintf(stdout, "CHART %s.%s_disk_physical_io '' '%s disk physical IO' 'blocks/s' disk %s.disk_physical_block_io area 20100 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION reads '' absolute 1 %llu\n", RATES_DETAIL);
fprintf(stdout, "DIMENSION writes '' absolute -1 %llu\n", RATES_DETAIL);
#endif

fprintf(stdout, "CHART %s.%s_processes '' '%s processes' 'processes' processes %s.processes line 20150 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION processes '' absolute 1 1\n");

fprintf(stdout, "CHART %s.%s_threads '' '%s threads' 'threads' processes %s.threads line 20155 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION threads '' absolute 1 1\n");

if (enable_file_charts) {
fprintf(stdout, "CHART %s.%s_fds_open_limit '' '%s open file descriptors limit' '%%' fds %s.fds_open_limit line 20200 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION limit '' absolute 1 100\n");

fprintf(stdout, "CHART %s.%s_fds_open '' '%s open files descriptors' 'fds' fds %s.fds_open stacked 20210 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION files '' absolute 1 1\n");
fprintf(stdout, "DIMENSION sockets '' absolute 1 1\n");
Expand All @@ -3992,13 +3992,13 @@ static void send_charts_updates_to_netdata(struct target *root, const char *type

#ifndef __FreeBSD__
fprintf(stdout, "CHART %s.%s_uptime '' '%s uptime' 'seconds' uptime %s.uptime line 20250 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION uptime '' absolute 1 1\n");

if (enable_detailed_uptime_charts) {
fprintf(stdout, "CHART %s.%s_uptime_summary '' '%s uptime summary' 'seconds' uptime %s.uptime_summary area 20255 %d\n", type, w->clean_name, title, type, update_every);
fprintf(stdout, "CLABEL '%s' '%s' 0\n", lbl_name, w->name);
fprintf(stdout, "CLABEL '%s' '%s' 1\n", lbl_name, w->name);
fprintf(stdout, "CLABEL_COMMIT\n");
fprintf(stdout, "DIMENSION min '' absolute 1 1\n");
fprintf(stdout, "DIMENSION avg '' absolute 1 1\n");
Expand Down
4 changes: 2 additions & 2 deletions collectors/debugfs.plugin/sys_devices_virtual_powercap.c
Expand Up @@ -151,7 +151,7 @@ int do_sys_devices_virtual_powercap(int update_every, const char *name __maybe_u
update_every);

fprintf(stdout,
"CLABEL 'zone' '%s' 0\n"
"CLABEL 'zone' '%s' 1\n"
"CLABEL_COMMIT\n",
zone->name);

Expand All @@ -171,7 +171,7 @@ int do_sys_devices_virtual_powercap(int update_every, const char *name __maybe_u
update_every);

fprintf(stdout,
"CLABEL 'zone' '%s' 0\n"
"CLABEL 'zone' '%s' 1\n"
"CLABEL_COMMIT\n",
zone->name);

Expand Down
8 changes: 4 additions & 4 deletions collectors/ebpf.plugin/ebpf_cachestat.c
Expand Up @@ -842,7 +842,7 @@ void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *ptr)
20260,
update_every,
NETDATA_EBPF_MODULE_NAME_CACHESTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION ratio '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -858,7 +858,7 @@ void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *ptr)
20261,
update_every,
NETDATA_EBPF_MODULE_NAME_CACHESTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION pages '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX]);

Expand All @@ -873,7 +873,7 @@ void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *ptr)
20262,
update_every,
NETDATA_EBPF_MODULE_NAME_CACHESTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION hits '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -888,7 +888,7 @@ void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *ptr)
20263,
update_every,
NETDATA_EBPF_MODULE_NAME_CACHESTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION misses '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
w->charts_created |= 1<<EBPF_MODULE_CACHESTAT_IDX;
Expand Down
8 changes: 4 additions & 4 deletions collectors/ebpf.plugin/ebpf_dcstat.c
Expand Up @@ -549,7 +549,7 @@ void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr)
20265,
update_every,
NETDATA_EBPF_MODULE_NAME_DCSTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION ratio '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -564,7 +564,7 @@ void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr)
20266,
update_every,
NETDATA_EBPF_MODULE_NAME_DCSTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION files '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -579,7 +579,7 @@ void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr)
20267,
update_every,
NETDATA_EBPF_MODULE_NAME_DCSTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION files '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -594,7 +594,7 @@ void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr)
20268,
update_every,
NETDATA_EBPF_MODULE_NAME_DCSTAT);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION files '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand Down
8 changes: 4 additions & 4 deletions collectors/ebpf.plugin/ebpf_fd.c
Expand Up @@ -1217,7 +1217,7 @@ void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr)
20220,
update_every,
NETDATA_EBPF_MODULE_NAME_FD);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);

Expand All @@ -1233,7 +1233,7 @@ void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr)
20221,
update_every,
NETDATA_EBPF_MODULE_NAME_FD);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);
}
Expand All @@ -1249,7 +1249,7 @@ void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr)
20222,
update_every,
NETDATA_EBPF_MODULE_NAME_FD);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);

Expand All @@ -1265,7 +1265,7 @@ void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr)
20223,
update_every,
NETDATA_EBPF_MODULE_NAME_FD);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);
}
Expand Down
2 changes: 1 addition & 1 deletion collectors/ebpf.plugin/ebpf_oomkill.c
Expand Up @@ -495,7 +495,7 @@ void ebpf_oomkill_create_apps_charts(struct ebpf_module *em, void *ptr)
20072,
update_every,
NETDATA_EBPF_MODULE_NAME_OOMKILL);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION kills '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand Down
10 changes: 5 additions & 5 deletions collectors/ebpf.plugin/ebpf_process.c
Expand Up @@ -437,7 +437,7 @@ void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr)
20161,
update_every,
NETDATA_EBPF_MODULE_NAME_PROCESS);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -452,7 +452,7 @@ void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr)
20162,
update_every,
NETDATA_EBPF_MODULE_NAME_PROCESS);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -467,7 +467,7 @@ void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr)
20163,
update_every,
NETDATA_EBPF_MODULE_NAME_PROCESS);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -482,7 +482,7 @@ void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr)
20164,
update_every,
NETDATA_EBPF_MODULE_NAME_PROCESS);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);

Expand All @@ -498,7 +498,7 @@ void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr)
20165,
update_every,
NETDATA_EBPF_MODULE_NAME_PROCESS);
ebpf_create_chart_labels("app_group", w->name, 0);
ebpf_create_chart_labels("app_group", w->name, 1);
ebpf_commit_label();
fprintf(stdout, "DIMENSION calls '' %s 1 1\n", ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX]);
}
Expand Down
8 changes: 4 additions & 4 deletions collectors/ebpf.plugin/ebpf_shm.c
Expand Up @@ -1121,7 +1121,7 @@ void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr)
20191,
update_every,
NETDATA_EBPF_MODULE_NAME_SHM);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);

Expand All @@ -1136,7 +1136,7 @@ void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr)
20192,
update_every,
NETDATA_EBPF_MODULE_NAME_SHM);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);

Expand All @@ -1151,7 +1151,7 @@ void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr)
20193,
update_every,
NETDATA_EBPF_MODULE_NAME_SHM);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);

Expand All @@ -1166,7 +1166,7 @@ void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr)
20194,
update_every,
NETDATA_EBPF_MODULE_NAME_SHM);
ebpf_create_chart_labels("app_group", w->name, 0);
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]);

Expand Down

0 comments on commit 7f2123f

Please sign in to comment.