Browse Source

rules: Cleanup unused function alert.Duration (#6734)

The function HoldDuration and Duration did the exact same thing.

Let's only keep HoldDuration() as Duration() is more confusing.

Signed-off-by: Julien Pivotto <roidelapluie@inuits.eu>
pull/6737/head
Julien Pivotto 5 years ago committed by GitHub
parent
commit
0e912faf4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      rules/alerting.go
  2. 2
      web/api/v1/api.go

9
rules/alerting.go

@ -205,8 +205,8 @@ func (r *AlertingRule) Query() promql.Expr {
return r.vector
}
// Duration returns the hold duration of the alerting rule.
func (r *AlertingRule) Duration() time.Duration {
// HoldDuration returns the hold duration of the alerting rule.
func (r *AlertingRule) HoldDuration() time.Duration {
return r.holdDuration
}
@ -547,8 +547,3 @@ func (r *AlertingRule) HTMLSnippet(pathPrefix string) html_template.HTML {
}
return html_template.HTML(byt)
}
// HoldDuration returns the holdDuration of the alerting rule.
func (r *AlertingRule) HoldDuration() time.Duration {
return r.holdDuration
}

2
web/api/v1/api.go

@ -972,7 +972,7 @@ func (api *API) rules(r *http.Request) apiFuncResult {
State: rule.State().String(),
Name: rule.Name(),
Query: rule.Query().String(),
Duration: rule.Duration().Seconds(),
Duration: rule.HoldDuration().Seconds(),
Labels: rule.Labels(),
Annotations: rule.Annotations(),
Alerts: rulesAlertsToAPIAlerts(rule.ActiveAlerts()),

Loading…
Cancel
Save