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>
This commit is contained in:
Julien Pivotto 2020-02-01 08:31:37 +01:00 committed by GitHub
parent bdcfebdf74
commit 0e912faf4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 8 deletions

View File

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

View File

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