Alerting: API to show converted alertmanager configurations in the UI (#109353)

What is this feature?

This PR add the backend functionality to support viewing extra Alertmanager configurations (imported with the Prometheus conversion API) in the UI under the feature flag alertingImportAlertmanagerUI. The same flag will be used to enable this in the UI.

This is just the backend part, the full PoC PR is here: #109027

It uses a special datasource UID prefix __grafana-converted-extra-config-{identifier} to identify imported configurations. When the Alertmanager proxy handler detects this prefix:

    GET requests are proxied to either the Grafana Alertmanager service (for alerts, silences, etc.) or the Prometheus conversion API to get the config
    Write operations are not supported
This commit is contained in:
Alexander Akhmetov
2025-08-13 17:28:43 +02:00
committed by GitHub
parent 466aa70179
commit 587f52cf5b
8 changed files with 354 additions and 15 deletions
+13 -11
View File
@@ -95,6 +95,16 @@ func (api *API) RegisterAPIEndpoints(m *metrics.API) {
}
ruleAuthzService := accesscontrol.NewRuleService(api.AccessControl)
convertSrv := NewConvertPrometheusSrv(
&api.Cfg.UnifiedAlerting,
logger,
api.RuleStore,
api.DatasourceCache,
api.AlertRules,
api.FeatureManager,
api.MultiOrgAlertmanager,
)
// Register endpoints for proxying to Alertmanager-compatible backends.
api.RegisterAlertmanagerApiEndpoints(NewForkingAM(
api.DatasourceCache,
@@ -115,6 +125,8 @@ func (api *API) RegisterAPIEndpoints(m *metrics.API) {
),
receiverAuthz: accesscontrol.NewReceiverAccess[ReceiverStatus](api.AccessControl, false),
},
convertSrv,
api.FeatureManager,
), m)
// Register endpoints for proxying to Prometheus-compatible backends.
api.RegisterPrometheusApiEndpoints(NewForkingProm(
@@ -181,15 +193,5 @@ func (api *API) RegisterAPIEndpoints(m *metrics.API) {
hist: api.Historian,
}), m)
api.RegisterConvertPrometheusApiEndpoints(NewConvertPrometheusApi(
NewConvertPrometheusSrv(
&api.Cfg.UnifiedAlerting,
logger,
api.RuleStore,
api.DatasourceCache,
api.AlertRules,
api.FeatureManager,
api.MultiOrgAlertmanager,
),
), m)
api.RegisterConvertPrometheusApiEndpoints(NewConvertPrometheusApi(convertSrv), m)
}