How to get Available Tags and/or Tag Values for a Metric

498 views
Skip to first unread message

Kyle Brandt

unread,
Sep 13, 2013, 12:28:54 PM9/13/13
to open...@googlegroups.com
I'm wondering how to query OpenTSBD 2.x to answer the following questions:
  • Given a metric, how do I find out what valid tags (tag keys really) exist for that metric?
  • Give a metric and tag key, how to I find out what the valid tag values are?
  • Given a tag key, how do I find out what metrics exist for this key
Poking around I haven't found a obvious way to do this. That is making me think that maybe there isn't a direct way to do some of these since they feel like relational questions. But perhaps there is a direct way, or an indirect way using search (these are mostly indexish questions I think), metadata, and/or trees?

Thanks!
Kyle
 

Carsten Saathoff

unread,
Sep 14, 2013, 3:54:54 AM9/14/13
to open...@googlegroups.com
Hi,
the tags can be assigned on the fly. At any point in time, a new datapoint with never seen tag keys and values might be stored. So there is no definition of legal or available tag keys and values. That's part of how you design your metrics and can only be controlled in your monitoring setup or application, respectively.

Currently the most direct way to get all tags stored is probably via the tree API, which requires, however, that you have enabled it and have trees defined. And direct means in this case you have to traverse the complete tree and collect the information you require on your way.

Locally I have branch running, where I have extended the /api/uid/tsmeta endpoint to return me the TSMetas for all timeseries stored in OpenTSDB (which can be a pretty large piece of JSON ;)). The branch is on github: https://github.com/kodemaniak/opentsdb/tree/query_all_tsm

But again you would need to iterate over all timeseries to find out what tags are available. But that's easier than using the tree API.

ManOLamancha

unread,
Sep 16, 2013, 2:43:35 PM9/16/13
to open...@googlegroups.com

I'll add some API calls for 2.1 that will handle this in a clean manner. Make sure to enable meta data tracking so that it fills in the TSUID table. But right now the closest answer for your queries would be to use the search plugin to publish to Elastic Search and query against that data. Or you could use Trees as Carsten pointed out to build a hierarchical structure similar to a file system fro browsing.
Reply all
Reply to author
Forward
0 new messages