Bug? "Data outside time range" when changing time range, gone after refresh

Hello everyone,
Over the past few months I’ve been slipping deeper and deeper into Grafana and I’m still impressed and surprised with what I encounter. About my question, I am well aware that a lot of similar posts exists and, yes, I included WHERE $__timeFilter(DT) in my query.

This will be my first post, so be nice :slight_smile:

  • What Grafana version and what operating system are you using?
    Grafana v8.5.3 (409e9bc9a)
    Windows 10 enterprise 20h2
    Chrome

  • What are you trying to achieve?
    Display data from a table from a timerange of my choosing

  • How are you trying to achieve it?
    I have the following query (formatted as table) which displays the data in a timeseries panel.

SELECT   
  DT AS "time"
, level
FROM
  buffer
WHERE
  $__timeFilter(DT)
ORDER BY DT`

The dashboard’s timepicker is set to a static time range, and then I use the < > buttons to move the time range back and forth. (Although the same behaviour can be replicated when manually adjusting the time range and using the apply time range button, or when using a datalink/URL, without reloading the dashboard)

  • What happened?
    When navigating to a time range that doesn’t contain any data I get the Data outside time range - zoom to data message even though the query doesn’t return any data at all. The funny thing is, this only happens when the panel contained data before the redraw. If I hit refresh (or wait 5 seconds for the auto-refresh to kick in) the message disappears and the panel shows an empty graph (as expected). When navigating to this timerange from another time that also didn’t contain data, the message doesn’t show up.

Consider the following setup:


The timeseries panel on the left contains the query, the table panel on the right has the left panel set as datasource. The time range is set to 07:30 → 08:30, data collection started at 8:19, this renders without any trouble.

image
Next, I move the timeframe back half an hour to 07:00 → 08:00
image

and then this happens:


I believe this is a bug, the panel indicates that the data is outside of the time range, but there is no data at all, as is shown by the table panel. When navigating to this time range from say 06:00 → 07:00 it wont trigger the message. Pressing ‘refresh’ causes the panel to reload and also removes the message.

  • What did you expect to happen?
    I expected the panel to show an empty graph without the “data outside time range” message

  • Can you copy/paste the configuration(s) that you are having problems with?
    no special configuration used, left everything as default on a clean dashboard.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    Grafana did not provide any error pop-ups. There were no error icons in the panel. Chrome’s console log doesn’t throw any errors either

  • Did you follow any online instructions? If so, what is the URL?
    n/a

I hope I provided enough information and I look forward to a solution.

Regards,
Guido

2 Likes

welcome to the :grafana: community @Guido!

I’m not sure if this is exactly what you’re seeing, but there is a bug where the state can get stale and display data outside of time range when data is there. It sounds like you could be seeing another symptom of the stale state since a refresh fixes it for you.

I am seeing the same thing, I am getting always 1.5 hours of logs, it doesn’t matter if I change the range to 5m or 15m or 24 hours, I am on v9.2.2, it wasn’t like this previously.

What can I do to help debug? I am using grafana with the query “{unit=“loki.service”}” The logs state it is 5m but it is not applying that range to the table:

level=info ts=2022-10-30T21:16:05.382279829Z caller=metrics.go:81 org_id=fake traceID=41a9bdf00aae7914 latency=fast query="{unit=\"loki.service\"}" query_type=limited range_type=range length=5m0s step=100ms duration=4.65024ms status=200 throughput_mb=100.258696 total_bytes_mb=0.466227

Thank you for your reply!

In my original setup I encountered what you describe: the presence of the Data outside of time range message in combination with a graph happily showing the correct data in the background for the correct timerange. Before I submitted my post I simplified my dashboard setup down to the simplest way to reproduce the bug which turned in to what I described in the first post.

In my original setup I had a table panel which showed a bunch of time ranges. Clicking on those time ranges used data links to manipulate the time selector via the dashboard’s URL. Everything worked as expected, but ‘sometimes’ the panels would show the Data outside of time range popup with the requested correct data in the background.

What I noticed was that when clicking on a new timerange, first the panels would update to show the new time range on their x-axis, which would shift the visualized data to outside of the panel. In this short instance, the Data outside of time range message is completely valid and correct. However, immediately after this the queries would update and return data for the new timerange. This new data does coincide with the panel’s timerange but unfortunately doesn’t remove the Data outside of time range message - until the panel refreshes again (as previously described).

My conclusion at the time was that the panel and time selected somehow got ‘out of sync’ because of how I manipulated the timerange selector.

1 Like

I also face now the same thing ! and there is no document or video explain this why it happen how i can fix it :slight_smile:

1 Like

I also just saw this issue when changing a Time Series graph from style line to bar. The query is influx and after digging a bit I found that sorting the _time column actually fixed the issue for me.
Thought I would post it in case this solution could help anyone.

1 Like