Alerting: Assume built-in AM is receiving alerts in case of not having admin config (#87893)

This commit is contained in:
Sonia Aguilar
2024-05-15 14:51:28 +02:00
committed by GitHub
parent 639ab6cca7
commit 3aae2b7e04
2 changed files with 7 additions and 2 deletions
@@ -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;