4

I have a metric say x, of type gauge, And the values are reported every 5m.

Now I want to make a query such that, I get sum of values in each hour in a day.

Exmaple: from 3PM to 5PM, the gauge values are 1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2,1,1,1,1,1,2,2,2,2,2 reported every 5 minutes - total 60 values

The result of my query should be 3PM-4PM -> 45 and 4PM-5PM -> 45 (sum of all values in the hour)

TIA

Chaitanya Mankala
  • 1,594
  • 17
  • 24

1 Answers1

2

See Prometheus count query for a particular period

Just use sum_over_time(x[1h]) instead and 3600 as resolution/step.

sskrlj
  • 199
  • 4