feat(statchart): use an instant query when the value allows it - #781
Open
s3onghyun wants to merge 1 commit into
Open
feat(statchart): use an instant query when the value allows it#781s3onghyun wants to merge 1 commit into
s3onghyun wants to merge 1 commit into
Conversation
StatChart always ran a range query, even when it only needed the latest point. Now that a per-query instant mode exists (perses#752), derive the panel query mode from the spec, mirroring what TablePanel already does with getTablePanelQueryMode. Only `last` is instant-safe: it is exactly what an instant query returns. `last-number`, the aggregations, `first`/`first-number`, and any spec with a sparkline still use a range query, so nothing that renders the series is affected (see the perses#738 sparkline regression, kept covered by tests). Follow-up to perses#746, which was closed in favour of the per-query flag in perses#752. Signed-off-by: s3onghyun <s3onghyun@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
StatChart always issued a range query, even when it only needed the latest point. Now that #752 added a per-query instant mode, this derives the panel query mode from the spec — the same thing
TablePanelalready does viagetTablePanelQueryMode.getStatChartQueryModereturnsinstantonly when it's safe:last→ instant (it's exactly what an instant query returns)last-number,mean/sum/min/max,first/first-number→ range (they need the full series)So the default (sparkline on) stays range, and nothing that renders the series changes — the #738 sparkline regression is kept covered by tests.
Follow-up to #746, which was closed in favour of #752's per-query flag.
Test
stat-chart-model.test.tscovers each calculation + the sparkline cases.npm run test,tsc, andoxlintare clean.