// This is my script var today_trips = batch |query(''' SELECT count(count) as count FROM "product"."default".leads ''') .period(24h) .cron('28 18 * * * *') |log()
var yesterday_trips = batch |query(''' SELECT count(count) as count FROM "product"."default".leads WHERE "time" < now() - 1d ''') .period(48h) .cron('28 18 * * * *') |log() today_trips |join(yesterday_trips) .as('today_trips', 'yesterday_trips') .tolerance(48h) .fill(0.0) |eval( lambda: int("today_trips.count"), lambda: int("yesterday_trips.count"), lambda: float(100.0 * float(float("today_trips.count" - "yesterday_trips.count") / float("yesterday_trips.count"))) ) .as('today_trip', 'yester_trip', 'perc') |log() |alert() .id('Lead creation Dip/Increase alert Task Name : {{ .TaskName }}') .message('{{ .ID }}, Alert Time : {{.Time}}') .details(''' <h4>{{ .Message }}</h4> <p>Total Trip Created in last 24 hours: {{ index .Fields "today_trip" }}</p> <p>Total Trip Created in last 24 to 48 hours: {{ index .Fields "yester_trip" }}</p> <p>Trip Dip/Increase: {{ index .Fields "perc" | printf "%0.2f" }}% </p> ''') .info(lambda: "perc" < -1.0 OR "perc" > 1.0) .log('/var/log/kapacitor/kapacitor.log') Log of this Script Log 1-- when data point joined [leads:log2] 2016/09/13 17:37:00 I! {leads 2016-09-13 17:37:00 +0000 UTC false map[] [{2016-09-12 17:37:00 +0000 UTC map[count:2653] map[]}]} [leads:log4] 2016/09/13 17:37:00 I! {leads 2016-09-13 17:37:00 +0000 UTC false map[] [{2016-09-11 17:37:00 +0000 UTC map[count:2295] map[]}]} [leads:log8] 2016/09/13 17:37:00 I! {leads 2016-09-14 00:00:00 +0000 UTC false map[] [{2016-09-12 00:00:00 +0000 UTC map[perc:15.59912854030501 today_trip:2653 yester_trip:2295] map[]}]} Log 2 -- when data point not joined [leads:log2] 2016/09/14 19:22:00 I! {leads 2016-09-14 19:22:00 +0000 UTC false map[] [{2016-09-13 19:22:00 +0000 UTC map[count:2261] map[]}]} [leads:log4] 2016/09/14 19:22:00 I! {leads 2016-09-14 19:22:00 +0000 UTC false map[] [{2016-09-12 19:22:00 +0000 UTC map[count:2666] map[]}]} [leads:log8] 2016/09/14 19:22:00 I! {leads 2016-09-15 00:00:00 +0000 UTC false map[] [ {2016-09-12 00:00:00 +0000 UTC map[today_trip:0 yester_trip:2666 perc:-100] map[]} {2016-09-15 00:00:00 +0000 UTC map[yester_trip:0 perc:+Inf today_trip:2261] map[]}]} why this batch query joins some time but same batch query not join Can you also explain how tolerance round up time stamp -- -- Remember to include the InfluxDB version number with all issue reports --- You received this message because you are subscribed to the Google Groups "InfluxDB" 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/a58398ab-567f-4ea3-8152-9a8096ab6bdc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.