Query Help

18 views
Skip to first unread message

Randy Melder

unread,
Sep 30, 2011, 3:56:42 PM9/30/11
to OpenTSDB
Group,

I am trying to obtain counts (sum) over time for various metrics. Here
is my query:

http://my-host:4242/q?start=2011/09/01-00:00:00&end=2011/09/30-23:59:59&m=sum:user.setup&o=&yrange=[0:]&ascii=1&nocache=1

This returns:
user.setup 1317342007 1
user.setup 1317344917 1
user.setup 1317354274 1

I was hoping for a single line like:

user.setup 1317354274 3

Is there an examples page showing common aggregations?

My notion was to flip the 'ascii' parameter to 'json' as in:
http://my-host:4242/q?start=2011/09/01-00:00:00&end=2011/09/30-23:59:59&m=sum:user.setup&o=&yrange=[0:]&json&nocache=1

{

"plotted": 7,
"points": 7,
"etags": [
[
"user_id"
]
],
"timing": 31

}

So my first question is "what is the correct method of obtaining a
total count over time?" My follow up question is "(how) can I get data
summarized by day over a date range?"

Thanks!

--
- - - - - - - - - - - - - - - - - - - - - - - -
randy...@gmail.com

NOTICE: The information contained in this e-mail is confidential and
is for the use only of the intended recipient. If you are not the
intended recipient, any disclosure, copy, distribution or other use of
this information is prohibited. If you have received this
communication in error please notify us immediately by telephone and
delete or discard this message immediately.

tsuna

unread,
Sep 30, 2011, 4:17:36 PM9/30/11
to Randy Melder, OpenTSDB
On Fri, Sep 30, 2011 at 12:56 PM, Randy Melder <randy...@gmail.com> wrote:
> So my first question is "what is the correct method of obtaining a
> total count over time?" My follow up question is "(how) can I get data
> summarized by day over a date range?"

It sounds like you're trying to downsample your data to a 1d-sum.
Search for the world "downsample" in
http://opentsdb.net/http-api.html#/q_Parameters

--
Benoit "tsuna" Sigoure
Software Engineer @ www.StumbleUpon.com

Randy Melder

unread,
Sep 30, 2011, 5:03:16 PM9/30/11
to tsuna, OpenTSDB
On Fri, Sep 30, 2011 at 1:17 PM, tsuna <tsun...@gmail.com> wrote:
> On Fri, Sep 30, 2011 at 12:56 PM, Randy Melder <randy...@gmail.com> wrote:
> It sounds like you're trying to downsample your data to a 1d-sum.
> --
> Benoit "tsuna" Sigoure

I added this as in:
q?start=2011/09/28-12:00:00&end=2011/09/30-13:51:38&m=sum:1d-sum:user.count&o=&yrange=[0:]&ascii

Which hands back 9 lines, each with a value of 1 and a timestamp. If I
change ascii to json, it returns 9 points in a single closure.

I guess what I'm trying to do is to replicate the following SQL in
opentsdb language:

SELECT date_created, COUNT(*)
FROM table
GROUP BY date_created;

Is this possible?

Randy Melder

unread,
Sep 30, 2011, 5:17:24 PM9/30/11
to tsuna, OpenTSDB
To add to my point, these two queries produce identical output:

q?start=2011/09/28-12:00:00&end=2011/09/30-13:51:38&m=sum:1d-sum:user.count&o=&yrange=[0:]&ascii

vs
q?start=2011/09/28-12:00:00&end=2011/09/30-13:51:38&m=sum:user.count&o=&yrange=[0:]&ascii

I'm assuming the downsample would group by Nday.

Reply all
Reply to author
Forward
0 new messages