Kapacitor - join asynchronous streams

kapacitor

#1

Hi,
Is there a way to join asynchronous streams in Kapacitor ?
As an example let’s say I have

  • a periodic stream of data that comes in every hour (m1)
  • another periodic reference stream that comes in once per day (m2)
    My requirement is that everytime m1 comes in, I want to divide it by the latest existing reference (m2)

My current script only works when m1 and m2 are written together into influxdb

var m1 = stream
|from()
.measurement(‘Periodic_Data’)
.groupBy(‘A’, ‘B’, ‘C’)

var m2 = stream
|from()
.measurement(‘Periodic_Data_Reference’)
.groupBy(‘A’, ‘B’, ‘C’)
m1
|join (m2)
.as(‘m1’, ‘m2’)
|eval(lambda: float(“m1.value”) / float(“m2.value”))
.as(‘newval’)
.keep(‘newval’)
|log()
|influxDBOut()
.database(‘some_db’)
.measurement(‘test’)
.tag(‘kapacitor’, ‘true’)

But I’m not sure how to change the script to run when only m1 is updated.

Thanks for your help.