Skip to content

Commit 20e5af2

Browse files
committed
Expose PSI metric for CPU full
Signed-off-by: Felix Ehrenpfort <[email protected]>
1 parent e238b08 commit 20e5af2

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

metrics/prometheus.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,13 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
17541754
if includedMetrics.Has(container.PressureMetrics) {
17551755
c.containerMetrics = append(c.containerMetrics, []containerMetric{
17561756
{
1757+
name: "container_pressure_cpu_stalled_seconds_total",
1758+
help: "Total time duration no tasks in the container could make progress due to CPU congestion.",
1759+
valueType: prometheus.CounterValue,
1760+
getValues: func(s *info.ContainerStats) metricValues {
1761+
return metricValues{{value: asMicrosecondsToSeconds(s.Cpu.PSI.Full.Total), timestamp: s.Timestamp}}
1762+
},
1763+
}, {
17571764
name: "container_pressure_cpu_waiting_seconds_total",
17581765
help: "Total time duration tasks in the container have waited due to CPU congestion.",
17591766
valueType: prometheus.CounterValue,

metrics/testdata/prometheus_metrics

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ container_perf_uncore_events_total{container_env_foo_env="prod",container_label_
381381
# TYPE container_perf_uncore_events_scaling_ratio gauge
382382
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",container_label_foo_label="bar",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="0",zone_name="hello"} 1 1395066363000
383383
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",container_label_foo_label="bar",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="1",zone_name="hello"} 1 1395066363000
384+
# HELP container_pressure_cpu_stalled_seconds_total Total time duration no tasks in the container could make progress due to CPU congestion.
385+
# TYPE container_pressure_cpu_stalled_seconds_total counter
386+
container_pressure_cpu_stalled_seconds_total{container_env_foo_env="prod",container_label_foo_label="bar",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0001 1395066363000
384387
# HELP container_pressure_cpu_waiting_seconds_total Total time duration tasks in the container have waited due to CPU congestion.
385388
# TYPE container_pressure_cpu_waiting_seconds_total counter
386389
container_pressure_cpu_waiting_seconds_total{container_env_foo_env="prod",container_label_foo_label="bar",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0002 1395066363000

metrics/testdata/prometheus_metrics_whitelist_filtered

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,9 @@ container_perf_uncore_events_total{container_env_foo_env="prod",event="cas_count
381381
# TYPE container_perf_uncore_events_scaling_ratio gauge
382382
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="0",zone_name="hello"} 1 1395066363000
383383
container_perf_uncore_events_scaling_ratio{container_env_foo_env="prod",event="cas_count_read",id="testcontainer",image="test",name="testcontaineralias",pmu="uncore_imc_0",socket="1",zone_name="hello"} 1 1395066363000
384+
# HELP container_pressure_cpu_stalled_seconds_total Total time duration no tasks in the container could make progress due to CPU congestion.
385+
# TYPE container_pressure_cpu_stalled_seconds_total counter
386+
container_pressure_cpu_stalled_seconds_total{container_env_foo_env="prod",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0001 1395066363000
384387
# HELP container_pressure_cpu_waiting_seconds_total Total time duration tasks in the container have waited due to CPU congestion.
385388
# TYPE container_pressure_cpu_waiting_seconds_total counter
386389
container_pressure_cpu_waiting_seconds_total{container_env_foo_env="prod",id="testcontainer",image="test",name="testcontaineralias",zone_name="hello"} 0.0002 1395066363000

0 commit comments

Comments
 (0)