influxdata / influxdata/kapacitor
relative trigger counts % change in both side
- Dominant language
- Go
- Stars
- 2.4k
- Forks
- 479
- Avg merge
- 4d 16h
- Merged PRs (30d)
- 4
Description
We have configured trigger with triggerType = 'relative'.
We need to receive an alert when the current value has increased by 30% compared to the past value (24 hours before).
But, unfortunately, we get alerts and when the current value is less than the past by 30%.
var name = 'PH Increase of errors' # **alert about increase of errors and we do not need to receive alerts when the number of alerts was decreased.**
my Tickscript:
***
var triggerType = 'relative'
var shift = 24h
0m
0s
var crit = 30
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|window()
.period(period)
.every(every)
.align()
|mean('value')
.as('value')
var past = data
|shift(shift)
var current = data
var trigger = past
|join(current)
.as('past', 'current')
|eval(lambda: abs(float("current.value" - "past.value")) / float("past.value") * 100.0)
.keep()
.as('value')
|alert()
.crit(lambda: "value" > crit)
***
Please help to solve the problem, thanks.
Contributor guide
Research direction
Start with the relative-trigger behavior described in the Tickscript, especially the eval expression using abs() and the alert condition. Trace how relative trigger comparisons are implemented in Kapacitor and identify the relevant tests, if present. Done means decreases no longer produce alerts while increases of at least 30% still do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100