Alerting: Add state history polling interval (#84837)

This commit is contained in:
Gilles De Mey 2024-04-04 14:06:15 +02:00 committed by GitHub
parent 2232fe033b
commit c41b0a71cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@ interface Props {
ruleUID: string;
}
const STATE_HISTORY_POLLING_INTERVAL = 10 * 1000; // 10 seconds
const MAX_TIMELINE_SERIES = 12;
const LokiStateHistory = ({ ruleUID }: Props) => {
@ -38,12 +39,19 @@ const LokiStateHistory = ({ ruleUID }: Props) => {
isLoading,
isError,
error,
} = useGetRuleHistoryQuery({
ruleUid: ruleUID,
from: queryTimeRange.from.unix(),
to: queryTimeRange.to.unix(),
limit: 250,
});
} = useGetRuleHistoryQuery(
{
ruleUid: ruleUID,
from: queryTimeRange.from.unix(),
to: queryTimeRange.to.unix(),
limit: 250,
},
{
refetchOnFocus: true,
refetchOnReconnect: true,
pollingInterval: STATE_HISTORY_POLLING_INTERVAL,
}
);
const { dataFrames, historyRecords, commonLabels, totalRecordsCount } = useRuleHistoryRecords(
stateHistory,