I have a problem concerning Grafana with MySQL.
For example, I want to show values from the last five minutes. To do so, I choose “Last 5 minutes” from the quick ranges on the upper right corner. The problem that I have is that the generated SQL query is wrong: For example, at 10:30 it generates a time range from 9:25 to 9:30 in the WHERE clause.
SELECT
UNIX_TIMESTAMP(time) as time_sec,
T1 as value
FROM measurements
WHERE time BETWEEN ‘2018-11-14T09:25:00Z’ AND ‘2018-11-14T09:30:00Z’
ORDER BY time ASC
The graphics on the other hand shows data from 10:25 to 10:30, which is empty (“Data points outside time range”). How can I resolve this time inconsistency?
I have set the time zone to Local Browser time in the preference tab.
Maybe since Some SQL servers by default are set at UTC TIME ZONE… you gotta check that and change settings in SQL or time filter it accordingly by apply time differences in grafana…
Okay. The generated query should definitely be different on 5.3.4. Per default all date and times in a Grafana dashboard are converted to local browser time from UTC and the time range is reflecting the local browser time, but when you execute the query that time is converted to UTC and sent to Grafana backend. That’s why the query generated is 1 hour before what you see.
If it still not work I’m guessing you have some timezone combination that doesn’t work together. What timezone of Grafana server, what timezone in mysql database?
For further investigation, please try again with 5.3.4 (not docker latest, grafana:5.3.4) and include generated sql here. As you can see in referenced issue the fix has resolved the problem for a lot of people.