I’m trying to add annotations to a time series graph in Grafana. I’m getting the annotation values with the following Flux query from InfluxDB:
import "strings"
from(bucket: "vevantzedata")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "pops")
|> filter(fn: (r) => r["_field"] =~ /^(cycle|cycle_day)/)
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> map(fn: (r) => ({r with label: strings.joinStr(arr: [string(v: r["cycle"]), string(v: r["cycle_day"])], v: "-")}))
|> window(every: 1d)
|> duplicate(column: "_stop", as: "_time")
My goal is to have one annotation per day, positioned exactly at midnight (00:00). My problem is that the positioning is off by 1h. They show up at exactly 01:00 instead of 01:00. What’s wrong with my query?