In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "Prometheus 'method of introducing'@'modifier". The explanation in this article is simple and clear, easy to learn and understand. Please follow the idea of Xiaobian to study and learn "Prometheus' method of introducing '@' modifier" together.
Have you ever chosen 10 time series and got 100 instead of 10? If so, this is for you. Let me walk you through what the underlying problem is and how I solved it.
Currently, topk() queries only make sense as an instant query, you get exactly k results, but when you run it as a range query, you get more results because each step is computed independently. This @ modifier allows you to fix the ranking of all steps in a range query.
In Prometheus v2.25.0, we introduced a new PromQL modifier,@. Just as the offset modifier lets you fix the evaluation of vector selectors, range vector selectors, and subqueries at a fixed time offset from the evaluation time, the @ modifier lets you fix the evaluation of these selectors regardless of query evaluation time. Credit for this grammar goes to Björn Rabenstein.
@
@
@
is a unix timestamp, described in float.
For example, the query http_requests_total@1609746000 returns the value http_requests_total at 2021-01-04T07:40:00+00:00. Query rate(http_requests_total[5m]@1609746000) returns the 5-minute rate of simultaneous http_requests_total.
In addition, start() and end() can also be special values for the @ modifier. For range queries, they resolve to the beginning and end of the range query, respectively, and remain the same for all steps. For instant queries, both start() and end() resolve to compute time.
Returning to the topk() fix discussion, the following query plots the 1m rates of http_requests_total in these series, with their last 1h rate in the top 5. So now you can understand topk() and even plot it as a range query to exactly k results.
rate(http_requests_total[1m]) # This acts like the actual selector.
and
topk(5, rate(http_requests_total[1h] @ end())) # This acts like a ranking function which filters the selector.
Similarly, topk() ranking can be replaced with other functions, such as histogram_quantile(), which is now only used for instant queries. rate() can be replaced with_over_time(), etc. Let us know how you use this new modifier!
The @ modifier is disabled by default and can be enabled using the flag--enable-feature=promql-at-modifier.
Thank you for reading, the above is the content of "Prometheus introduces the '@' modifier method", after the study of this article, I believe you have a deeper understanding of Prometheus 'introduction of the'@'modifier method, the specific use of the situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.