Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit 948f89b

Browse files
committed
Add comment detailing source of translation logic
1 parent c432ab0 commit 948f89b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

alerting_alert_rule.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ func syncCalculatedRuleFields(rule *AlertRule) {
144144
}
145145

146146
// timeDurationToRuleDuration converts a typical time.Duration to the string-based format that alert rules expect.
147+
// This code is adapted from Prometheus: https://github.com/prometheus/common/blob/dfbc25bd00225c70aca0d94c3c4bb7744f28ace0/model/time.go#L236
147148
func timeDurationToRuleDuration(d time.Duration) string {
148149
ms := int64(d / time.Millisecond)
149150
if ms == 0 {

0 commit comments

Comments
 (0)