From: Florian Forster Date: Tue, 5 Dec 2023 10:26:43 +0000 (+0100) Subject: cpu plugin: Use standard system metric names (OTEP #119) X-Git-Tag: 6.0.0-rc0~40^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f97920f32b6207d6549e347e90245a10e28dfa6;p=thirdparty%2Fcollectd.git cpu plugin: Use standard system metric names (OTEP #119) https://github.com/open-telemetry/oteps/blob/main/text/0119-standard-system-metrics.md --- diff --git a/src/cpu.c b/src/cpu.c index 436d2c55a..86f6016cc 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -442,7 +442,7 @@ static void aggregate(gauge_t *sum_by_state) /* {{{ */ static void cpu_commit_one(int cpu_num, /* {{{ */ gauge_t rates[static COLLECTD_CPU_STATE_MAX]) { metric_family_t fam = { - .name = "cpu_usage_percent", + .name = "system.cpu.utilization", .type = METRIC_TYPE_GAUGE, }; @@ -450,8 +450,8 @@ static void cpu_commit_one(int cpu_num, /* {{{ */ if (cpu_num == -1) { metric_label_set(&m, "cpu", "total"); } else { - char cpu_num_str[16]; - snprintf(cpu_num_str, sizeof(cpu_num_str), "%d", cpu_num); + char cpu_num_str[32]; + ssnprintf(cpu_num_str, sizeof(cpu_num_str), "%d", cpu_num); metric_label_set(&m, "cpu", cpu_num_str); } @@ -515,7 +515,7 @@ static void cpu_reset(void) /* {{{ */ static void cpu_commit_without_aggregation(void) /* {{{ */ { metric_family_t fam = { - .name = "cpu_usage_total", + .name = "system.cpu.time", .type = METRIC_TYPE_COUNTER, };