How to join with kapacitor?


code :
// Get errors stream data
var tes1 = stream

// Get views stream data
var tes2 = stream

// Join errors and views
.as(‘tes1’, ‘tes2’)
|where(lambda: “tes1.ip” == “tes2.ip”)
|eval(lambda: “tes1”, lambda: “tes2”)
.as(‘tes1’, ‘tes2’)


This is the case:
We have 2 measurement, sitescope and reference (we want to use this table to reference each ip belong to which service/location)

sitescope format: timestamp, ip as (tag), hostname as (tag), monitor_type as (tag), metric_name as (tag), and metric_value as (field)
Example data: 1526461228, 10.10.x.x, DMxxxx, CPU, utilization, 5

reference: timestamp, ip as (tag), service as (tag), location as (tag), and ref_status as (field)
Example: 1526461228, 10.10.x.x, Petshop, DC1, 1

How to combine / join the table so we can query metric_value based on service/location?