Alerting: Assume built-in AM is receiving alerts in case of not having admin config (#87893)
This commit is contained in:
@@ -94,7 +94,7 @@ export const alertmanagerApi = alertingApi.injectEndpoints({
|
||||
|
||||
// this endpoint requires administrator privileges
|
||||
getGrafanaAlertingConfiguration: build.query<GrafanaAlertingConfiguration, void>({
|
||||
query: () => ({ url: '/api/v1/ngalert/admin_config' }),
|
||||
query: () => ({ url: '/api/v1/ngalert/admin_config', showErrorAlert: false }),
|
||||
providesTags: ['AlertingConfiguration'],
|
||||
}),
|
||||
|
||||
|
||||
@@ -2,7 +2,12 @@ import { AlertmanagerChoice, GrafanaAlertingConfiguration } from 'app/plugins/da
|
||||
|
||||
// if we have either "internal" or "both" configured this means the internal Alertmanager is receiving Grafana-managed alerts
|
||||
export const isInternalAlertmanagerInterestedInAlerts = (config?: GrafanaAlertingConfiguration): boolean => {
|
||||
switch (config?.alertmanagersChoice) {
|
||||
if (!config) {
|
||||
// The backend doesn't have a configuration record in a new Grafana instance until the user has interacted with the configuration page.
|
||||
// For that reason, in case of no configuration, we assume that the internal Alertmanager is interested in alerts.
|
||||
return true;
|
||||
}
|
||||
switch (config.alertmanagersChoice) {
|
||||
case AlertmanagerChoice.Internal:
|
||||
case AlertmanagerChoice.All:
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user