New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Average value not calculated right? #2051
Comments
Can you indicate how the value is wrong, what value you expected and what the input data is? |
So, as you can see from the screen shot, last value is 60, the value before that it is 67. How is the average 66.4166 (based on the response screenshot)? I expected to be last value or the average of last two values (not still sure how Prometheus is calculating it) |
@slavede What you see in the graph are 60s-spaced interpolated query evaluation points. Not the raw samples in the database. The range vector that you input into
Of course, then @brian-brazil might still say that one shouldn't average over temperatures at all ;) |
Cool, thanks, nice explanation. Then, if I do: /api/v1/query_range?query=avg_over_time(current_temp[5m])&start=1475483802.739&end=1475498202.739&step=600&_=1475493021942 This would do the following: Each 600 seconds read current temperature for the last 5 minutes (every point you have) and calculate average temperature, and do this between 1475483802.739 and 1475498202.739? |
The language in your last sentence is slightly ambiguous, so depending on what exactly you mean, it's correct or incorrect :) Let me rephrase it: starting at timestamp 1475483802.739 and ending at timestamp 1475498202.739, the query "avg_over_time(...)" gets executed at regular instants that are 600 seconds apart. At every such instant, Prometheus calculates the average over all sample values (within each series) stretching back 5 minutes from that instant. This produces the output sample value for that instant. Note that some samples are skipped completely, since your time averaging time window is 5 minutes, but your query resolution step is 10 minutes (600s). |
Yeah, that's what I meant :). Thanks, it's clear explanation. And yes, they are skipped, I've just put it there as an example. Thank you very much for your help. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What did you do?
Tried to get average value
What did you expect to see?
Correctly calculated value
What did you see instead? Under which circumstances?
Wrong value
Environment
Linux 2.6.32-358.el6.x86_64 x86_64
Prometheus version:
build user: root@3e392b8b8b44
build date: 20160916-11:36:30
go version: go1.6.3
Alertmanager version:
insert output of
alertmanager -version
here (if relevant to the issue)Prometheus configuration file:
Similar question here:
http://stackoverflow.com/questions/39831998/how-does-prometheus-db-calculate-average-value
The text was updated successfully, but these errors were encountered: