perf(api): batch APIs queries to request for maximum number of datapo… #310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…ints
What this PR does / why we need it:
Grafana has a default behavior to set query's
maxDataPoints
to a somewhat low number (compares to the SiteWise APIs maximum), and causes unnecessary pagination for queries with high response data points. It creates unnecessary latency and request (TPS) load to the server.For example, for 6 hour time range - the
maxDataPoints
is auto set to~500
, and requires ~50 request for 6 hours of 1 second data points = 6hr60min/hr60sec/min / 432maxDataPoints/request.This PR updates the batch APIs queries to request for maximum number of datapoints the SiteWise APIs can support for a better UX.
Before this PR -
GetPropertyValueHistory
for 6 hr took ~10 seconds:Screen.Recording.2024-05-04.at.1.19.07.AM.1080p.mov
After this PR -
GetPropertyValueHistory
for 6 hr took ~1.5 seconds:Screen.Recording.2024-05-04.at.1.16.41.AM.mov
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: