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

Allow window() to include latest data point #898

Closed
phemmer opened this issue Sep 13, 2016 · 1 comment
Closed

Allow window() to include latest data point #898

phemmer opened this issue Sep 13, 2016 · 1 comment
Milestone

Comments

@phemmer
Copy link

phemmer commented Sep 13, 2016

It would be really useful if window() could emit the latest data point instead of all but the latest. The use case is wanting to obtain the last X seconds worth of data each time a new data point comes in. In this scenario we are emitting the window on every incoming data point, thus we don't need to hold back the latest data point so that we can make sure it fits inside a window.

For example, consider input data with the following times:

00:00:01
00:00:02
00:00:03
00:00:05
00:00:09

With a window size of 3s, the resulting emitted points would be:

00:00:01: [00:00:01]
00:00:02: [00:00:01, 00:00:02]
00:00:03: [00:00:01, 00:00:02, 00:00:03]
00:00:05: [00:00:03, 00:00:05]
00:00:09: [00:00:09]

This mode could be enabled by having a 0 value every(). Such as .every(0s), .every(0u), etc.

@nathanielc
Copy link
Contributor

@phemmer I like your suggestion of using the 0 value for the every property. There may be some weird edge cases where this doesn't work well, but at first glance it seems like a reasonable request.

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

No branches or pull requests

2 participants