mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Alerting: Optimize Prometheus rules query params (#95833)
Load alert instances only when label filter is applied Co-authored-by: Gilles De Mey <gilles.de.mey@gmail.com>
This commit is contained in:
parent
34991f5b44
commit
91088d1f56
@ -47,6 +47,8 @@ const RuleListV1 = () => {
|
||||
const [queryParams] = useQueryParams();
|
||||
const { filterState, hasActiveFilters } = useRulesFilter();
|
||||
|
||||
const hasActiveLabelsFilter = filterState.labels.length > 0;
|
||||
|
||||
const queryParamView = queryParams.view as keyof typeof VIEWS;
|
||||
const view = VIEWS[queryParamView] ? queryParamView : 'groups';
|
||||
|
||||
@ -77,7 +79,7 @@ const RuleListV1 = () => {
|
||||
return noRules && state.dispatched;
|
||||
});
|
||||
|
||||
const limitAlerts = hasActiveFilters ? undefined : LIMIT_ALERTS;
|
||||
const limitAlerts = hasActiveLabelsFilter ? undefined : LIMIT_ALERTS;
|
||||
// Trigger data refresh only when the RULE_LIST_POLL_INTERVAL_MS elapsed since the previous load FINISHED
|
||||
const [_, fetchRules] = useAsyncFn(async () => {
|
||||
if (!loading) {
|
||||
|
Loading…
Reference in New Issue
Block a user