Using filters and groupBy tags in the built in GUI or other front ends

117 views
Skip to first unread message

Mark G

unread,
Oct 8, 2015, 8:46:23 AM10/8/15
to OpenTSDB

From the Query API


"For URI queries, the type precedes the filter expression in parentheses. The format is <tagk>=<type>(<filter_expression>). Whether or not results are grouped depends on which curly bracket the filter is in. Two curly braces are now supported per metric query. The first set is the group by filter and the second is a non group by filter, e.g. {host=web01}{colo=regexp(sjc.*)}. If you only want to filter without grouping then the first curly set must be empty,e.g. ``{}{host=web*}"



Is there a way to build the tag values and keys in such a way to specify which ones to groupby or not? When I input tags into the gui it will just create one set of tagks and tagvs under only one set of braces. I can't really find any relevant options to accomplish this or how to specify my tags properly.

jwestfal...@jwestfall.net

unread,
Oct 21, 2015, 3:03:38 PM10/21/15
to OpenTSDB
I was curious about this too and looked at the code to see whats up.  It appears impossible as things are now.  The GUI is using the legacy graphing api (/q?<request>&png) to make the png images.  This legacy api doesn't know anything about the double {} / group by syntax.  The newer /api/query?<request> api can handle the double {} / group by syntax, but it doesn't have the ability to make png images.

On a side note, from testing the wording of the docs you included seems backwards.  Unless I'm missing something:

"non-group by" should mean, host=* returns data points for each host
"group by" should mean, host=* returns a single set of data points for all hosts

So the wording should be:
"The first set is the non group by filter and the second is a group by filter, e.g. {host=web01}{colo=regexp(sjc.*)}. If you only want to filter with grouping then the first curly set must be empty,e.g. ``{}{host=web*}"

Thanks
jim

ManOLamancha

unread,
Nov 10, 2015, 6:18:10 PM11/10/15
to OpenTSDB
On Thursday, October 8, 2015 at 5:46:23 AM UTC-7, Mark G wrote:
Jim's right, the built in UI uses the old API and doesn't support group by/non-group by yet.  Track https://github.com/OpenTSDB/opentsdb/issues/615 and I'll try to get something in 2.3 (once I learn gwt....)

ManOLamancha

unread,
Nov 10, 2015, 6:21:43 PM11/10/15
to OpenTSDB
On Wednesday, October 21, 2015 at 12:03:38 PM UTC-7, jwestfal...@jwestfall.net wrote:
On a side note, from testing the wording of the docs you included seems backwards.  Unless I'm missing something:

"non-group by" should mean, host=* returns data points for each host
"group by" should mean, host=* returns a single set of data points for all hosts

So the wording should be:
"The first set is the non group by filter and the second is a group by filter, e.g. {host=web01}{colo=regexp(sjc.*)}. If you only want to filter with grouping then the first curly set must be empty,e.g. ``{}{host=web*}"

The wording is really weird but it is correct in the documentation. "group by" with host=* is really "get all of the series for metric X and group the results by host" where you expect to have multiple hosts and therefore expect to have one series per host. I should replace "non-group by" with "aggregate" or "collapse" or something (any suggestions?) In that case, a "host=*" filter doesn't make much sense, but a "host=webserver*" might cause I want one series that includes only the web servers, not the databases or routers or whatnot.
Reply all
Reply to author
Forward
0 new messages