You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working with @davidgs on creating a relative rule in Chronograf, we discovered that data was buffering up at the join node.
var db = 'iotdata'
var rp = 'autogen'
var measurement = 'influxdata_sensors'
var groupBy = []
var whereFilter = lambda: TRUE
var name = 'TemperatureChange'
var idVar = name + ':{{.Group}}'
var message = ' {{ index .Fields "value" }}'
var idTag = 'alertID'
var levelTag = 'level'
var messageField = 'message'
var durationField = 'duration'
var outputDB = 'chronograf'
var outputRP = 'autogen'
var outputMeasurement = 'alerts'
var triggerType = 'relative'
var shift = 1m
0s
var crit = 0.1
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|eval(lambda: "temp_f")
.as('value')
var past = data
|shift(shift)
var current = data
var trigger = past
|join(current)
.as('past', 'current')
|eval(lambda: float("current.value" - "past.value"))
.keep()
.as('value')
|alert()
.crit(lambda: "value" > crit)
.stateChangesOnly()
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.post('http://davidgs.com:1880/sensor-reading')
trigger
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag('alertName', name)
.tag('triggerType', triggerType)
trigger
|httpOut('output')
The reason for this is that the timestamps of each of the points is ~1s, but not exactly 1s. The default tolerance for join is 0s and since each point isn't exactly 1s apart, the timestamps wont line up and data will not join.
Specifying a tolerance
...
past
|join(current)
.as('past', 'current')
.tolerance(100ms)
...
allows data to be joined as expected. It would be awesome to have a way to specify tolerance via the UI.
The text was updated successfully, but these errors were encountered:
While working with @davidgs on creating a relative rule in Chronograf, we discovered that data was buffering up at the
join
node.The reason for this is that the timestamps of each of the points is
~1s
, but not exactly1s
. The default tolerance forjoin
is0s
and since each point isn't exactly 1s apart, the timestamps wont line up and data will not join.Specifying a tolerance
allows data to be joined as expected. It would be awesome to have a way to specify tolerance via the UI.
The text was updated successfully, but these errors were encountered: