Getting time range while loading template

Hey guys, is there a way to get dashborad timerange inside of functions metricFindQuery/ Adhoc functions(Get key/values)?
Currently i am trying to implement adhoc templating based on druid sql, getting keys is very easy, but get all values without specifying time range can be really expensive

I am using grafana 5, templateSrv does not replace variables like __interval/__timeFilter,etc :C

ok , i found how to make it work in metricFindQuery, but how i can get time range in ad hoc functions?
especially in get values function

const range = this.timeSrv.timeRange();, see

1 Like