RedisTimeSeries / redistimeseries-go

golang client lib for RedisTimeSeries

Home Page:https://redistimeseries.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Average in DuplicatePolicyType

Shriram-RP opened this issue · comments

Is there a way we can get the average value for a particular timestamp of a time series key in redis time series.
We are currently recording latency and recording them in milliseconds timestamp and there could be 2 values in same timestamp slot.

We want to know the average stored here and not the sum/max. Also, there seems to be no way to store data in a linkedlist format for a certain timestamp.

The only way to do now is to go for nanoseconds timestamp but that would mean having too much data stored in a time series key. Is there a way where we could address this problem like a average duplicatepolicytype?

Average is trickier since it requires saving 2 numbers: count & average/sum.

BTW, such request should be opened here: https://github.com/RedisTimeSeries/RedisTimeSeries/issues

@gkorland

Is there anyways where we can store a list of values at a particular timestamp in time series?

Do you expect it to happen frequently? Do you expect cases of more than two events in the same timestamp?

If it's rare to have any collisions, perhaps you should not enable any Duplicate_Policy and in case of collision do the average on the client side.