I am trying to find a way to get units with the data points when querying opentsdb. I have saved units of metrics in the metadata and can fetch it using the metadata query but that just makes me run an extra query to get it. I was wondering if there is a way to get units in the data that we get back from opentsdb when we make the query (/api/query).
1
votes
2 Answers
0
votes
I think you want to get the raw data you put in openTSDB back. If so, it is hard for openTSDB to do it. openTSDB always aggregate data points at the same timestamp.
If you really want that, you can try kariosDB (a fork of openTSDB ) or you can try elasticsearch (which I think can handle everything openTSDB can)
0
votes
OpenTSDB is time-series database i.e. storing a value for a particular point in time.
It allows to put just one value per timestamp (smallest time interval: 1 second) and per row key (metric name, timestamp, tag=val
).
Suggestion 1: You can put/write the unit as tag value i.e. unit:
When you query (api/query
endpoint), you'll get the complete data:
<metric name> <time stamp> <the value> tag1=val1 tag2=val2
For example:
db.bytes_sent 1287333217 6604859181710 unit=kB host=db1
db.bytes_received 1287333232 327812421706 unit=Mb host=db1
db.bytes_sent 1287333232 6604901075387 unit=MB host=db1