we have topics and partitions and sizes for each pair, I want the total size of the topic across all partitions
I thought, this would simply be group by topic and sum the value
time topic partition value
2023-09-04T15:10:00.000Z A 0 2
2023-09-04T15:10:00.000Z B 0 3
2023-09-04T15:10:00.000Z B 1 4
2023-09-04T15:15:00.000Z A 0 2
2023-09-04T15:15:00.000Z B 0 3
2023-09-04T15:15:00.000Z B 1 5
desired output:
time topic value
2023-09-04T15:10:00.000Z A 2
2023-09-04T15:10:00.000Z B 7
2023-09-04T15:15:00.000Z A 2
2023-09-04T15:15:00.000Z B 8
the following query:
|> filter(fn: (r) => r.topic == "A")
|> aggregateWindow(every: 5m, fn: mean, createEmpty: false)
|> group(columns:["_time", "topic"])
|> sort(columns: ["_time"], desc: true)
|> aggregateWindow(every: 5m, fn: sum, createEmpty: false)
the sum result depends on the time window I choose so it’s obviously double (or more) counting
If I replace the sum
in the last line by an count
I see results > 1 for every topic