Thank you Brian.

Arjun

On Tue, Nov 3, 2020 at 8:43 AM Brian Candler <b.cand...@pobox.com> wrote:

> On Tuesday, 3 November 2020 15:04:56 UTC, Arjun wrote:
>>
>> I wanted to understand this in the context of "sum of rate". What is
>> "sum" summing up here and across which time period?
>>
>> sum(rate(http_counter[1m])) by (status_code) * 60
>>
>>
> You'll find it easier to understand if you build up the query in stages.
> Try each of the following in the PromQL browser in the prometheus web
> interface:
>
> http_counter
>
> rate(http_counter[1m])
>
> sum(rate(http_counter[1m])) by (status_code)
>
> sum(rate(http_counter[1m])) by (status_code) * 60
>
> You are calculating a rate over a 1 minute period: in fact, what
> prometheus does is take the first and last data points within that 1 minute
> window, so if you're sampling at 15 second intervals, the rate will
> actually be calculated over the 45 second period between the first and last
> sample in that window.
>
> <--------60s--------->
> [..X....X....X....X..]
>    <-----45s------>  ^
>                      |
>                      T
>
> That rate is an *instant vector*: that is, it is for a *single point in
> time (T)*, returning a single value for each timeseries.  It's calculated
> over the 1 minute window up to that instant.
>
> You are then summing over that set of timeseries.  Again you get an
> instant vector, but this time with all the values with the same status_code
> label are summed.
>
> Then you are multiplying by 60.  Instant vector * scalar gives instant
> vector, but with all the values multiplied up.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Prometheus Users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/prometheus-users/imOIZyqHvcc/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> prometheus-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/prometheus-users/c1ca390a-3318-456c-b2ef-05d1597d2681o%40googlegroups.com
> <https://groups.google.com/d/msgid/prometheus-users/c1ca390a-3318-456c-b2ef-05d1597d2681o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 prometheus-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/prometheus-users/CACHor%2BW5pkmNhMGS-cp01_YOQtwy-io5rUM%3DESQpcOT_kFNcSA%40mail.gmail.com.

Reply via email to