Identifying and Analyzing Test Runs in InfluxDB2 with Flux based on a time gap threshold after each run

Hello Grafana Community,

I’m working with InfluxDB2 and Grafana and need some help constructing a Flux query. My dataset records multiple test runs, each followed by a variable-length gap of at least 90 seconds. I need to segment these runs and calculate minimum, mean, and maximum values for each run and show the same in legend.

Details of the use case:

  • Each test run duration varies:
    • Test 1: 1.5 hours
    • Test 2: 3.4 hours
    • Test 3: 3.1 hours and so on
  • Each run is followed by a gap (all >90 seconds):
    • After Test 1: 91 seconds
    • After Test 2: 95 seconds
    • After Test 3: 93 seconds

Objective: I need a Flux query that:

  1. Identifies each test run based on the time gap of more than 90 seconds between subsequent data points.
  2. Calculates the min, mean, and max for each identified test run.

Challenges:

  • How to correctly identify and label each test run based on the gaps.
  • How to apply statistical calculations for each segmented run.

Could anyone please guide me on how to approach to handle this scenario in Flux? Any help or pointers would be greatly appreciated!

Thank you in advance!

@nasga
Can you share a .CSV of your data so others can experiment with it?