I’m collecting a machines runtime by recording “start” and “stop” events, each resulting in a single record. I looking for way to transform that type of data so that I can see the daily and hourly runtimes.
I’m currently using events.duration for converting the start / stop events into rows representing the runtime (a duration) and aggregateWindow to aggregate on an hourly basis like so:
This basically works but has one drawback: when the machine is running for longer than 1 hour, aggregateWindow sees a single record for the long duration and is not able to distribute the runtime according to the time frame of 1 hour.
So my question is: is there a way to “split” a row representing a runtime into multiple rows according to some time frame? E.g. a row representing a duration of 3 and a half hour would end up in 4 individual rows, 3 of them carrying a duration of 1 hour while the 4th row has a remaining duration of 30 minutes.