Alerting: Fix support for converted Prometheus rules in app-platform apis (#113648)
* Alerting: Fix support for converted Prometheus rules in app-platform apis Retrieving converted Prometheus retrieval rules was not supported in the app-platform apis and was throwing a 500 error due to the provenance not being handled properly. Also adds a test to cover converted Prometheus rules when getting rules. Closes https://github.com/grafana/alerting-squad/issues/1200 * add test to confirm provenance compatibility
This commit is contained in:
@@ -19,13 +19,17 @@ const (
|
||||
FolderLabelKey = FolderAnnotationKey
|
||||
)
|
||||
|
||||
// NOTE: This is a copy of the constants from the alertrule package to avoid circular imports.
|
||||
// Keep in sync with pkg/services/ngalert/models/provisioning.go
|
||||
const (
|
||||
ProvenanceStatusNone = ""
|
||||
ProvenanceStatusAPI = "api"
|
||||
ProvenanceStatusNone = ""
|
||||
ProvenanceStatusAPI = "api"
|
||||
ProvenanceStatusFile = "file"
|
||||
ProvenanceStatusConvertedPrometheus = "converted_prometheus"
|
||||
)
|
||||
|
||||
var (
|
||||
AcceptedProvenanceStatuses = []string{ProvenanceStatusNone, ProvenanceStatusAPI}
|
||||
AcceptedProvenanceStatuses = []string{ProvenanceStatusNone, ProvenanceStatusAPI, ProvenanceStatusFile, ProvenanceStatusConvertedPrometheus}
|
||||
)
|
||||
|
||||
func ToDuration(s string) (time.Duration, error) {
|
||||
|
||||
Reference in New Issue
Block a user