Nested/sub querries in flux?

I’d like to do a sub query in flux. This here query gives me the serial number of the devices which has reported good 5G conditions within the last minute.

rsrp_raw = from(bucket:"fmbb/autogen")
 |> range(start: -1m, stop: now())
 |> filter(fn: (r) => r._measurement == "cellular"  and
 r._field == "rsrp"  and
 r.carrier == "5g" and
 r._value > -70
  )
 |> unique(column:"serial_number")

For those devices I’d like to look up other stuff like the current SW version.

software_version = from(bucket:"fmbb/autogen")
 |> range(start: -1m, stop: now())
 |> filter(fn: (r) => r._measurement == "device_info"  and
 r._field == "software_version"  
 )
 |> unique(column:"serial_number")

I have used to join results, but as the datasets grow large, joining has started to time out. Is there a way to use the serial numbers from rsrp_raw into the software_version query? Something like this psudo code:

software_version = from(bucket:"fmbb/autogen")
 |> range(start: -1m, stop: now())
 |> filter(fn: (r) => r._measurement == "device_info"  and
 r._field == "software_version" and
 r.serial_number =~/$serial_from_rsrp_raw/  
 )
 |> unique(column:"serial_number")

I could do it in a two step operation from the commandline, but I’d like to include this list directly into the grafan dash board.

This topic was automatically closed after 365 days. New replies are no longer allowed.