Search code examples
kairosdb

KairosDB - aggregate, groupby, than aggregate again


KairosDB version 1.1.3-1.

I have dataPoints with [time, name, key, value]. Is it possible to at first group them by name and key, then aggregate results, then group them again by key and then aggregate again?

So basically:

  1. All values for name1+key1 and all values for name2+key1
  2. Aggregate each by average (period 10 sec)
  3. Group aggregated results by key1 (I want to combine results here)
  4. Aggregate given results by sum (same period, 10 sec).

Solution

  • No you cannot do that. You only can group once, and cannot merge the groups afterwards.

    We did our own extension to kairosdb supporting a similar feature (merging all groups of a metric with a sum/avg...), but it's so intrusive (we override kairosdb query handler by our own) that we did not contribute to open source.

    Edit: You may try to use kairosDB post-processing script that is designed for that: https://github.com/kairosdb/kairos-script