[v9.3.x] Alerting: Support Prometheus durations in Provisioning API (#59067)
Alerting: Support Prometheus durations in Provisioning API (#58293)
Provisioning API should support Prometheus durations
(cherry picked from commit 57d6adbc7c)
Co-authored-by: Bart Peeters <birtpeeters@hotmail.com>
This commit is contained in:
co-authored by
Bart Peeters
parent
7899b5ae72
commit
90a904fbd5
@@ -104,10 +104,6 @@ type ProvisionedAlertRule struct {
|
||||
}
|
||||
|
||||
func (a *ProvisionedAlertRule) UpstreamModel() (models.AlertRule, error) {
|
||||
forDur, err := time.ParseDuration(a.For.String())
|
||||
if err != nil {
|
||||
return models.AlertRule{}, err
|
||||
}
|
||||
return models.AlertRule{
|
||||
ID: a.ID,
|
||||
UID: a.UID,
|
||||
@@ -120,7 +116,7 @@ func (a *ProvisionedAlertRule) UpstreamModel() (models.AlertRule, error) {
|
||||
Updated: a.Updated,
|
||||
NoDataState: a.NoDataState,
|
||||
ExecErrState: a.ExecErrState,
|
||||
For: forDur,
|
||||
For: time.Duration(a.For),
|
||||
Annotations: a.Annotations,
|
||||
Labels: a.Labels,
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user