Grafana Day Aggregates Doesn't Send Timezone? Why?

  • What Grafana version and what operating system are you using?
    grafana:10.3.3 via container on kubernetes

  • What are you trying to achieve?
    Create 1 day windows of usage data

  • How are you trying to achieve it?
    Using influxQL and time series graph.

  • What happened?
    Data returned by data for today is in a window bucket for yesterday’s date because grafana does not send the timezone in the influxdb query.

  • What did you expect to happen?
    Grafana to send the timezone to correctly aggregate the data from data stored in UTC. I realize (after hours of confusion) that you need to as the Timezone in the “Timezone” field in the influxQL query builder but I can’t figure out why grafana doesn’t do this for me. Additionally there doesn’t seem to be a global variable for timezone in grafana so I can’t put a variable here to have this work as expected without additional scripting.

I tried adding the Timezone into the “Timezone” field for a graph I’m aggregating in Hour windows expecting this to break something, somehow, but it didn’t, which makes sense. However, I guess this would be necessary if you lived in a timezone with one of these 30 minute timezone offsets. So that user would probably be even more confused and frustrated. I at least saw that most of my graphs were correct so something unexpected was happening only in this condition.

I don’t understand why grafana doesn’t send the timezone in the query knowing that influxdb supports this? What use case don’t I understand that this isn’t the default behavior? And why isn’t there a timezone variable knowing that anyone doing Day aggregations would benefit from this? I must be misunderstanding or missing something.

  • Can you copy/paste the configuration(s) that you are having problems with?
    Query Inspector to get the query being run via POST:
    SELECT mean(“usage”) FROM “energy_usage” WHERE (“detailed” = ‘Day’ AND “channel_type”::tag != ‘Mains’ AND “channel_type”::tag != ‘VirtualMemberCircuit’) AND time >= 1706275287450ms and time <= 1708867287450ms GROUP BY time(1d), “device_name” fill(null) ORDER BY time ASC

Of course (now that I understand what’s wrong) running the same query in influxdb and simply adding the TZ at the end of it returns the data aggregated in my TZ and not UTC.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

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