Hi everyone
I have a question regarding the optimization of my querys for the geomap panel inside grafana within my flux querys.
- First of all i am running a grafana cloud instance (version 8.5.2.) on my linux machine.
- I want to query my data and visualize it with the gemap panel. The structure of my influxdb-bucket is the following:
- “example-bucket”:
- _measurement: (saved as a variable inside grafana) list of sensors
- _tags=(“stateofactive”, “stateofbattery”): 2 tags which show if the sensor is active and the battery percentage (are not really necessary for the geomap visualization)
- _field=(“Longitude”, “Latitude”, “sensorvalue”): 3 fields which show long and lat as well as the measurement of the specific sensor
- Right now i got everything visualized but it constantly get this error:
A query returned too many datapoints and the results have been truncated at 10171 points to prevent memory issues. At the current graph size, Grafana can only draw 1017.
My Query-Code is looking like this:
from(bucket: "RealDaten")
|> range(start: -1d, stop: now())
|> filter(fn: (r) => contains(value: r["_measurement"], set: ${Projects:json}))
|> filter(fn: (r) =>
r._field == "Latitude" or
r._field == "Longitude" or
r._field == "sensorvalue")
|> drop(columns:["_start", "_stop"])
|> pivot(rowKey:["_time"], columnKey: ["_field"], valueColumn: "_value")
|> group()
|> yield(name: "max")
|> aggregateWindow(
every: 1h,
fn: mean,
column: "sensorvalue",
timeSrc: "_stop",
timeDst: "_time",
createEmpty: true
)
But this still wont solve my problem therefore i also transformed my data with “Filter data by values” so that i only get a specific area of my sensorvalues.
Is there any additional way to optimize my flux-query so that i only get the data which is needed for my panel so that it wont crash ?
Thank you in advance Greetings Grafu