Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OpentTsdb official document Chinese version-query example

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

  The following is a list of sample queries using sample data sets. We'll describe some common query types you might encounter to understand how query systems work. Each time series in the sample collection stores only one data point, and the UID has been truncated to a single byte for ease of reading. The sample queries are all metric queries from the HTTP API and show only the m= component. For more information, see/api/query. If you are using the CLI tool, the query format will be slightly different, read the documentation for the specific command.

Time series metric label TSUID1sys.cpu.systemdc=dal host=web0101020401012sys.cpu.systemdc=dal host=web0201020401023sys.cpu.systemdc=dal host=web0301020401034sys.cpu.systemhost = web0101015sys.cpu.systemdc =lax host= web0101020501017sys.cpu.systemdc = lax host=web020101020501028sys.cpu.systemdc=dal host=web010202020401019sys.cpu.systemdc=dal host=web02020202040102

UIDS

NameUIDMetrics cpu.system01cpu.user02Tagks host01dc02owner03Tagvs web0101web0202web0303dal04lax05jdoe06

Warning:

  This is not the best way to set metrics and labels, but rather to illustrate how query systems work. TS #4 and 5, in particular, although legitimate time series, may mess up your query unless you know how they work. In general, try to keep the same number and type of labels for each time series.

Under the hood

  You may be wondering how OpenTSDB stores time series data here: Storage. Otherwise, remember that each row in memory has a unique formatted key:

[... ]

The data table above will be stored as

01

< TS >

0101 01

< TS >

01010306 01

< TS >

02040101 01

< TS >

02040102 01

< TS >

02040103 01

< TS >

02050101 01

< TS >

02050102 02

< TS >

02040101 02

< TS >

02040102

  When you query OpenTSDB:

The query is parsed and validated to ensure that the format is correct and that metrics, tag names, and tag values are present. If no single metric, label name or value exists in the system, an error is returned. It then sets up the scanner for the underlying storage system. If the query doesn't have any labels or label values, it will grab any matching rows of data, so if you have a large time series for a particular metric, this could be many rows. If the query does define one or more tags, it will still scan all rows that match, but it will also execute regular expressions to return only rows that contain the requested tags. Once all the data is returned, OpenTSDB organizes it into groups, downsamples each individual time series into smaller time spans using an appropriate aggregator if downsampling is required, and aggregates each group of data using a specific aggregation function. Results returned to caller

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report