influxdb histogram flux query with filter

Viewed 50

I'm using influxdb 2 to store a time series db of water stations. The points are something like:

from influxdb_client import Point

Point("station").tag("id", station_id).field("pressure", 0).time(datetime.now())
Point("station").tag("id", station_id).field("pressure", 1).time(datetime.now())
Point("station").tag("id", station_id).field("pressure", 1).time(datetime.now())
Point("station").tag("id", station_id).field("pressure", 3).time(datetime.now())
Point("station").tag("id", station_id).field("pressure", 2).time(datetime.now())
Point("station").tag("id", station_id).field("pressure", 0).time(datetime.now())

So the pressure varies from 0 to 3.

Hon can I retrive a histogram filtered by station_id using [0, 1, 2, 3] as bins for pressure using Flux?

0 Answers
Related