Skip to content

Commit

Permalink
Fix prometheus metrics units
Browse files Browse the repository at this point in the history
Signed-off-by: bpopovschi <[email protected]>
  • Loading branch information
Zyqsempai committed Dec 16, 2019
1 parent b98cc79 commit 6bfb248
Show file tree
Hide file tree
Showing 2 changed files with 523 additions and 26 deletions.
36 changes: 18 additions & 18 deletions metrics/cgroups/v2/cpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (

var cpuMetrics = []*metric{
{
name: "cpu",
help: "Current cpu usage_usec (cgroup v2)",
unit: metrics.Unit("usage_usec"),
name: "cpu_usage",
help: "Total cpu usage (cgroup v2)",
unit: metrics.Nanoseconds,
vt: prometheus.GaugeValue,
getValues: func(stats *v2.Metrics) []value {
if stats.CPU == nil {
Expand All @@ -42,9 +42,9 @@ var cpuMetrics = []*metric{
},
},
{
name: "cpu",
help: "Current cpu user_usec (cgroup v2)",
unit: metrics.Unit("user_usec"),
name: "cpu_user_usage",
help: "Current cpu usage in user space (cgroup v2)",
unit: metrics.Nanoseconds,
vt: prometheus.GaugeValue,
getValues: func(stats *v2.Metrics) []value {
if stats.CPU == nil {
Expand All @@ -58,9 +58,9 @@ var cpuMetrics = []*metric{
},
},
{
name: "cpu",
help: "Current cpu system_usec (cgroup v2)",
unit: metrics.Unit("system_usec"),
name: "cpu_kernel_usage",
help: "Current cpu usage in kernel space (cgroup v2)",
unit: metrics.Nanoseconds,
vt: prometheus.GaugeValue,
getValues: func(stats *v2.Metrics) []value {
if stats.CPU == nil {
Expand All @@ -74,9 +74,9 @@ var cpuMetrics = []*metric{
},
},
{
name: "cpu",
help: "Current cpu nr_periods (only if controller is enabled)",
unit: metrics.Unit("nr_periods"),
name: "cpu_nr_periods",
help: "Current cpu number of periods (only if controller is enabled)",
unit: metrics.Total,
vt: prometheus.GaugeValue,
getValues: func(stats *v2.Metrics) []value {
if stats.CPU == nil {
Expand All @@ -90,9 +90,9 @@ var cpuMetrics = []*metric{
},
},
{
name: "cpu",
help: "Current cpu nr_throttled (only if controller is enabled)",
unit: metrics.Unit("nr_throttled"),
name: "cpu_nr_throttled",
help: "Total number of times tasks have been throttled (only if controller is enabled)",
unit: metrics.Total,
vt: prometheus.GaugeValue,
getValues: func(stats *v2.Metrics) []value {
if stats.CPU == nil {
Expand All @@ -106,9 +106,9 @@ var cpuMetrics = []*metric{
},
},
{
name: "cpu",
help: "Current cpu throttled_usec (only if controller is enabled)",
unit: metrics.Unit("throttled_usec"),
name: "cpu_throttled_usec",
help: "Total time duration for which tasks have been throttled. (only if controller is enabled)",
unit: metrics.Nanoseconds,
vt: prometheus.GaugeValue,
getValues: func(stats *v2.Metrics) []value {
if stats.CPU == nil {
Expand Down
Loading

0 comments on commit 6bfb248

Please sign in to comment.