opentsdb uid grep输出理解

Opentsdb uid grep output understanding

我有 运行 运行 'tsdb uid grep metrics' 命令并得到以下输出。

    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]
    
我需要了解方括号中给出的这些值的含义。

简答uid grep <metric name> returns 指标列表。以上输出格式为:

<metric-name> [uid]

度量名称旁边的混淆数组只是度量的 uid。


一些背景(为了更清楚)- OpenTSDB 将 UID 分配给 metrictagKtagV

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.

UID(默认情况下)为 3 个字节(24 位)- OpenTSDB 显示(即对于 HTTP api)此 UID(24 位)为 3 字节数组,这是 3 个值的混淆数组即 [0, 19, -108].

来自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.