add 60 seconds before and after the alert time (#213)
Reviewed-on: https://git.infini.ltd/infini/console/pulls/213 Co-authored-by: liugq <silenceqi@hotmail.com> Co-committed-by: liugq <silenceqi@hotmail.com>
This commit is contained in:
parent
57bf0976f1
commit
adf642581e
|
@ -946,9 +946,12 @@ func newParameterCtx(rule *alerting.Rule, checkResults *alerting.ConditionResult
|
||||||
min = checkResults.QueryResult.Min
|
min = checkResults.QueryResult.Min
|
||||||
max = checkResults.QueryResult.Max
|
max = checkResults.QueryResult.Max
|
||||||
if v, ok := min.(int64); ok {
|
if v, ok := min.(int64); ok {
|
||||||
|
//expand 60s
|
||||||
|
v = v + int64(time.Second * 60)
|
||||||
min = time.Unix(v/1000, v%1000 * 1e5).UTC().Format("2006-01-02T15:04:05.999Z")
|
min = time.Unix(v/1000, v%1000 * 1e5).UTC().Format("2006-01-02T15:04:05.999Z")
|
||||||
}
|
}
|
||||||
if v, ok := max.(int64); ok {
|
if v, ok := max.(int64); ok {
|
||||||
|
v = v + int64(time.Second * 60)
|
||||||
max = time.Unix(v/1000, v%1000 * 1e5).UTC().Format("2006-01-02T15:04:05.999Z")
|
max = time.Unix(v/1000, v%1000 * 1e5).UTC().Format("2006-01-02T15:04:05.999Z")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue