File tree Expand file tree Collapse file tree 2 files changed +2
-31
lines changed
shell-ui/src/alerts/services
ui/src/services/alertmanager Expand file tree Collapse file tree 2 files changed +2
-31
lines changed Original file line number Diff line number Diff line change 22 removeWarningAlerts ,
33 formatActiveAlerts ,
44 sortAlerts ,
5- STATUS_CRITICAL ,
6- STATUS_HEALTH ,
75} from './alertUtils' ;
86export type PrometheusAlert = {
97 annotations : Record < string , string > ;
@@ -29,9 +27,9 @@ export type AlertLabels = {
2927 selectors ?: string [ ] ;
3028 [ labelName : string ] : string ;
3129} ;
32- export function getAlerts ( alertManagerUrl : string , token : string ) {
30+ export function getAlerts ( alertManagerUrl : string , token ? : string ) {
3331 return fetch ( alertManagerUrl + '/api/v2/alerts' , {
34- headers : { Authorization : `Bearer ${ token } ` } ,
32+ headers : token ? { Authorization : `Bearer ${ token } ` } : { } ,
3533 } )
3634 . then ( ( r ) => {
3735 if ( r . ok ) {
@@ -52,16 +50,3 @@ export function getAlerts(alertManagerUrl: string, token: string) {
5250 return sortAlerts ( removeWarningAlerts ( formatActiveAlerts ( result ) ) ) ;
5351 } ) ;
5452}
55- export const checkActiveAlertProvider = ( ) : Promise < {
56- status : 'healthy' | 'critical' ;
57- } > => {
58- // depends on Watchdog to see the if Alertmanager is up
59- // @ts -expect-error - FIXME when you are working on it
60- return getAlerts ( ) . then ( ( result ) => {
61- const watchdog = result . find (
62- ( alert ) => alert . labels . alertname === 'Watchdog' ,
63- ) ;
64- if ( watchdog ) return STATUS_HEALTH ;
65- else return STATUS_CRITICAL ;
66- } ) ;
67- } ;
Original file line number Diff line number Diff line change 11import ApiClient from '../ApiClient' ;
2- import { STATUS_CRITICAL , STATUS_HEALTH } from '../../constants' ;
32import {
43 removeWarningAlerts ,
54 formatActiveAlerts ,
@@ -52,16 +51,3 @@ export function getAlerts() {
5251 return sortAlerts ( removeWarningAlerts ( formatActiveAlerts ( result ) ) ) ;
5352 } ) ;
5453}
55- export const checkActiveAlertProvider = ( ) : Promise < {
56- status : 'healthy' | 'critical' ;
57- } > => {
58- // depends on Watchdog to see the if Alertmanager is up
59- // @ts -expect-error - FIXME when you are working on it
60- return getAlerts ( ) . then ( ( result ) => {
61- const watchdog = result . find (
62- ( alert ) => alert . labels . alertname === 'Watchdog' ,
63- ) ;
64- if ( watchdog ) return STATUS_HEALTH ;
65- else return STATUS_CRITICAL ;
66- } ) ;
67- } ;
You can’t perform that action at this time.
0 commit comments