We have found the source of the problem.
The PromQL query is wrong because the dividend is not interpreted by the 
division.

Exemple:

For this query :

irate(http_server_requests_duration_seconds_sum{application="database-api", 
namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
 
> 0 / 
> irate(http_server_requests_duration_seconds_count{application="database-api", 
> namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
>  > 0

PromQL split this query in to part
First part:

0 / 
irate(http_server_requests_duration_seconds_count{application="database-api", 
namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
 > 0

Result : 0 # because 0/xxxx always return 0
And the next step is :

irate(http_server_requests_duration_seconds_sum{application="database-api", 
namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
 
> 0 

The result is just the value of the irate greater than 0.
So the right PromQL query must be

(irate(http_server_requests_duration_seconds_sum{application="database-api", 
namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
 
> 0) / 
> (irate(http_server_requests_duration_seconds_count{application="database-api",
>  
> namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
>  > 0) 

And then the result is OK [image: :beers:]
So for the first query I have posted, must look likes this :

avg((irate(http_server_requests_duration_seconds_sum{application="database-api",
 
namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
 > 0)
/ 
(irate(http_server_requests_duration_seconds_count{application="database-api", 
namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
 > 0))

Best regards 

Le jeudi 16 avril 2020 10:30:38 UTC+2, Rico a écrit :
>
> Hello
> I have a question about a query. When I made this PromQL expression :
>
> avg(irate(http_server_requests_duration_seconds_sum{application="database-api",
>  
> namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
>  > 0
> / 
> irate(http_server_requests_duration_seconds_count{application="database-api", 
> namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
>  > 0)
>
> I have this result:
>
> 0.6882829615020314
>
> And when I removed the > 0 from the dividend I have a different result 
> and I cannot undestand why...
> Expression :
>
> avg(irate(http_server_requests_duration_seconds_sum{application="database-api",
>  
> namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
> / 
> irate(http_server_requests_duration_seconds_count{application="database-api", 
> namespace="front-search-engine",path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck",status="200"}[1m])
>  > 0)
>
> Result :
>
> 0.025240713195708097
>
> Does anyone here know why ? Thanks for your support [image: :+1:]
>

-- 
You received this message because you are subscribed to the Google Groups 
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/4bd2cebf-2d5c-4842-af91-5089ef96248d%40googlegroups.com.

Reply via email to