How I can display metric presence duration in grafana?

Viewed 34

Currently I monitor presence of snapshot POD (it runs from time to time, does his job and finishes it's execution) with following PromQL query:

container_cpu_usage_seconds_total{pod=~"worker-service-snapshot-.*", container="POD"} / container_cpu_usage_seconds_total{pod=~"worker-service-snapshot-.*", container="POD"}

So it just returns 1 when cpu metric was recorded.

In grafana it looks like this (added comments what I want to achieve):

enter image description here

My label format is {{container}} right now. How I can display (over time series or in legend) duration for how long POD was up and running?

0 Answers
Related