On Monday, November 21, 2016 at 10:53:00 AM UTC-6, nath...@influxdb.com wrote:
> The outer join will work in Kapacitor but it does require that points arrive, 
> Meaning if two points arrive and there is a gap between them then the outer 
> join will fill in all the missing points. But it can't do so until the second 
> point arrives since it doesn't know if the point is just delayed or missing. 
> And you are also running up against this issue 
> https://github.com/influxdata/influxdb/issues/6412. Typically using the 
> deadman node is a workaround but without more details on your end goal it is 
> hard to tell 
> .https://docs.influxdata.com/kapacitor/v1.1/nodes/query_node/#deadman
> 
> On Saturday, November 19, 2016 at 7:24:34 AM UTC-7, job...@gmail.com 
> wrote:influxdb 1.1, kapacitor 1.1
> 
> 
> 
> I'm trying to capture counts in another measurement.  I have this script
> 
> 
> 
> ---------------------------------
> 
> ID: task_rates
> 
> Error: 
> 
> Template: 
> 
> Type: batch
> 
> Status: enabled
> 
> Executing: true
> 
> Created: 19 Nov 16 06:30 CST
> 
> Modified: 19 Nov 16 08:15 CST
> 
> LastEnabled: 19 Nov 16 08:15 CST
> 
> Databases Retention Policies: ["metrics"."days30"]
> 
> TICKscript:
> 
> // go back in time
> 
> var myperiod = 60m
> 
> 
> 
> // group by time
> 
> var mytime = 60m
> 
> 
> 
> // sample every time
> 
> var myevery = 1m
> 
> 
> 
> // Task type
> 
> // measurement to put the results
> 
> var mymeasurement = 'taskRates'
> 
> 
> 
> // purposely forcing batch to return 0 records, this easily will duplicate 
> the problem
> 
> var success = batch
> 
>     |query(' SELECT count(jobRunTime) FROM "metrics"."days30"."tasks" where  
> "status" = \'FINISHED1\' ')
> 
>         .period(myperiod)
> 
>         .every(myevery)
> 
>         .groupBy(time(mytime), 'id', 'serverID', 'taskType', 'component')
> 
>         .align()
> 
>         .fill(0)
> 
> 
> 
> // Get views total
> 
> var total = batch
> 
>     |query('SELECT count(jobRunTime) FROM "metrics"."days30"."tasks" where  
> ("status"=\'FINISHED\' or "status"=\'ERROR\') ')
> 
>         .period(myperiod)
> 
>         .every(myevery)
> 
>         .groupBy(time(mytime), 'id', 'serverID', 'taskType', 'component')
> 
>         .align()
> 
>         .fill(0)
> 
> 
> 
> // Join success and total
> 
> success
> 
>     |join(total)
> 
>         .as('success', 'total')
> 
>         .tolerance(60s)
> 
>         .fill(0)
> 
>     |eval(lambda: "success.count", lambda: "total.count")
> 
>         // Give the resulting field a name
> 
>         .as('success', 'total')
> 
>     |influxDBOut()
> 
>         .database('metrics')
> 
>         .measurement(mymeasurement)
> 
> 
> 
> DOT:
> 
> digraph task_rates {
> 
> graph [throughput="0.00 batches/s"];
> 
> 
> 
> query2 [avg_exec_time_ns="0s" batches_queried="80" points_queried="160" 
> query_errors="0" ];
> 
> query2 -> join4 [processed="80"];
> 
> 
> 
> query1 [avg_exec_time_ns="0s" batches_queried="0" points_queried="0" 
> query_errors="0" ];
> 
> query1 -> join4 [processed="0"];
> 
> 
> 
> join4 [avg_exec_time_ns="40.52µs" ];
> 
> join4 -> eval5 [processed="0"];
> 
> 
> 
> eval5 [avg_exec_time_ns="0s" eval_errors="0" ];
> 
> eval5 -> influxdb_out6 [processed="0"];
> 
> 
> 
> influxdb_out6 [avg_exec_time_ns="0s" points_written="0" write_errors="0" ];
> 
> }
> 
> 
> 
> -------------------------------
> 
> 
> 
> the problem is if query1 doesn't return any rows, I don't get any records in 
> my measurement.
> 
> 
> 
> What did I do wrong?

I'm trying to compute the pass rate percentage. So i'm saving the pass rate and 
the total for the hour in the taskRates measurement.  The status can have two 
value FINISHED and ERROR. 

so the real query above is 

var success = batch 
    |query(' SELECT count(jobRunTime) FROM "metrics"."days30"."tasks" where  
"status" = \'FINISHED\' ') 
        .period(myperiod) 
        .every(myevery) 
        .groupBy(time(mytime), 'id', 'serverID', 'taskType', 'component') 
        .align() 
        .fill(0) 

  What happens, the query above just queries for FINISHED.  if for the hour a 
task runs 10 times for a serverID and the status is ERROR. This query will 
return null and it won't write the record success=0, total=10.  I want to group 
a set of servers and calculate a rate i would do 

select sum(success)/sum(total) from taskRates where component='mytag', it will 
excluded the total and the calculation will be wrong.

Is there a workaround for this?

-- 
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 influxdb+unsubscr...@googlegroups.com.
To post to this group, send email to influxdb@googlegroups.com.
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/01be9648-0bcf-4d0e-807e-75c140d50371%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to