grafana-discrete-panel icon indicating copy to clipboard operation
grafana-discrete-panel copied to clipboard

Expand 'from' query option not working correctly

Open mkfink opened this issue 6 years ago • 6 comments

I just upgraded discrete panel to 0.0.7 from 0.0.6 and Grafana from 4.6.3 to 5.0.4 and the "Expand 'from' query" option is no longer working as it used to. When I enter some number of seconds, Grafana expands both the the query and the displayed graph by that amount instead of just the query. So if my time range in Grafana is set to 'now-24h' and I enter Expand 'from' query: 86400, then the displayed graph is 2 days long instead of 1 day.

mkfink avatar Apr 15 '18 00:04 mkfink

this value (time in seconds) has no effect at mines (v0.0.9). is this working as expected?

dddesign avatar May 19 '19 20:05 dddesign

Hello, I'm having the same issue. Anybody else? Did anybody figure out a fix? Thanks!

zitroaen avatar Jun 03 '19 19:06 zitroaen

Hi, i'm using Grafana 6.2.5 and Discrete panel 0.0.9 with the same problem like dddesign. Entering a value into the "Expand 'from' query" doesn't change anything at my panel. Is there still no fix known?

UPDATE: I just found a work around. Instead of entering the value within the textbox "Expand 'from' query" within the query window you can switch to text editor mode and change the query text by using the variables $__to and $__from. Instead of "...AND $timeFilter" you can write "...AND $__to <= time AND time >= $__from - 1w". The expand of 1 week (1w) was just for testing.

I should mention that i'm new to Grafana. So please do not take it amiss and let me know if i'm wrong with that. In my case i seems to work. discrete panel workaround

mattbue avatar Jul 19 '19 15:07 mattbue

I have the same problem, which breaks most use cases when analyzing recent events (because the discrete panel query does not recognize the last status before the current selected time period of interest). Can someone please fix that "expand 'from' query" is considered correctly?

mghomedev avatar Jan 04 '20 16:01 mghomedev

The workaround by @mattbue didn't work for me. I'm using an InfluxDB. After a bit of try and error this solution works. In my example with 4 hours expand.

Replace $timeFilter with:

time >= ${__from}ms - 4h AND time <= ${__to}ms

dreamsinmotion avatar Jan 30 '20 00:01 dreamsinmotion

@mattbue , I'm having the same issue i cannot get "expand from query" to work. how would i do what you suggested only on MS SQL ? here is my current query. I tried your exact and it's not recognizing the "w" in 1w

SELECT $__timeEpoch(line_datetime), case when line_status = 'OFFLINE' then 0 when line_status = 'ONLINE' then 1 end as value, line_name as metric FROM line_status WHERE $__timeFilter(line_datetime) AND line_name = 'XYZ' ORDER BY line_name ASC

thanosazlin avatar Oct 05 '20 23:10 thanosazlin