I have a join that I'm trying to calculate the pass rate.
I'm counting from the same table. My problem is that the value that it
calculate is always 1. If I run the queries separately the value should be
some decimal place number like .31
script
---------------------------------------------------------
var myperiod=60m
var mytime=60m
var myevery=1m
var success = batch
|query('''SELECT count(elapsedTime) FROM "metrics"."autogen"."tasks" where
"status" = 'FINISHED' ''')
.period(myperiod)
.every(myevery)
.groupBy(time(mytime), *)
.fill(0)
var total = batch
|query('''SELECT count(elapsedTime) FROM "metrics"."autogen"."tasks" where
("status"='FINISHED' or "status"='ERROR' ) ''')
.period(myperiod)
.every(myevery)
.groupBy(time(mytime), *)
.fill(0)
// Join success and total
success
|join(total)
.as('success', 'total')
.tolerance(1m)
//Calculate percentage
|where (lambda: "total.count" > 0)
|eval(lambda: "success.count" / ("total.count"))
// Give the resulting field a name
.as('value')
|influxDBOut()
.database('metrics')
.measurement('backupSuccessPercent')
---------------------------------------------------------
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups
"InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/9fb5a62d-cdd4-4f8c-8770-a65fbc3d57d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.