Skip to content

Commit

Permalink
keep same logic with prometheus resend delay configuration (#1612)
Browse files Browse the repository at this point in the history
Signed-off-by: 00arthur00 <yang_yapo@126.com>
  • Loading branch information
00arthur00 authored and bwplotka committed Oct 8, 2019
1 parent 08adecd commit f5c11d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ func registerRule(m map[string]setupFunc, app *kingpin.Application) {

ruleFiles := cmd.Flag("rule-file", "Rule files that should be used by rule manager. Can be in glob format (repeated).").
Default("rules/").Strings()

resendDelay := modelDuration(cmd.Flag("resend-delay", "Minimum amount of time to wait before resending an alert to Alertmanager.").
Default("1m"))
evalInterval := modelDuration(cmd.Flag("eval-interval", "The default evaluation interval to use.").
Default("30s"))
tsdbBlockDuration := modelDuration(cmd.Flag("tsdb.block-duration", "Block duration for TSDB block.").
Expand Down Expand Up @@ -162,6 +163,7 @@ func registerRule(m map[string]setupFunc, app *kingpin.Application) {
*webRoutePrefix,
*webExternalPrefix,
*webPrefixHeaderName,
time.Duration(*resendDelay),
time.Duration(*evalInterval),
*dataDir,
*ruleFiles,
Expand Down Expand Up @@ -196,6 +198,7 @@ func runRule(
webRoutePrefix string,
webExternalPrefix string,
webPrefixHeaderName string,
resendDelay time.Duration,
evalInterval time.Duration,
dataDir string,
ruleFiles []string,
Expand Down Expand Up @@ -299,6 +302,8 @@ func runRule(
}
if !alrt.ResolvedAt.IsZero() {
a.EndsAt = alrt.ResolvedAt
} else {
a.EndsAt = alrt.ValidUntil
}
res = append(res, a)
}
Expand All @@ -312,6 +317,7 @@ func runRule(
Appendable: st,
ExternalURL: nil,
TSDB: st,
ResendDelay: resendDelay,
}

for _, strategy := range storepb.PartialResponseStrategy_value {
Expand Down
2 changes: 2 additions & 0 deletions docs/components/rule.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ Flags:
--data-dir="data/" data directory
--rule-file=rules/ ... Rule files that should be used by rule manager.
Can be in glob format (repeated).
--resend-delay=1m Minimum amount of time to wait before resending
an alert to Alertmanager.
--eval-interval=30s The default evaluation interval to use.
--tsdb.block-duration=2h Block duration for TSDB block.
--tsdb.retention=48h Block retention time on local disk.
Expand Down

0 comments on commit f5c11d7

Please sign in to comment.