Grafana version: 9.5.1
Database in use: Influx 2.7
Query Language: InfluxQL
I don’t understand why the below GET request is being made when initially opening our dashboard:
The InfluxQL query being made is:
SHOW RETENTION POLICIES on “inventory_management”
The above query is not written anywhere within the panel and I don’t understand what’s causing the creation of this query.
expect to happen:
I expect this request not to be made in the first place.
Online clues found:
Tried finding some clues from here:
02:42AM - 02 May 23 UTC
01:01PM - 03 May 23 UTC
# What went wrong?
- Upgraded to Grafana 9.5.1
But this seems to refer to this queries being redundantly made when using Flux.
Could you please advise on the above?
@melori.arellano and @mattabrams tagging for attention please
I would say that is a feature of query editor
It will discover retention policies and then you can select exact retention policy names instead of guessing those names.
Hey Jan, I couldn’t find any reference to retention policy in the link you shared, could you please point me to the relevant section?
Also, do you think we can configure any settings such that this retention policy query is not made?
FROM section is retention policy. I bet UI will offer you all available retention policies when you click on “default”. And that retention policies list must be discovered somehow first - that’s via that query which you are referring.
But my query is edited and is as follows:
I don’t have default as part of the from statement, am I missing something here?
Yes, but that doesn’t mean that UI may not prepare data for the case when you switch to query editor instead of raw query editor.
@jangaraj Any reason why it doesn’t mean that the UI may not prepare the data for the case when I’ve switched to query editor?
Nowhere in the query editor is a query relating to retention policies so any idea on what basis the UI is persisting on making the retention policy query and how to stop it?
@melori.arellano and @mattabrams tagging in case you have some ideas too please
You have very specific case, so I recommend to check source code to know more.
Anyway, is it causing you any trouble that Grafana executes this query?
@ajetsharwin It is happening because of this lines https://github.com/grafana/grafana/blob/v9.5.x/public/app/plugins/datasource/influxdb/datasource.ts#L193-L214
Basically, for that version, I changed the code to load the retention policies in the beginning so I can show the “default” retention policy on the panel if there is none selected. Then I changed that behavior again. Not because it was wrong but I need to support the new influxdb engine. See here:
InfluxDB: Fix retention policy handling for InfluxDB 3.0 engine by bringing back the hardcoded default by itsmylife · Pull Request #72467 · grafana/grafana · GitHub
So there is nothing wrong with having that query being made.