Hi Sean,

On Monday, September 12, 2016 at 12:04:27 PM UTC-7, Sean Beckett wrote:

> Maybe you meant to give this as the query?
> 
> 
> SELECT sum(value) FROM online_users WHERE region='xyz' AND time > NOW() - 1d 
> GROUP BY time(1m)

You're completely right - yes, I inadvertently left out the group by time(1m) 
in my first example.

The problem arises when the interval doesn't match the resolution of the 
metrics.

In that case, as you put it, each returned sample is the total number of user 
minutes for all services in that region across the interval. I'd like to have 
the average number of user minutes in that interval.

Specifically:

> SELECT sum(value) FROM online_users WHERE region='xyz' AND time > NOW() - 3h 
> GROUP BY time(1m)

name: online_users
--------------------
time                    sum
1473707700000000000
1473707760000000000     35737
1473707820000000000     35784
1473707880000000000     35790
1473707940000000000     35860
1473708000000000000     35956
1473708060000000000     36006
1473708120000000000     36138
1473708180000000000     36208
<etc etc>


> SELECT sum(value) FROM online_users WHERE region='xyz' AND time > NOW() - 3h 
> GROUP BY time(10m)

name: online_users
--------------------
time                    sum
1473707400000000000     107434
1473708000000000000     362834
1473708600000000000     366671
1473709200000000000     371503
1473709800000000000     370705
1473710400000000000     335785
1473711000000000000     375901
1473711600000000000     380863
1473712200000000000     388686
1473712800000000000     400528
1473713400000000000     287116
1473714000000000000     385399
<etc etc>

-- 
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 [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/01bc0cfa-ae45-4662-a89d-3f3de3ce5c76%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to