I have a continually increasing counter called diskio_io_time. I want to calculate the difference between the current value and the previous value in time. However this counter has one value for each device mapper in a Linux server (dm-0, dm-1, dm-2, …) and I would like to sum all the differences together.
Once that is executed, there are now two tables, one marked “0” and the other marked “1”. In each table is a result column with the difference in a column called “_value”
My question is, how can I add these two columns, both called “_value” from the two different tables together?
|> difference(columns: ["_value"])
|> group() // combines Table 1 and Table 2 so that there is only one "_value" column
|> sum() // adds the "_value" column
|> yield()
I went back to Flux basics on the website and listened to the videos and read the introductory material. I came to understand that tables and group keys are fundamental to understanding how to combine and make computations on different counters. Whoever did the ‘Table Grouping Example’ at this page really helped:
I think you and I both did the group operator after the difference operator. Yours looks more straightforward, meanwhile mine worked. Happy to have mine critiqued.
Nice job. Your query does not contain a sum() function, so you are still getting a time series table, correct? I thought your goal was to sum up ALL of the difference values into a SINGLE value, which is why I included the sum() function.
In my function, there is no aggregateWindow function because (per the above) I wanted to get a single value.