-
Notifications
You must be signed in to change notification settings - Fork 60
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
feat: add support for resolution mapping #16
feat: add support for resolution mapping #16
Conversation
5ca03fb
to
1ed18a0
Compare
if a user requests some data that is aggregated by average, and then then updated to aggregate by count, would the data-module provide the previously cached data requested under 'average' to the subscriber looking for count? |
Yes, that is exactly what would happen. Good callout, thanks for bringing this up! I think we’ll want to address this. There are two ways we can approach this that I can think of:
|
I would just do that in the next PR. What is #1 going to buy us in the short term? |
1ed18a0
to
f3a7f55
Compare
Solution 1. would allow us to move forward but has other concerns we I discussed offline with @diehbria . If we have two subscriptions one to That is why instead we are dropping the |
f3a7f55
to
4504b5f
Compare
4504b5f
to
5f355ac
Compare
packages/core/src/data-sources/site-wise/dataStreamFromSiteWise.ts
Outdated
Show resolved
Hide resolved
This will allow customers to specify they want to fetch aggrgated data and the resolution mapping for the aggregated data. The resolutionMapping maps the requested viewport date range to a specific resolution for the aggregation function. The key is a number represented in milliseconds for the viewport duration. The value is the desired resolution that can be any string or number. The reason the resolution mapping is flexible when it comes to the resolution is because different data sources might have different api signatures for the resolution. E.g. SiteWise uses '1h|1m|1d' as valid resolutions. Another api might want to use number representing milliseconds or nanoseconds. It is up to the data source to implement how to determine the resolution based on this mapping. **Next steps** Add support for multiple aggregation types in the cache. This will allow subscriptions made to the same data source to not have the cache cleared/overwritten leading to erroneous data e.g. If we have two subscriptions made to the same data source one for AVERAGE and the other for COUNT, we do not want them to affect each other and have them cached separately.
5f355ac
to
4e07fe5
Compare
* initial copy * remove build-storybook from build script * fix snapshot * fix lint * fix build with node v16 * fix test and lint * fix transform controls getting reset Co-authored-by: Xinyi Xu <[email protected]>
* feat: add support for resolution mapping This will allow customers to specify they want to fetch aggrgated data and the resolution mapping for the aggregated data. The resolutionMapping maps the requested viewport date range to a specific resolution for the aggregation function. The key is a number represented in milliseconds for the viewport duration. The value is the desired resolution that can be any string or number. The reason the resolution mapping is flexible when it comes to the resolution is because different data sources might have different api signatures for the resolution. E.g. SiteWise uses '1h|1m|1d' as valid resolutions. Another api might want to use number representing milliseconds or nanoseconds. It is up to the data source to implement how to determine the resolution based on this mapping. **Next steps** Add support for multiple aggregation types in the cache. This will allow subscriptions made to the same data source to not have the cache cleared/overwritten leading to erroneous data e.g. If we have two subscriptions made to the same data source one for AVERAGE and the other for COUNT, we do not want them to affect each other and have them cached separately. * Update testing-ground.tsx Co-authored-by: Norbert Nader <[email protected]>
Overview
This will allow customers to specify they want to fetch aggrgated data and the resolution mapping for the aggregated data.
The resolutionMapping maps the requested viewport date range to a specific resolution for the aggregation function.
The key is a number represented in milliseconds for the viewport duration. The value is the desired resolution that can be any string or number.
The reason the resolution mapping is flexible when it comes to the resolution is because different data sources might have different api signatures for the resolution. E.g. SiteWise uses '1h|1m|1d' as valid resolutions. Another api might want to use number representing milliseconds or nanoseconds. It is up to the data source to implement how to determine the resolution based on this mapping.
Next steps
Add support for multiple aggregation types in the cache. This will allow subscriptions made to the same data source to not have the cache cleared/overwritten leading to erroneous data e.g. If we have two subscriptions made to the same data source one for AVERAGE and the other for COUNT, we do not want them to affect each other and have them cached separately.
Tests
https://github.com/awslabs/iot-app-kit/runs/4434958580?check_suite_focus=true
Legal
This project is available under the Apache 2.0 License.