Alerting: Include annotations in prometheus Alert response. (#45970)
* Alerting: Include annotations in prometheus Alert response. * add tests * re-order depedencies
This commit is contained in:
@@ -24,7 +24,7 @@ import (
|
||||
|
||||
type PrometheusSrv struct {
|
||||
log log.Logger
|
||||
manager *state.Manager
|
||||
manager state.AlertInstanceManager
|
||||
store store.RuleStore
|
||||
}
|
||||
|
||||
@@ -43,14 +43,16 @@ func (srv PrometheusSrv) RouteGetAlertStatuses(c *models.ReqContext) response.Re
|
||||
if alertState.State == eval.Alerting {
|
||||
valString = alertState.LastEvaluationString
|
||||
}
|
||||
|
||||
alertResponse.Data.Alerts = append(alertResponse.Data.Alerts, &apimodels.Alert{
|
||||
Labels: map[string]string(alertState.Labels),
|
||||
Annotations: map[string]string{}, //TODO: Once annotations are added to the evaluation result, set them here
|
||||
Annotations: alertState.Annotations,
|
||||
State: alertState.State.String(),
|
||||
ActiveAt: &startsAt,
|
||||
Value: valString,
|
||||
})
|
||||
}
|
||||
|
||||
return response.JSON(http.StatusOK, alertResponse)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user