diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2023-01-25 10:41:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-25 10:41:51 +0200 |
commit | 2516d29ceb2f99f87831a38a81fb59bf330ab9ca (patch) | |
tree | d749b86aa50f991dc93f6ff0cbc6d237f14d1ca7 | |
parent | 22093a656b68a8816322472a7b150a70fd1c09ce (diff) |
fix(proc.plugin): add "cpu" label to per core util% charts (#14322)
* fix(proc.plugin): add cpu label to per core util% charts
* fix codeql warning
-rw-r--r-- | collectors/proc.plugin/proc_stat.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c index 4fe332e524..408b1c0559 100644 --- a/collectors/proc.plugin/proc_stat.c +++ b/collectors/proc.plugin/proc_stat.c @@ -712,6 +712,12 @@ int do_proc_stat(int update_every, usec_t dt) { cpu_chart->rd_idle = rrddim_add(cpu_chart->st, "idle", NULL, multiplier, divisor, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); rrddim_hide(cpu_chart->st, "idle"); + if (core > 0) { + char cpu_core[50 + 1]; + snprintfz(cpu_core, 50, "cpu%lu", core - 1); + rrdlabels_add(cpu_chart->st->rrdlabels, "cpu", cpu_core, RRDLABEL_SRC_AUTO); + } + if(unlikely(core == 0 && cpus_var == NULL)) cpus_var = rrdvar_custom_host_variable_add_and_acquire(localhost, "active_processors"); } |