I am desperated trying to build what should be a simple query. I want to build a “Data Exploration” dashboard in grafana in the same way as Chronograf does but I am blocked on the last query. The idea is to have 3 drop down menu in Grafana, first filtering by bucket, second, filtering by topic (tag) and third, showing all the measurements of the topic with selected tag (topic) value. I hope someone could help me on the topic:
@alex1510 I’m not sure I fully understand your use case and I’m wondering if this is a misunderstanding of InfluxDB semantics and data structure. Are you trying to list measurements with a tag or list fields with a tag?
A measurement is a logical container for grouping fields and tags. Measurements contain tags and fields.
It is possible to get a list of measurements with a specific tag, but it’s an incredibly expensive query. It essentially has to query all the data in your database from a given time range.
Hello @scott , sorry for the late reply but I didn’t receive any notification from the forum…I need to have a look…
I will try to explain the question with the screenshot:
First filter (red line): The user will be able to select the bucket that will be used for following filters.
Second filter (blue line): The user will be able to select the tag that will be used for filtering the measurements.
Third filter: The user will be able to select the measurement that wants to display.
Basically all the measurements come from different machines in the shopfloor that are publising data to a MQTT broker. Depending on the plant, measurements are stored in different buckets. Production line name (topic in mqtt) is stored as tag in the measurement.
I hope now you have a better understanding of the global need.
I have tried to include the query as template variable and also to include the query directly but none of them returns anything. I have also slightly modify your query following Chronograf editor with no luck…
The only thing I want to reproduce in Grafana is the same behavior I can do with Chronograf. Filter by bucket, filter by tag=topic and list all the measurements…that’s all.
I don’t know why that would return false. That query should return all the data where topic equals the selected PROD_LINE. It’s been a while since I’ve messed with Grafana variables, but I wonder if the Grafana will only pull variable values from the _value column of the query results. Try this:
I found the following topic and it helped me to write the query:
I don’t know if it is well optimized…at least it works. Do you know if it could be improved and it time range could be removed just to avoid loosing some tags that maybe does not change in the last 30d?