Hi,
I’m in the need to perform a tick based on batch nodes. I need to query 2 times on almost current time to extract the requests and the errors; and perform the same operation with offset to extract the requests and errors from a previous time (5m, 1d, 7d…). This part is working and is like:
var period = 1m
var every = 30s
var conteo = batch
|query('SELECT sum("responseTime.count") AS "conteo_actual" FROM "metrics"."server"')
.period(period)
.every(every)
.groupBy('httpStatus', 'uri')
.align()
|log()
var errores = batch
|query('SELECT sum("responseTime.count") AS "errores_actual" FROM "metrics"."server" WHERE "httpStatus" !~ /((2\d+)|(3\d+))/')
.period(period)
.every(every)
.groupBy('httpStatus', 'uri')
.align()
var conteo_prev = batch
|query('SELECT sum("responseTime.count") AS "conteo_anterior" FROM "metrics"."http.server"')
.period(period)
.every(every)
.groupBy('httpStatus', 'uri')
.align()
.offset(5m)
|log()
var errores_prev = batch
|query('SELECT sum("responseTime.count") AS "errores_anterior" FROM "metrics"."http.server" WHERE "httpStatus" !~ /((2\d+)|(3\d+))/')
.period(period)
.every(every)
.groupBy('httpStatus', 'uri')
.align()
.offset(5m)
This data extraction is working, but now is the tricky part. As far as i know, i can do:
previous
|shift(5m)
|join(current)
But i can no make 2 to 2:
previous,previous_errors
|shift(5m)
|join(current,current_errors)
I tryied with union the four nodes, and make the calculation there…but it neither work…
Any idea / suggestion / next step to move ahead? I’m blocked trying to think waht i’m missing??
I have as another option to store the calculation on a new field, and write a separate tick comparing the actual percent with the prior one (that’s the end of all this!!!) but want to know if the 4 union should work (or even the join…) for this purpose!
Thanks a lot!