Skip to content

Commit f7ff2bc

Browse files
committed
MK8S-197 - Remove checkActiveAlertProvider which is not used anymore
1 parent c15b1d0 commit f7ff2bc

File tree

2 files changed

+2
-31
lines changed

2 files changed

+2
-31
lines changed

shell-ui/src/alerts/services/alertManager.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import {
22
removeWarningAlerts,
33
formatActiveAlerts,
44
sortAlerts,
5-
STATUS_CRITICAL,
6-
STATUS_HEALTH,
75
} from './alertUtils';
86
export 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-
};

ui/src/services/alertmanager/api.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import ApiClient from '../ApiClient';
2-
import { STATUS_CRITICAL, STATUS_HEALTH } from '../../constants';
32
import {
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-
};

0 commit comments

Comments
 (0)