To calculate the average request duration during the last 5 minutes from a histogram or summary called
http_request_duration_seconds, use the following expression:rate(http_request_duration_seconds_sum[5m]) / rate(http_request_duration_seconds_count[5m])
(a)http_request_duration_seconds_sum[5m] -- is a growing sum of request duration over last 5m,
rate(a) -- average value of request duration per second over last 5m. Rigth ?
what means division byrate(http_request_duration_seconds_count[5m])?
I continue study prometheus.
Sorry for a stupid question but i don't understand what function rate() does and how it's calculated
Yes, i have readed docs https://prometheus.io/docs/querying/functions/#rate%28%29 but all what i understood it's
that rate() calcs _average_ value of deltas between values of given vector divided by scrape internal (const)
Example from my prometheus console:
settings
a) scrap interval time of prometheus itself -- 5s
query to see vector in 10s (must be 2 values):
http_request_duration_microseconds_sum{handler="prometheus",instance="localhost:9090",job="prometheus"}[10s]
80495.79999999999 @1458245879.227
82492.09999999999 @1458245884.227
first column is a observed value, second column -- timestamp when server scraped given value
so, rate = ( 82492 - 80495) / ( 1458245884 - 1458245879 ) = 1997 / 5 ~ 399
Is it right? As i understand rate can use some interpolation and result can be little different
real rate: rate(http_request_duration_microseconds_sum{handler="prometheus",instance="localhost:9090",job="prometheus"}[10s]) ~ 347
test b)
set scrap intrval to 25s
query:
http_request_duration_microseconds_sum{handler="prometheus",instance="localhost:9090",job="prometheus"}[50s]
result:
22937.5 @1458246532.324
27891 @1458246557.325
rate = (27891 -22937 ) / 25 ~ 198
real rate(http_request_duration_microseconds_sum{handler="prometheus",instance="localhost:9090",job="prometheus"}[50s]) ~ 198
2) Don't understand why example from http://prometheus.io/docs/practices/histograms/#count-and-sum-of-observations
To calculate the average request duration during the last 5 minutes from a histogram or summary called
http_request_duration_seconds, use the following expression:rate(http_request_duration_seconds_sum[5m]) / rate(http_request_duration_seconds_count[5m])correct(a)http_request_duration_seconds_sum[5m] -- is a growing sum of request duration over last 5m,
rate(a) -- average value of request duration per second over last 5m. Rigth ?
what means division byrate(http_request_duration_seconds_count[5m])?
Sorry for simple questions -- i'm new in metrics and prometheus my first monitoring system.
I will be grateful if somebody suggest me general topics about metrics and how ones calculated.
Thanks
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-devel...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Prometheus Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-developers+unsub...@googlegroups.com.
To post to this group, send email to prometheus-developers@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-developers/f13df36a-99ea-474e-9ead-b780dcebc05a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
so rate(M[xm])=(Mx-M0)/(a or x)