Alerting: Remove internal labels from prometheus compatible API responses (#46548)
* Alerting: Remove internal labels from prometheus compatible API responses * Appease the linter * Fix integration tests * Fix API documentation & linter * move removal of internal labels to the models
This commit is contained in:
@@ -47,7 +47,7 @@ func NewEvaluationValues(m map[string]eval.NumberValueCapture) map[string]*float
|
||||
return result
|
||||
}
|
||||
|
||||
func (a *State) resultNormal(alertRule *ngModels.AlertRule, result eval.Result) {
|
||||
func (a *State) resultNormal(_ *ngModels.AlertRule, result eval.Result) {
|
||||
a.Error = result.Error // should be nil since state is not error
|
||||
|
||||
if a.State != eval.Normal {
|
||||
@@ -177,3 +177,13 @@ func (a *State) setEndsAt(alertRule *ngModels.AlertRule, result eval.Result) {
|
||||
|
||||
a.EndsAt = result.EvaluatedAt.Add(ends * 3)
|
||||
}
|
||||
|
||||
func (a *State) GetLabels(opts ...ngModels.LabelOption) map[string]string {
|
||||
labels := a.Labels.Copy()
|
||||
|
||||
for _, opt := range opts {
|
||||
opt(labels)
|
||||
}
|
||||
|
||||
return labels
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user