diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-08-12 07:26:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-08-12 07:26:11 +0000 |
commit | 3c315f0fff93aa072472abc10815963ac0035268 (patch) | |
tree | a95f6a96e0e7bd139c010f8dc60b40e5b3062a99 /collectors/cgroups.plugin/sys_fs_cgroup.c | |
parent | Adding upstream version 1.35.1. (diff) | |
download | netdata-3c315f0fff93aa072472abc10815963ac0035268.tar.xz netdata-3c315f0fff93aa072472abc10815963ac0035268.zip |
Adding upstream version 1.36.0.upstream/1.36.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/cgroups.plugin/sys_fs_cgroup.c | 303 |
1 files changed, 167 insertions, 136 deletions
diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 5676ef8ca..330562173 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -6,6 +6,12 @@ #define PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME "systemd" #define PLUGIN_CGROUPS_MODULE_CGROUPS_NAME "/sys/fs/cgroup" +#ifdef NETDATA_INTERNAL_CHECKS +#define CGROUP_PROCFILE_FLAG PROCFILE_FLAG_DEFAULT +#else +#define CGROUP_PROCFILE_FLAG PROCFILE_FLAG_NO_ERROR_ON_FILE_IO +#endif + // main cgroups thread worker jobs #define WORKER_CGROUPS_LOCK 0 #define WORKER_CGROUPS_READ 1 @@ -446,12 +452,17 @@ void read_cgroup_plugin_configuration() { // ---------------------------------------------------------------- " /machine.slice/*.service " // #3367 systemd-nspawn - " /kubepods/pod*/* " // k8s containers - " /kubepods/*/pod*/* " // k8s containers // ---------------------------------------------------------------- - " !/kubepods* " // all other k8s cgroups + " */kubepods/pod*/* " // k8s containers + " */kubepods/*/pod*/* " // k8s containers + " */*-kubepods-pod*/* " // k8s containers + " */*-kubepods-*-pod*/* " // k8s containers + " !*kubepods* !*kubelet* " // all other k8s cgroups + + // ---------------------------------------------------------------- + " !*/vcpu* " // libvirtd adds these sub-cgroups " !*/emulator " // libvirtd adds these sub-cgroups " !*.mount " @@ -523,9 +534,11 @@ void read_cgroup_plugin_configuration() { " *docker* " " *lxc* " " *qemu* " - " /kubepods/pod*/* " // k8s containers - " /kubepods/*/pod*/* " // k8s containers - " !/kubepods* " // all other k8s cgroups + " */kubepods/pod*/* " // k8s containers + " */kubepods/*/pod*/* " // k8s containers + " */*-kubepods-pod*/* " // k8s containers + " */*-kubepods-*-pod*/* " // k8s containers + " !*kubepods* !*kubelet* " // all other k8s cgroups " *.libvirt-qemu " // #3010 " * " ), NULL, SIMPLE_PATTERN_EXACT); @@ -755,6 +768,12 @@ struct cgroup_network_interface { struct cgroup_network_interface *next; }; +enum cgroups_container_orchestrator { + CGROUPS_ORCHESTRATOR_UNSET, + CGROUPS_ORCHESTRATOR_UNKNOWN, + CGROUPS_ORCHESTRATOR_K8S +}; + // *** WARNING *** The fields are not thread safe. Take care of safe usage. struct cgroup { uint32_t options; @@ -776,7 +795,9 @@ struct cgroup { char *chart_title; - struct label *chart_labels; + DICTIONARY *chart_labels; + + int container_orchestrator; struct cpuacct_stat cpuacct_stat; struct cpuacct_usage cpuacct_usage; @@ -835,7 +856,7 @@ struct cgroup { unsigned long long cpu_cfs_quota; RRDSETVAR *chart_var_cpu_limit; - calculated_number prev_cpu_usage; + NETDATA_DOUBLE prev_cpu_usage; char *filename_memory_limit; unsigned long long memory_limit; @@ -922,6 +943,10 @@ static inline int is_cgroup_systemd_service(struct cgroup *cg) { } // --------------------------------------------------------------------------------------------- +static int k8s_is_kubepod(struct cgroup *cg) { + return cg->container_orchestrator == CGROUPS_ORCHESTRATOR_K8S; +} + static int k8s_is_container(const char *id) { // examples: // https://github.com/netdata/netdata/blob/0fc101679dcd12f1cb8acdd07bb4c85d8e553e53/collectors/cgroups.plugin/cgroup-name.sh#L121-L147 @@ -949,7 +974,7 @@ static int k8s_get_container_first_proc_comm(const char *id, char *comm) { char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s/%s/cgroup.procs", cgroup_cpuacct_base, id); - ff = procfile_reopen(ff, filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, filename, NULL, CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename); return 1; @@ -1012,7 +1037,7 @@ static unsigned long long calc_percentage(unsigned long long value, unsigned lon if (total == 0) { return 0; } - return (calculated_number)value / (calculated_number)total * 100; + return (NETDATA_DOUBLE)value / (NETDATA_DOUBLE)total * 100; } static int calc_cgroup_depth(const char *id) { @@ -1031,7 +1056,7 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) { static procfile *ff = NULL; if(likely(cp->filename)) { - ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cp->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { cp->updated = 0; cgroups_check = 1; @@ -1078,7 +1103,7 @@ static inline void cgroup_read_cpuacct_cpu_stat(struct cpuacct_cpu_throttling *c } static procfile *ff = NULL; - ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cp->filename, NULL, CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { cp->updated = 0; cgroups_check = 1; @@ -1134,7 +1159,7 @@ static inline void cgroup2_read_cpuacct_cpu_stat(struct cpuacct_stat *cp, struct return; } - ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cp->filename, NULL, CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { cp->updated = 0; cgroups_check = 1; @@ -1217,7 +1242,7 @@ static inline void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) { static procfile *ff = NULL; if(likely(ca->filename)) { - ff = procfile_reopen(ff, ca->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, ca->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { ca->updated = 0; cgroups_check = 1; @@ -1280,7 +1305,7 @@ static inline void cgroup_read_blkio(struct blkio *io) { if(likely(io->filename)) { static procfile *ff = NULL; - ff = procfile_reopen(ff, io->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, io->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { io->updated = 0; cgroups_check = 1; @@ -1352,7 +1377,7 @@ static inline void cgroup2_read_blkio(struct blkio *io, unsigned int word_offset if(likely(io->filename)) { static procfile *ff = NULL; - ff = procfile_reopen(ff, io->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, io->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { io->updated = 0; cgroups_check = 1; @@ -1397,7 +1422,7 @@ static inline void cgroup2_read_pressure(struct pressure *res) { static procfile *ff = NULL; if (likely(res->filename)) { - ff = procfile_reopen(ff, res->filename, " =", PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, res->filename, " =", CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { res->updated = 0; cgroups_check = 1; @@ -1454,7 +1479,7 @@ static inline void cgroup_read_memory(struct memory *mem, char parent_cg_is_unif goto memory_next; } - ff = procfile_reopen(ff, mem->filename_detailed, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, mem->filename_detailed, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { mem->updated_detailed = 0; cgroups_check = 1; @@ -1677,7 +1702,8 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) { info("CGROUP: cgroup '%s' has network interface '%s' as '%s'", cg->id, i->host_device, i->container_device); // register a device rename to proc_net_dev.c - netdev_rename_device_add(i->host_device, i->container_device, cg->chart_id, cg->chart_labels); + netdev_rename_device_add( + i->host_device, i->container_device, cg->chart_id, cg->chart_labels, k8s_is_kubepod(cg) ? "k8s." : ""); } } @@ -1735,34 +1761,24 @@ static inline void substitute_dots_in_id(char *s) { } } -char *k8s_parse_resolved_name(struct label **labels, char *data) { - char *name = mystrsep(&data, " "); - - if (!data) { - return name; - } - - while (data) { - char *key = mystrsep(&data, "="); - - char *value; - if (data && *data == ',') { - value = ""; - *data++ = '\0'; - } else { - value = mystrsep(&data, ","); - } - value = strip_double_quotes(value, 1); +// ---------------------------------------------------------------------------- +// parse k8s labels - if (!key || *key == '\0' || !value || *value == '\0') - continue; +char *k8s_parse_resolved_name_and_labels(DICTIONARY *labels, char *data) { + // the first word, up to the first space is the name + char *name = mystrsep(&data, " "); - *labels = add_label_to_list(*labels, key, value, LABEL_SOURCE_KUBERNETES); + // the rest are key=value pairs separated by comma + while(data) { + char *pair = mystrsep(&data, ","); + rrdlabels_add_pair(labels, pair, RRDLABEL_SRC_AUTO| RRDLABEL_SRC_K8S); } return name; } +// ---------------------------------------------------------------------------- + static inline void free_pressure(struct pressure *res) { if (res->some.share_time.st) rrdset_is_obsolete(res->some.share_time.st); if (res->some.total_time.st) rrdset_is_obsolete(res->some.total_time.st); @@ -1834,7 +1850,7 @@ static inline void cgroup_free(struct cgroup *cg) { freez(cg->chart_id); freez(cg->chart_title); - free_label_list(cg->chart_labels); + rrdlabels_destroy(cg->chart_labels); freez(cg); @@ -1870,31 +1886,33 @@ static inline void discovery_rename_cgroup(struct cgroup *cg) { case 0: cg->pending_renames = 0; break; + case 3: cg->pending_renames = 0; cg->processed = 1; break; } - if (cg->pending_renames || cg->processed) { - return; - } - if (!(new_name && *new_name && *new_name != '\n')) { - return; - } - new_name = trim(new_name); - if (!(new_name)) { - return; - } + if(cg->pending_renames || cg->processed) return; + if(!new_name || !*new_name || *new_name == '\n') return; + if(!(new_name = trim(new_name))) return; + char *name = new_name; if (!strncmp(new_name, "k8s_", 4)) { - free_label_list(cg->chart_labels); - name = k8s_parse_resolved_name(&cg->chart_labels, new_name); + if(!cg->chart_labels) cg->chart_labels = rrdlabels_create(); + + // read the new labels and remove the obsolete ones + rrdlabels_unmark_all(cg->chart_labels); + name = k8s_parse_resolved_name_and_labels(cg->chart_labels, new_name); + rrdlabels_remove_all_unmarked(cg->chart_labels); } + freez(cg->chart_title); cg->chart_title = cgroup_title_strdupz(name); + freez(cg->chart_id); cg->chart_id = cgroup_chart_id_strdupz(name); + substitute_dots_in_id(cg->chart_id); cg->hash_chart = simple_hash(cg->chart_id); } @@ -2584,6 +2602,14 @@ static inline void discovery_process_first_time_seen_cgroup(struct cgroup *cg) { char comm[TASK_COMM_LEN]; + if (cg->container_orchestrator == CGROUPS_ORCHESTRATOR_UNSET) { + if (strstr(cg->id, "kubepods")) { + cg->container_orchestrator = CGROUPS_ORCHESTRATOR_K8S; + } else { + cg->container_orchestrator = CGROUPS_ORCHESTRATOR_UNKNOWN; + } + } + if (is_inside_k8s && !k8s_get_container_first_proc_comm(cg->id, comm)) { // container initialization may take some time when CPU % is high // seen on GKE: comm is '6' before 'runc:[2:INIT]' (dunno if it could be another number) @@ -2656,6 +2682,11 @@ static inline void discovery_process_cgroup(struct cgroup *cg) { cg->processed = 1; + if (strlen(cg->chart_id) >= RRD_ID_LENGTH_MAX) { + info("cgroup '%s' (chart id '%s') disabled because chart_id exceeds the limit (RRD_ID_LENGTH_MAX)", cg->id, cg->chart_id); + return; + } + if (is_cgroup_systemd_service(cg)) { cg->enabled = 1; return; @@ -3638,7 +3669,7 @@ static inline void update_cpu_limits2(struct cgroup *cg) { if(cg->filename_cpu_cfs_quota){ static procfile *ff = NULL; - ff = procfile_reopen(ff, cg->filename_cpu_cfs_quota, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cg->filename_cpu_cfs_quota, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { goto cpu_limits2_err; } @@ -3694,7 +3725,7 @@ static inline int update_memory_limits(char **filename, RRDSETVAR **chart_var, u *filename = NULL; } else { - rrdsetvar_custom_chart_variable_set(*chart_var, (calculated_number)(*value / (1024 * 1024))); + rrdsetvar_custom_chart_variable_set(*chart_var, (NETDATA_DOUBLE)(*value / (1024 * 1024))); return 1; } } else { @@ -3709,11 +3740,11 @@ static inline int update_memory_limits(char **filename, RRDSETVAR **chart_var, u char *s = "max\n\0"; if(strcmp(s, buffer) == 0){ *value = UINT64_MAX; - rrdsetvar_custom_chart_variable_set(*chart_var, (calculated_number)(*value / (1024 * 1024))); + rrdsetvar_custom_chart_variable_set(*chart_var, (NETDATA_DOUBLE)(*value / (1024 * 1024))); return 1; } *value = str2ull(buffer); - rrdsetvar_custom_chart_variable_set(*chart_var, (calculated_number)(*value / (1024 * 1024))); + rrdsetvar_custom_chart_variable_set(*chart_var, (NETDATA_DOUBLE)(*value / (1024 * 1024))); return 1; } } @@ -3772,7 +3803,7 @@ void update_cgroup_charts(int update_every) { , "cpu" , NULL , "cpu" - , "cgroup.cpu" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu" : "cgroup.cpu" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3782,7 +3813,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_cpu, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu, cg->chart_labels); if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) { rrddim_add(cg->st_cpu, "user", NULL, 100, system_hz, RRD_ALGORITHM_INCREMENTAL); @@ -3822,17 +3853,17 @@ void update_cgroup_charts(int update_every) { } } else { - calculated_number value = 0, quota = 0; + NETDATA_DOUBLE value = 0, quota = 0; if(likely( ((!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) && (cg->filename_cpuset_cpus || (cg->filename_cpu_cfs_period && cg->filename_cpu_cfs_quota))) || ((cg->options & CGROUP_OPTIONS_IS_UNIFIED) && cg->filename_cpu_cfs_quota))) { if(unlikely(cg->cpu_cfs_quota > 0)) - quota = (calculated_number)cg->cpu_cfs_quota / (calculated_number)cg->cpu_cfs_period; + quota = (NETDATA_DOUBLE)cg->cpu_cfs_quota / (NETDATA_DOUBLE)cg->cpu_cfs_period; if(unlikely(quota > 0 && quota < cg->cpuset_cpus)) value = quota * 100; else - value = (calculated_number)cg->cpuset_cpus * 100; + value = (NETDATA_DOUBLE)cg->cpuset_cpus * 100; } if(likely(value)) { rrdsetvar_custom_chart_variable_set(cg->chart_var_cpu_limit, value); @@ -3845,7 +3876,7 @@ void update_cgroup_charts(int update_every) { , "cpu_limit" , NULL , "cpu" - , "cgroup.cpu_limit" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_limit" : "cgroup.cpu_limit" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3855,20 +3886,20 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_limit, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_limit, cg->chart_labels); if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) rrddim_add(cg->st_cpu_limit, "used", NULL, 1, system_hz, RRD_ALGORITHM_ABSOLUTE); else rrddim_add(cg->st_cpu_limit, "used", NULL, 1, 1000000, RRD_ALGORITHM_ABSOLUTE); - cg->prev_cpu_usage = (calculated_number)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; + cg->prev_cpu_usage = (NETDATA_DOUBLE)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; } else rrdset_next(cg->st_cpu_limit); - calculated_number cpu_usage = 0; - cpu_usage = (calculated_number)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; - calculated_number cpu_used = 100 * (cpu_usage - cg->prev_cpu_usage) / (value * update_every); + NETDATA_DOUBLE cpu_usage = 0; + cpu_usage = (NETDATA_DOUBLE)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; + NETDATA_DOUBLE cpu_used = 100 * (cpu_usage - cg->prev_cpu_usage) / (value * update_every); rrdset_isnot_obsolete(cg->st_cpu_limit); @@ -3898,7 +3929,7 @@ void update_cgroup_charts(int update_every) { , "throttled" , NULL , "cpu" - , "cgroup.throttled" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttled" : "cgroup.throttled" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3908,7 +3939,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_nr_throttled, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_nr_throttled, cg->chart_labels); rrddim_add(cg->st_cpu_nr_throttled, "throttled", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else { rrdset_next(cg->st_cpu_nr_throttled); @@ -3924,7 +3955,7 @@ void update_cgroup_charts(int update_every) { , "throttled_duration" , NULL , "cpu" - , "cgroup.throttled_duration" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttled_duration" : "cgroup.throttled_duration" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -3934,7 +3965,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_throttled_time, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_throttled_time, cg->chart_labels); rrddim_add(cg->st_cpu_throttled_time, "duration", NULL, 1, 1000000, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(cg->st_cpu_throttled_time); @@ -3952,7 +3983,7 @@ void update_cgroup_charts(int update_every) { , "cpu_shares" , NULL , "cpu" - , "cgroup.cpu_shares" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_shares" : "cgroup.cpu_shares" , title , "shares" , PLUGIN_CGROUPS_NAME @@ -3962,7 +3993,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_shares, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_shares, cg->chart_labels); rrddim_add(cg->st_cpu_shares, "shares", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else { rrdset_next(cg->st_cpu_shares); @@ -3983,7 +4014,7 @@ void update_cgroup_charts(int update_every) { , "cpu_per_core" , NULL , "cpu" - , "cgroup.cpu_per_core" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_per_core" : "cgroup.cpu_per_core" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3993,7 +4024,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_cpu_per_core, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_per_core, cg->chart_labels); for(i = 0; i < cg->cpuacct_usage.cpus; i++) { snprintfz(id, RRD_ID_LENGTH_MAX, "cpu%u", i); @@ -4019,7 +4050,7 @@ void update_cgroup_charts(int update_every) { , "mem" , NULL , "mem" - , "cgroup.mem" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem" : "cgroup.mem" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4028,8 +4059,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_STACKED ); - - rrdset_update_labels(cg->st_mem, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_mem, cg->chart_labels); if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) { rrddim_add(cg->st_mem, "cache", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4079,7 +4110,7 @@ void update_cgroup_charts(int update_every) { , "writeback" , NULL , "mem" - , "cgroup.writeback" + , k8s_is_kubepod(cg) ? "k8s.cgroup.writeback" : "cgroup.writeback" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4089,7 +4120,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(cg->st_writeback, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_writeback, cg->chart_labels); if(cg->memory.detailed_has_dirty) rrddim_add(cg->st_writeback, "dirty", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4114,7 +4145,7 @@ void update_cgroup_charts(int update_every) { , "mem_activity" , NULL , "mem" - , "cgroup.mem_activity" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_activity" : "cgroup.mem_activity" , title , "MiB/s" , PLUGIN_CGROUPS_NAME @@ -4124,7 +4155,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_mem_activity, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_activity, cg->chart_labels); rrddim_add(cg->st_mem_activity, "pgpgin", "in", system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_mem_activity, "pgpgout", "out", -system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4145,7 +4176,7 @@ void update_cgroup_charts(int update_every) { , "pgfaults" , NULL , "mem" - , "cgroup.pgfaults" + , k8s_is_kubepod(cg) ? "k8s.cgroup.pgfaults" : "cgroup.pgfaults" , title , "MiB/s" , PLUGIN_CGROUPS_NAME @@ -4155,7 +4186,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_pgfaults, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_pgfaults, cg->chart_labels); rrddim_add(cg->st_pgfaults, "pgfault", NULL, system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_pgfaults, "pgmajfault", "swap", -system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4177,7 +4208,7 @@ void update_cgroup_charts(int update_every) { , "mem_usage" , NULL , "mem" - , "cgroup.mem_usage" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_usage" : "cgroup.mem_usage" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4187,7 +4218,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_mem_usage, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_usage, cg->chart_labels); rrddim_add(cg->st_mem_usage, "ram", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); rrddim_add(cg->st_mem_usage, "swap", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4244,7 +4275,7 @@ void update_cgroup_charts(int update_every) { , "mem_usage_limit" , NULL , "mem" - , "cgroup.mem_usage_limit" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_usage_limit": "cgroup.mem_usage_limit" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4254,7 +4285,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_mem_usage_limit, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_usage_limit, cg->chart_labels); rrddim_add(cg->st_mem_usage_limit, "available", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); rrddim_add(cg->st_mem_usage_limit, "used", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4276,7 +4307,7 @@ void update_cgroup_charts(int update_every) { , "mem_utilization" , NULL , "mem" - , "cgroup.mem_utilization" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_utilization" : "cgroup.mem_utilization" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4286,7 +4317,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(cg->st_mem_utilization, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_utilization, cg->chart_labels); rrddim_add(cg->st_mem_utilization, "utilization", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else @@ -4325,7 +4356,7 @@ void update_cgroup_charts(int update_every) { , "mem_failcnt" , NULL , "mem" - , "cgroup.mem_failcnt" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_failcnt" : "cgroup.mem_failcnt" , title , "count" , PLUGIN_CGROUPS_NAME @@ -4334,8 +4365,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_mem_failcnt, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_mem_failcnt, cg->chart_labels); rrddim_add(cg->st_mem_failcnt, "failures", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } @@ -4355,7 +4386,7 @@ void update_cgroup_charts(int update_every) { , "io" , NULL , "disk" - , "cgroup.io" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io" : "cgroup.io" , title , "KiB/s" , PLUGIN_CGROUPS_NAME @@ -4365,7 +4396,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(cg->st_io, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_io, cg->chart_labels); rrddim_add(cg->st_io, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_io, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4387,7 +4418,7 @@ void update_cgroup_charts(int update_every) { , "serviced_ops" , NULL , "disk" - , "cgroup.serviced_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.serviced_ops" : "cgroup.serviced_ops" , title , "operations/s" , PLUGIN_CGROUPS_NAME @@ -4397,7 +4428,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_serviced_ops, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_serviced_ops, cg->chart_labels); rrddim_add(cg->st_serviced_ops, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_serviced_ops, "write", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -4419,7 +4450,7 @@ void update_cgroup_charts(int update_every) { , "throttle_io" , NULL , "disk" - , "cgroup.throttle_io" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttle_io" : "cgroup.throttle_io" , title , "KiB/s" , PLUGIN_CGROUPS_NAME @@ -4428,8 +4459,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_AREA ); - - rrdset_update_labels(cg->st_throttle_io, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_throttle_io, cg->chart_labels); rrddim_add(cg->st_throttle_io, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_throttle_io, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4451,7 +4482,7 @@ void update_cgroup_charts(int update_every) { , "throttle_serviced_ops" , NULL , "disk" - , "cgroup.throttle_serviced_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttle_serviced_ops" : "cgroup.throttle_serviced_ops" , title , "operations/s" , PLUGIN_CGROUPS_NAME @@ -4460,8 +4491,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_throttle_serviced_ops, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_throttle_serviced_ops, cg->chart_labels); rrddim_add(cg->st_throttle_serviced_ops, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_throttle_serviced_ops, "write", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -4483,7 +4514,7 @@ void update_cgroup_charts(int update_every) { , "queued_ops" , NULL , "disk" - , "cgroup.queued_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.queued_ops" : "cgroup.queued_ops" , title , "operations" , PLUGIN_CGROUPS_NAME @@ -4492,8 +4523,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_queued_ops, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_queued_ops, cg->chart_labels); rrddim_add(cg->st_queued_ops, "read", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); rrddim_add(cg->st_queued_ops, "write", NULL, -1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -4515,7 +4546,7 @@ void update_cgroup_charts(int update_every) { , "merged_ops" , NULL , "disk" - , "cgroup.merged_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.merged_ops" : "cgroup.merged_ops" , title , "operations/s" , PLUGIN_CGROUPS_NAME @@ -4524,8 +4555,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_merged_ops, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_merged_ops, cg->chart_labels); rrddim_add(cg->st_merged_ops, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_merged_ops, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4553,7 +4584,7 @@ void update_cgroup_charts(int update_every) { , "cpu_some_pressure" , NULL , "cpu" - , "cgroup.cpu_some_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_some_pressure" : "cgroup.cpu_some_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4562,7 +4593,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "some 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "some 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "some 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4577,7 +4608,7 @@ void update_cgroup_charts(int update_every) { , "cpu_some_pressure_stall_time" , NULL , "cpu" - , "cgroup.cpu_some_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_some_pressure_stall_time" : "cgroup.cpu_some_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4586,7 +4617,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4605,7 +4636,7 @@ void update_cgroup_charts(int update_every) { , "cpu_full_pressure" , NULL , "cpu" - , "cgroup.cpu_full_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_full_pressure" : "cgroup.cpu_full_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4614,7 +4645,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "full 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "full 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "full 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4629,7 +4660,7 @@ void update_cgroup_charts(int update_every) { , "cpu_full_pressure_stall_time" , NULL , "cpu" - , "cgroup.cpu_full_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_full_pressure_stall_time" : "cgroup.cpu_full_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4638,7 +4669,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4660,7 +4691,7 @@ void update_cgroup_charts(int update_every) { , "mem_some_pressure" , NULL , "mem" - , "cgroup.memory_some_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_some_pressure" : "cgroup.memory_some_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4668,8 +4699,8 @@ void update_cgroup_charts(int update_every) { , cgroup_containers_chart_priority + 2300 , update_every , RRDSET_TYPE_LINE - ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + ); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "some 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "some 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "some 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4684,7 +4715,7 @@ void update_cgroup_charts(int update_every) { , "memory_some_pressure_stall_time" , NULL , "mem" - , "cgroup.memory_some_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_some_pressure_stall_time" : "cgroup.memory_some_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4693,7 +4724,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4714,7 +4745,7 @@ void update_cgroup_charts(int update_every) { , "mem_full_pressure" , NULL , "mem" - , "cgroup.memory_full_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_full_pressure" : "cgroup.memory_full_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4723,8 +4754,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "full 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "full 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "full 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4739,7 +4770,7 @@ void update_cgroup_charts(int update_every) { , "memory_full_pressure_stall_time" , NULL , "mem" - , "cgroup.memory_full_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_full_pressure_stall_time" : "cgroup.memory_full_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4748,7 +4779,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4770,7 +4801,7 @@ void update_cgroup_charts(int update_every) { , "io_some_pressure" , NULL , "disk" - , "cgroup.io_some_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_some_pressure" : "cgroup.io_some_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4779,7 +4810,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "some 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "some 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "some 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4794,7 +4825,7 @@ void update_cgroup_charts(int update_every) { , "io_some_pressure_stall_time" , NULL , "disk" - , "cgroup.io_some_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_some_pressure_stall_time" : "cgroup.io_some_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4803,7 +4834,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4823,7 +4854,7 @@ void update_cgroup_charts(int update_every) { , "io_full_pressure" , NULL , "disk" - , "cgroup.io_full_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_full_pressure" : "cgroup.io_full_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4832,7 +4863,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "full 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "full 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "full 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4847,7 +4878,7 @@ void update_cgroup_charts(int update_every) { , "io_full_pressure_stall_time" , NULL , "disk" - , "cgroup.io_full_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_full_pressure_stall_time" : "cgroup.io_full_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4856,7 +4887,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); |