influxdata / influxdata/kapacitor

Alerts triggered delayed.

Open
#1,881 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

Hello @nathanielc ,

I'm trying to set an alert but in some cases, the trigger of the alert is delayed.

Following there is the .tick :
```
dbrp "hubstats_lite"."xtgpolicy"

var total_hits = batch
|query('''
SELECT SUM("hit") AS hits
FROM "hubstats_lite"."xtgpolicy"."hotel_avail"
WHERE "hpr" = 'BCO'
''')
.period(1m)
.every(1m)
.offset(3m)
.align()
.groupBy('hpr')

var communication_errors = batch
|query('''
SELECT SUM("hit") AS hits
FROM "hubstats_lite"."xtgpolicy"."hotel_avail"
WHERE "et" = 'Communication_error' and "hpr" = 'BCO'
''')
.period(1m)
.every(1m)
.offset(3m)
.align()
.groupBy('hpr')

total_hits
|join(communication_errors)
.as('total', 'timeout')
.tolerance(1m)
.fill(0.0)
|eval(lambda: int(float("timeout.hits" / "total.hits") * 100.0))
.as('timeout_rate')
|alert()
.info(lambda: TRUE)
.warn(lambda: "timeout_rate" > 5)
.crit(lambda: "timeout_rate" > 20)
.message('{{ .Time }} - BCO is in {{ .Level }} status. Percentage of Communication errors: {{ index .Fields "timeout_rate"}}%')
.slack()
```

As clarification say that the "communication_errors" var can be null.

Following I describe the behaviour of the alert:

- 08:17h The alert is enabled.
- 08:21h Is the first minute in where the "communication_error" query/var is not null.
- 08.24h The first alert is triggered. (This make sense because of the 3m offset)

The message received has as Time data: 08:14h, 3m before the alert is enabled (this also makes sense because of the offset).

I can understand that when the "communication_error" is null, no alert can be triggered, but when a communication error is received the behaviour that I expect is that the alert triggered should be for the time "08:21h" and not "08:14h".

As a conseqüence of this behaviour, the alerts begin to be delayed each time there is a period without data in the "communication_error".

P.S.: If the .tick is disabled, all the delayed alerts not triggered are triggered instantly.

Following there is an example of the delayed alert messages:
![2018-04-03_12h40_24](https://user-images.githubusercontent.com/6134894/38244844-30418434-373c-11e8-9ad2-f27ed5372b1e.png)

At "12:20 UTC +2", the message received has de time "10:12 UTC +0", there are 8 minutes of delay.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied .tick with a nullable communication_errors query, a 3m offset, and an interval without data. Trace the alert pipeline from the batch queries through join and alert evaluation, then compare emitted timestamps with the triggering data. Done means alerts resume without accumulating delay and report the expected event time.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.