i have run run 'tsdb uid grep metrics' command and getting below output.
win.service.wait_hint: [0, 19, -108] metrics win.system.context_switches: [0, 19, -119] metrics win.system.cpu_queue: [0, 19, -117] metrics win.system.exceptions: [0, 19, -118] metrics win.system.processes: [0, 19, -113]I need to understand what is meaning of these values given in square brackets.
Short answer:
The uid grep <metric name>
returns the list of metrics. The above output is of format:
<metric-name> [uid]
The confusing array next to the metric name is just the uid of the metric.
Some background (To make more clear) - OpenTSDB assigns an UID to metric
, tagK
, tagV
.
The UID is a positive integer that is unique to the name of the UID object and it's type. Within the storage system there is a counter that is incremented for each metric, tagk and tagv. When you create a new tsdb-uid table, this counter is set to 0 for each type. So if you put a new data point with a metric of sys.cpu.0 and a tag pair of host=web01 you will have 3 new UID objects, each with a UID of 1.
UIDs are (by default) of 3 bytes (24 bits) - OpenTSDB displays (i.e. for HTTP api) this UID (24 bit) as 3 byte array, which is the confusing array of 3 values i.e. [0, 19, -108]
.
From the docs:
UIDs can be displayed in a few ways. The most common method is via the HTTP API where the 3 bytes of UID data are encoded as a hexadecimal string. For example, the UID of 1 would be written in binary as 000000000000000000000001. As an array of unsigned byte values, you could imagine it as [0, 0, 1]. Encoded as a hex string, the value would be 000001 where the string is padded with 0s for each byte. The UID of 255 would result in a hex value of 0000FF (or as a byte array, [0, 0, 255]. To convert between a decimal UID to a hex, use any kind of hex conversion tool you prefer and put 0s in front of the resulting value until you have a total of 6 characters. To convert from a hex UID to decimal, simply drop any 0s from the front, then use a tool to convert the hex string to a decimal.
In some CLI tools and log files, a UID may be displayed as an array of signed bytes (thanks to Java) such as the above example of [0, 0, 1] or [0, 0, -28]. To convert from this signed array to an an array of unsigned bytes, then to hex. For example, -28 would be binary 10011100 which results in a decimal value of 156 and a hex value of 9C.