11import { consoleFetchJSON , PrometheusRulesResponse } from '@openshift-console/dynamic-plugin-sdk' ;
22
3+ // Disable client-side timeout (-1) to let the backend control query timeouts
4+ const NO_TIMEOUT = - 1 ;
5+
36// Merges Prometheus monitoring alerts with external sources
47export const fetchAlerts = async (
58 prometheusURL : string ,
@@ -10,7 +13,7 @@ export const fetchAlerts = async (
1013 namespace ?: string ,
1114) : Promise < PrometheusRulesResponse > => {
1215 if ( ! externalAlertsFetch || externalAlertsFetch . length === 0 ) {
13- return consoleFetchJSON ( prometheusURL ) ;
16+ return consoleFetchJSON ( prometheusURL , 'GET' , { } , NO_TIMEOUT ) ;
1417 }
1518
1619 const resolvedExternalAlertsSources = externalAlertsFetch . map ( ( extensionProperties ) => ( {
@@ -22,7 +25,7 @@ export const fetchAlerts = async (
2225
2326 try {
2427 const groups = await Promise . allSettled ( [
25- consoleFetchJSON ( prometheusURL ) ,
28+ consoleFetchJSON ( prometheusURL , 'GET' , { } , NO_TIMEOUT ) ,
2629 ...resolvedExternalAlertsSources . map ( ( source ) => source . fetch ( namespace ) ) ,
2730 ] ) . then ( ( results ) =>
2831 results
@@ -39,6 +42,6 @@ export const fetchAlerts = async (
3942
4043 return { data : { groups } , status : 'success' } ;
4144 } catch {
42- return consoleFetchJSON ( prometheusURL ) ;
45+ return consoleFetchJSON ( prometheusURL , 'GET' , { } , NO_TIMEOUT ) ;
4346 }
4447} ;
0 commit comments