grafana/grafana

Alerting: Support AWS and Azure Managed Prometheus data sources in alert rule import/conversion

Open

#123,144 建立於 2026年4月21日

在 GitHub 查看
 (1 留言) (0 反應) (0 負責人)TypeScript (73,744 star) (13,868 fork)batch import
area/alertinggood first issueinternal

描述

Summary

When importing/converting data-source-managed Prometheus alert rules to Grafana-managed alert rules, the conversion fails if the selected data source is AWS Managed Prometheus (grafana-amazonprometheus-datasource) or Azure Managed Prometheus (grafana-azureprometheus-datasource). Only native prometheus and loki types are currently accepted by the converter.

Steps to Reproduce

  1. Have an AWS Managed Prometheus or Azure Managed Prometheus data source configured.
  2. Navigate to Alerting → Alert rules and use the import/convert feature (data-source-managed → Grafana-managed).
  3. Select the AWS or Azure Prometheus data source.
  4. Attempt to import a valid Prometheus rules YAML.

Expected Behavior

The import should succeed. AWS Managed Prometheus and Azure Managed Prometheus are Prometheus-compatible data sources and their rule format is identical to native Prometheus. The converter should recognize and support them.

Actual Behavior

The conversion fails with:

Failed to create Prometheus converter
error="[alerting.invalidDatasourceType] invalid datasource type: grafana-amazonprometheus-datasource, must be prometheus or loki"
Failed to convert Prometheus rules to Grafana rules
error="[alerting.invalidDatasourceType] invalid datasource type: grafana-azureprometheus-datasource, must be prometheus or loki"

The same YAML imports successfully when a native prometheus type data source is selected.

Proposed Fix

Expand the datasource type allowlist in the Prometheus converter to include:

  • grafana-amazonprometheus-datasource
  • grafana-azureprometheus-datasource

These datasources expose the same Prometheus-compatible rule format and their inclusion is a natural extension of the existing logic.

Additional Context

  • Grafana version: 13.0.0-23772453380
  • Affected datasource types: grafana-amazonprometheus-datasource, grafana-azureprometheus-datasource
  • Unaffected: native prometheus datasource type

貢獻者指南