Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
957 views
in Technique[技术] by (71.8m points)

range query - How to calculate the duration in which some Prometheus metric has specific value aggregated by some label

My application has several jobs that return job_status gauge metric with values 0, 1, 2, 3, 4, 5. Status 1 - means 'running'. Jobs can be 'running' in parallel or not, sometimes with intersections (see blue lines):

enter image description here

I need to calculate how much time at least 1 job was in status 1 ('running') - it can be visualized as a sum of red lines. Additional problem is that I need to aggregate this by job_name label (there are several jobs with the same job_name, but different job_id).

question from:https://stackoverflow.com/questions/65651859/how-to-calculate-the-duration-in-which-some-prometheus-metric-has-specific-value

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...