Thank for your quick answer and for the tips and tricks ! :) 

Le jeudi 16 avril 2020 13:25:05 UTC+2, Julius Volz a écrit :
>
> On Thu, Apr 16, 2020 at 12:05 PM Rico <[email protected] <javascript:>> 
> wrote:
>
>> 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))
>>
>>
> One word of caution here: if I see this correctly, you are taking the 
> average of multiple averages, which is usually incorrect: 
> https://math.stackexchange.com/questions/95909/why-is-an-average-of-an-average-usually-incorrect
>
> If your goal is to calculate the overall average latency of your service, 
> you will want to just sum up over all sums and counts before doing the 
> division (and then you can omit the outer avg()). You probably don't need 
> the > 0 bit either then, so the whole expression would just become:
>
>   sum(irate(xxx_sum{...}[1m]))
> /
>   sum(irate(xxx_count{...}[1m]))
>
> Btw., you can also abbreviate:
>
>     path!="/ping",path!="/health",path!="/metrics",path!="/healthcheck"
>
> ...to just:
>
>     path!~"/(ping|metrics|healthcheck)"
>

-- 
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/5f980db5-3171-46c6-8cbf-cfbd647672f1%40googlegroups.com.

Reply via email to