How to create a downsampling on downsampled key in redis timeseries

520 Views Asked by At

Here is the use case:

I have metric called count I am downsampling it by creating a rule to the key/downsampling rule countPerMinute

Now when I try and create another rule for hourlyAggregation(have a slightly complicated case) redis time series doesn't allow me to create a rule with the countPerMinute key as a source key for another rule.

As there are millions of keys and huge volume we have set only couple hours of retention period on raw data keys.

1

There are 1 best solutions below

2
On BEST ANSWER

You cannot create a compaction rule where the source is a destination of another compaction rule.

TS.CREATE x1
TS.CREATE x2
TS.CREATE x3

TS.CREATERULE x1 x2 AGGREGATION sum 1000
TS.CREATERULE x2 x3 AGGREGATION sum 1000000    <----- error

Instead, you should create all compaction rules directly from the raw samples series:

TS.CREATERULE x1 x2 AGGREGATION sum 1000
TS.CREATERULE x1 x3 AGGREGATION sum 1000000

Some test code:

TS.ADD x1 123001 101
TS.ADD x1 123002 102
TS.ADD x1 123003 103
TS.ADD x1 200000000 2000

TS.RANGE x1 - +
TS.RANGE x2 - +
TS.RANGE x3 - +