m3coordinator doesn't return variable value when time range is set in the future
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
@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.
Will take a look at this one.
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.
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 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 do you have any solution for the above-discussed issue?
@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.