9

Calculating the maximum quantile over all dataseries is a problem for me:

query

http_response_time{job=~"^(x|y)$", quantile="0.95",...}

result

http_response_time{job="x",...} 0.26
http_response_time{job="y",...} NaN

This is how I would try to calculate the maximum:

avg(http_response_time{job=~"^(x|y)$",...})

Now the result will be "NaN". How can I ignore the "NaN" result (from the result section)?

UPDATE 0

The metric is a self made summary-metric.

UPDATE 1

Using prometheus version 1.8.

SecretAgentMan
  • 2,856
  • 7
  • 21
  • 41
eventhorizon
  • 2,977
  • 8
  • 33
  • 57

1 Answers1

23

I didn't try this one with NaN, but you can simply filter by values with binary operators. Since NaN mathematically doesn't equal NaN you could try this trick (since a response time should be always positive):

avg(http_response_time{job=~"^(x|y)$",...} >= 0)
svenwltr
  • 17,002
  • 12
  • 56
  • 68