Thanks for reply. Unfortunately, flatten does not work for me - it operates on 
TAGS, not MEASUREMENTS. 
I've added log node after query and that's what it prints out:

[api_calc:log2] 2017/01/17 08:41:00 I! ---- API  ---- {api_requests 2017-01-17 
08:41:00 +0000 UTC  false map[] [{2017-01-17 08:40:58.817 +0000 UTC 
map[size:1027] map[]} {2017-01-17 08:40:59.428 +0000 UTC map[size:1618] map[]}]}
[api_calc:log2] 2017/01/17 08:41:00 I! ---- API  ---- {products_messages 
2017-01-17 08:41:00 +0000 UTC  false map[] [{2017-01-17 08:40:49.108 +0000 UTC 
map[size:29] map[]} {2017-01-17 08:40:50.997 +0000 UTC map[size:29] map[]} 
{2017-01-17 08:40:53.007 +0000 UTC map[size:29] map[]}]}

As you can see, query node produces two separate batches (if I understand 
correctly) and I cannot figure out how to combine them. Any other ideas?

W dniu środa, 11 stycznia 2017 23:14:17 UTC+1 użytkownik [email protected] 
napisał:
> I think the flatten node 
> https://docs.influxdata.com/kapacitor/v1.1/nodes/flatten_node/ might be what 
> you are looking for, but its a little hard to tell without example data.
> 
> On Wednesday, January 11, 2017 at 4:08:11 AM UTC-7, 
> [email protected] wrote:Helllo,
> I'm trying to count requests and their total size that come to my system from 
> couple APIs and I can't figure out how to combine the measurements together. 
> This is my TICK script:
> <pre>
> var api_node = batch
>     |query('''
>         SELECT "size" FROM "database"."api.requests"./.+/
>     ''').period(1m)
>         .every(1m)
>         .align()
>     |eval(lambda: ceil(float("size") / 1024.0))
>         .as('full_requests')
>         .keep('size', 'full_requests')
> var count_node = api_node
>     |sum('full_requests')
>         .as('requests')
> var sum_node = api_node
>     |sum('size')
>         .as('sum')
> count_node
>     |join(sum_node)
>         .as('count', 'size')
>     |influxDBOut()
>         .database('database')
>         .retentionPolicy('default')
>         .measurement('requests')
>         .precision('s')
> </pre>
> Right now in the "api.requests" retention policy there are 2 measurements and 
> batches from these measurements travel through pipeline separately - 2 points 
> arrive at the influxDBOut node. I want them grouped together so I get a sum 
> of both of them.
> How can I achieve that? The important aspect is that I don't have a guarantee 
> that there are points in every period in every measurements, so joining 2 
> batches doesn't always work.

-- 
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/de03d8c1-2025-4042-9e28-ecdfd9816838%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to