Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upmin_over_time query not working as expected #4367
Comments
This comment has been minimized.
This comment has been minimized.
|
The data shows that the minimum over the minute is 40. |
This comment has been minimized.
This comment has been minimized.
hoffie
commented
Jul 10, 2018
... yet Prometheus seems to return 60 according the report. @eriksjoberg: Maybe the output of |
This comment has been minimized.
This comment has been minimized.
tejaswiniVadlamudi
commented
Jul 10, 2018
|
Prometheus should return 40, but it returns 60 here. Maybe min_over_time function is not working as expected. Is there any way to get more logs from DEBUG log level for this case? |
This comment has been minimized.
This comment has been minimized.
|
@hoffie @brian-brazil Hi, yes as Teja wrote I would like to get more DEBUG info. I could not find any useful debug info related to metrics collection or the min value over time using the existing debug.loglevel setting. The query range command has the below info: 1000 1531239027.674 Technically, we should get 40 as mentione in the issue section, but we got 60. |
This comment has been minimized.
This comment has been minimized.
|
The query is as expected, the 40 data point is 3 seconds outside the range vector. |
This comment has been minimized.
This comment has been minimized.
|
@brian-brazil Hi, thanks for the answer. I am new to Prometheus, but I think I understand now. This is due to the scrape intervals and if the value 40 is there in the beginning of that granularity period but it changes before the first scraping within that granularity period is done it will not be included in the result right? |
This comment has been minimized.
This comment has been minimized.
|
It's not to do with scraping, you're most likely getting confused by staleness. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
That image is confusing, but it'll be 66 if I'm reading it right. |
This comment has been minimized.
This comment has been minimized.
|
Ok thanks Brian. |
eriksjoberg
closed this
Jul 12, 2018
This comment has been minimized.
This comment has been minimized.
lock
bot
commented
Mar 22, 2019
|
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. |

eriksjoberg commentedJul 10, 2018
•
edited
Bug Report
What did you do?
We had a java based test application which will increment/decrement a specific guage named: metric_1.
Prometheus is configured to scrape this test application for every 15 seconds.
When we tried to get the minimum value of the metric over a time period of 1minute, we observed that the query return value from Prometheus is not correct.
What did you expect to see?
Here is the data available in internal time series database:
curl -g 'http://prometheus:9090/api/v1/query_range?query=metric_1&start=2018-07-10T16:12:00.000Z&end=2018-07-10T16:13:00.000Z&step=1s'
{"status":"success","data":{"resultType":"matrix","result":[{"metric":{"name":"metric_1","app":"pm-testapp","chart":"pm-testapp-1.0.0-1","heritage":"Tiller","instance":"192.168.125.191:8080","job":"pm-testapp","kubernetes_name":"pm-testapp","kubernetes_namespace":"ns","release":"testapp"},"values":[[1531239120,"40"],[1531239121,"40"],[1531239122,"40"],[1531239123,"40"],[1531239124,"40"],[1531239125,"40"],[1531239126,"40"],[1531239127,"40"],[1531239128,"40"],[1531239129,"40"],[1531239130,"40"],[1531239131,"40"],[1531239132,"40"],[1531239133,"40"],[1531239134,"40"],[1531239135,"40"],[1531239136,"40"],[1531239137,"40"],[1531239138,"80"],[1531239139,"80"],[1531239140,"80"],[1531239141,"80"],[1531239142,"80"],[1531239143,"80"],[1531239144,"80"],[1531239145,"80"],[1531239146,"80"],[1531239147,"80"],[1531239148,"80"],[1531239149,"80"],[1531239150,"80"],[1531239151,"80"],[1531239152,"80"],[1531239153,"70"],[1531239154,"70"],[1531239155,"70"],[1531239156,"70"],[1531239157,"70"],[1531239158,"70"],[1531239159,"70"],[1531239160,"70"],[1531239161,"70"],[1531239162,"70"],[1531239163,"70"],[1531239164,"70"],[1531239165,"70"],[1531239166,"70"],[1531239167,"70"],[1531239168,"60"],[1531239169,"60"],[1531239170,"60"],[1531239171,"60"],[1531239172,"60"],[1531239173,"60"],[1531239174,"60"],[1531239175,"60"],[1531239176,"60"],[1531239177,"60"],[1531239178,"60"],[1531239179,"60"],[1531239180,"60"]]}]}}
when we ran min_over_time in the above time period, we should get something like:
curl -g 'http://prometheus:9090/api/v1/query?query=min_over_time(metric_1[1m])&time=2018-07-10T16:13:00.000Z'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"app":"pm-testapp","chart":"pm-testapp-1.0.0-1","heritage":"Tiller","instance":"192.168.125.191:8080","job":"pm-testapp","kubernetes_name":"pm-testapp","kubernetes_namespace":"ns","release":"testapp"},"value":[1531239180,"40"]}]}}
What did you see instead? Under which circumstances?
curl -g 'http://prometheus:9090/api/v1/query?query=min_over_time(metric_1[1m])&time=2018-07-10T16:13:00.000Z'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"app":"pm-testapp","chart":"pm-testapp-1.0.0-1","heritage":"Tiller","instance":"192.168.125.191:8080","job":"pm-testapp","kubernetes_name":"pm-testapp","kubernetes_namespace":"ns","release":"testapp"},"value":[1531239180,"60"]}]}}
60 is incorrect value considering the time series information available in prometheus.
Please find the attached graph confirming the same.

Environment
Kubernetes
System information:
Run on Kubernetes 1.9.6 version
Prometheus version:
2.2.0
Prometheus configuration file: