I was naively hoping that with CQ’s set up, I can have a single query in Grafana and just see my data become more and more course-grained over time. It appears that this isn’t how life works.
I’m keen on seeing:
- What others are doing
- If my continuous queries are sane; and if so
- If my proposed suggestion is workable
There are two key issues:
Fields created by continuous queries are prefixed by the aggregation function. A field called
biscuits, aggregated by the CQ, is named
mean_biscuits. This prevents any query reuse in Grafana.
I cannot see a way to query multiple retention policies at the same time. Unless I’m misinterpreting, #2625 indicates that this may just not be possible.
I already have five dashboards in Grafana with around 20 graphs total (excluding repeaters). This is only going to grow, so this behaviour is untenable if I need to repeat every graph three times in order to display data across each of my three retention policy.
My retention policies
Here are my retention policies:
CREATE RETENTION POLICY "48_hour" ON "OnlineAPI" DURATION 48h REPLICATION 1 DEFAULT CREATE RETENTION POLICY "6_month" ON "OnlineAPI" DURATION 180d REPLICATION 1 CREATE RETENTION POLICY "archive" ON "OnlineAPI" DURATION 0s REPLICATION 1
And the associated CQs:
CREATE CONTINUOUS QUERY cq_15m ON OnlineAPI BEGIN SELECT mean(*) INTO "6_month".:MEASUREMENT FROM "48_hour"./.*/ GROUP BY time(15m), * END CREATE CONTINUOUS QUERY cq_1h ON OnlineAPI BEGIN SELECT mean(*) INTO "archive".:MEASUREMENT FROM "48_hour"./.*/ GROUP BY time(1h), * END
The reason I am using wildcards is that I have around 30 measurements, each with between 1-5 values, and these measurements can increase with each release. I don’t want to burden the development team on having to manually update CQs each time they add a measurement.
I understand that the field prefix issue is only because I’m using wildcards. To avoid burdening developers who aren’t directly using InfluxDB, I was considering creating a tool which ran nightly. The tool would drop all existing CQ’s, query all measurements for the selected database, identify all fields and create continuous queries explicitly listing fields. Would this work? What do others do?
Unless I am grossly misusing CQs, as it stands CQs and Grafana only seem suited to the most trivial of use cases.