grafana / iot-sitewise-datasource

IoT Sitewise
Apache License 2.0
19 stars 9 forks source link

Feature: Create a Client Cache for relative time range queries #321

Closed sarahzinger closed 1 month ago

sarahzinger commented 1 month ago

Is your feature request related to a problem? Please describe. Users with large query results often have issues with re-running queries particularly when they are auto run every 5seconds (or some other interval) when using relative time ranges (ex: last hour, last day, etc)

Describe the solution you'd like Create a toggle that enables a client cache so that once data is fetched it is reused rather than refetched, and only more recent data is fetched.

For example, if a user has the toggle enabled and they are querying over the last hour repeatedly every minute, then past data will be reused and only fresh data will be refreshed.

Data that is less than 15 minutes old will always be refreshed because it may not be complete as often data has a delay coming into sitewise. Data that is not time based will never be refreshed as it is likely stable.

Describe alternatives you've considered We already have Query Caching as an enterprise feature, but often those queries do not handle relative time ranges well. The current implementation of the query caching enterprise feature is particularly good when multiple users are looking at specific time range, as it's implemented on the backend. This cache will be only on the client side.

We considered having this behavior always on, but decided to implement this with a toggle so as to give users the flexibility to turn it off if it's not behaving as expected.