m3 icon indicating copy to clipboard operation
m3 copied to clipboard

m3coordinator doesn't return variable value when time range is set in the future

Open Nexucis opened this issue 7 years ago • 7 comments

Hello,

On Grafana I set the time range at "Today", and I reload the dashboard.

And when Grafana try to load the variable value, m3coordinator returns nothing, which after prevents to load the data in the different panel.

To get the value of my different variable, I used the method "query_result" like that for example:

query_result(max by (severity) (my_metric))

I believe that's because when Grafana send the request, it set the time into the future and the coordinator don't have the logic to fallback at the current time

Version used

Grafana : v6.1.3 m3db : v0.8.3 prometheus: v2.9.1

Nexucis avatar Apr 18 '19 09:04 Nexucis

@benraskin92 @arnikola Seems like a use case we want working. Maybe we can always adjust future time to now and return some sort of warning stating what we did.

martin-mao avatar Apr 22 '19 07:04 martin-mao

Will take a look at this one.

benraskin92 avatar Apr 30 '19 13:04 benraskin92

This is actually an issue with Grafana (https://github.com/grafana/grafana/issues/16661). The tl;dr is that Grafana will issue an instant query that is in the future to Prometheus when you select Today for example. However, because Prometheus/M3DB doesn't have the data available for that time, it returns no results. IMO Grafana should just use time.Now for all instant queries that are used in variables.

benraskin92 avatar Apr 30 '19 15:04 benraskin92

We could put in a hack that converts all instant queries to use time.Now() if it's in the future. However, I would rather just let Grafana fix this on their end since I'm not sure what (if any) repercussions there are for such a hack.

benraskin92 avatar Apr 30 '19 15:04 benraskin92

@benraskin92 I am planning to take a stab at the Grafana PR this weekend, as it looks quite simple to implement and will copy you on that progress for awareness.

jranson avatar May 03 '19 13:05 jranson

@jranson do you have any solution for the above-discussed issue?

csesanram avatar Sep 20 '19 12:09 csesanram

@csesanram it looks like the Grafana team has closed the issue I filed (grafana/grafana#16661) because they believe this behavior actually works as designed and disagree that Today should use time.Now() for instantaneous. I tried really hard to convince them, to no avail. To their credit, they do offer some work-arounds in the closing comments of the issue, which may work for your situation.

jranson avatar Oct 21 '19 21:10 jranson