influxdata / influxdata/kapacitor

JOIN node empty result

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

Description

Hello,

I use following TICK script for relative change:

```
var alertId string

var alertQuery string

var shift duration

var offset duration

var groupBy = ''

var condition lambda

var triggerCondition lambda

var webhookUrl string

var outputDB = 'alerts'

var outputRP = 'autogen'

var outputMeasurement = 'alerts'

var current = batch
|query(alertQuery)
.period(1d)
.groupBy(groupBy, time(shift))
.every(1m)
.align()
|stateCount(lambda: "value" >= 0 OR "value" < 0)
.as('index')
|log()

var past = batch
|query(alertQuery)
.period(1d)
.groupBy(groupBy, time(shift))
.every(1m)
.align()
.offset(offset)
|shift(offset)
|log()

var trigger = current
|join(past)
.as('past', 'current')
|log()
|eval(lambda: condition)
.keep()
.as('value')
|alert()
.crit(lambda: triggerCondition AND "current.index" == 1)
.stateChangesOnly(shift)
.post(webhookUrl)
```

Unfortunately after join result is empty. Here are logs with example values for current and past nodes:

```
ts=2018-10-23T00:43:00.056+02:00 lvl=debug msg="starting next batch query" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 query="SELECT sum(\"Measure Values\") AS value FROM metrics.autogen.ZDhbo85eCP7SBqPQ5 WHERE \"Measure Names\" = 'Paid Clicks' AND time >= '2018-10-21T08:43:00Z' AND time < '2018-10-22T08:43:00Z' GROUP BY \"\", time(1h, 0s) ORDER BY time DESC"
ts=2018-10-23T00:43:00.056+02:00 lvl=debug msg="starting next batch query" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 query="SELECT sum(\"Measure Values\") AS value FROM metrics.autogen.ZDhbo85eCP7SBqPQ5 WHERE \"Measure Names\" = 'Paid Clicks' AND time >= '2018-10-21T22:43:00Z' AND time < '2018-10-22T22:43:00Z' GROUP BY \"\", time(1h, 0s) ORDER BY time DESC"
ts=2018-10-23T00:43:00.062+02:00 lvl=info msg="begin batch" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= time=2018-10-22T22:00:00Z
ts=2018-10-23T00:43:00.062+02:00 lvl=info msg="begin batch" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= time=2018-10-22T14:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2618 time=2018-10-22T22:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=7 field_index=1 time=2018-10-22T14:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2445 time=2018-10-22T21:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_index=2 field_value=1586 time=2018-10-22T13:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=1464 time=2018-10-22T20:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2912 field_index=3 time=2018-10-22T12:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=808 time=2018-10-22T19:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_index=4 field_value=2817 time=2018-10-22T11:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2800 field_index=5 time=2018-10-22T10:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=232 time=2018-10-22T18:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=161 time=2018-10-22T17:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2789 field_index=6 time=2018-10-22T09:00:00Z
ts=2018-10-23T00:43:00.063+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=118 time=2018-10-22T16:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=78 time=2018-10-22T15:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2618 field_index=7 time=2018-10-22T08:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=97 time=2018-10-22T14:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=2445 field_index=8 time=2018-10-22T07:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=160 time=2018-10-22T13:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=1464 field_index=9 time=2018-10-22T06:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=1284 time=2018-10-22T12:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=808 field_index=10 time=2018-10-22T05:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=0 time=2018-10-22T00:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=232 field_index=11 time=2018-10-22T04:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=503 time=2018-10-21T23:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=161 field_index=12 time=2018-10-22T03:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=118 field_index=13 time=2018-10-22T02:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=78 field_index=14 time=2018-10-22T01:00:00Z
ts=2018-10-23T00:43:00.064+02:00 lvl=info msg="end batch" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= time=2018-10-22T22:00:00Z
ts=2018-10-23T00:43:00.065+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=97 field_index=15 time=2018-10-22T00:00:00Z
ts=2018-10-23T00:43:00.065+02:00 lvl=info msg="batch point" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= field_value=160 field_index=16 time=2018-10-21T23:00:00Z
ts=2018-10-23T00:43:00.065+02:00 lvl=info msg="end batch" service=kapacitor task_master=main task=TueBBobiiNbqLKCio node=influxdb_out12 prefix= name=ZDhbo85eCP7SBqPQ5 group== tag_= time=2018-10-22T14:00:00Z
```

In this case rows with timestamp `2018-10-22T14:00:00Z` should join together, so `field_value=7 field_index=1` with `field_value=97`, and other rows in following manner too. However as you see in the logs, join result is empty and alert is not triggered. I am not sure what I am doing wrong here. Could you please advice?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the supplied TICK script and inspecting the JOIN node using the logged batch timestamps. Compare the current and past streams at 2018-10-22T14:00:00Z and determine why matching rows produce no join output. Done means matching timestamps join as expected and the alert path receives the resulting points.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.