Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support adding multiple or weighted values #32

Open
itaysabato opened this issue Apr 27, 2018 · 1 comment
Open

Support adding multiple or weighted values #32

itaysabato opened this issue Apr 27, 2018 · 1 comment

Comments

@itaysabato
Copy link

In case a client or intermediate layer has already aggregated several samples (e.g. an average) and the client does not have (or does not need) the originals to submit to the time series, it could be useful to have ability to add a value with a "weight", so that it will count as several samples when aggregating.

For example, I may have 10 samples whose average value is 5.25 but I do not know what each sample value is and I don't even care because I am only interested in the rolling average. One solution would be to do:

MULTI
TS.ADD key t 5.25
TS.ADD key t 5.25
...
TS.ADD key t 5.25
EXEC

But a better solution could be:

TS.ADD key t 5.25 5.25 ... 5.25

or

TS.ADD key t 5.25 REPEAT 10

or

TS.ADD key t 5.25 WEIGHT 10

If multiple fields per sample are supported then one of them could simply be the weight and an aggregation could reduce (weight, value) => (weight * value)

@itaysabato
Copy link
Author

P.s. due to timestamps only being of second-precision, it is even more likely that samples will have to be aggregated before being added to the time series.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant