2

#PromQL# 速查手册:常用 PromQL 命令

 2 years ago
source link: https://lottewong.github.io/2022/01/09/%E9%80%9F%E6%9F%A5%E6%89%8B%E5%86%8C%E4%B9%8B%E5%B8%B8%E7%94%A8PromQL%E5%91%BD%E4%BB%A4/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
#PromQL# 速查手册:常用 PromQL 命令
4 months ago 2 minutes read (About 308 words) 6 visits

#PromQL# 速查手册:常用 PromQL 命令

覆盖在学习和工作中的常用 PromQL 命令:输入数据类型 / 输出数据类型 / 运算符 / 聚合操作 / 内置函数


目录 Table of Contents


输入数据类型

  1. 字符型:”string” 或 ‘string’ 或 str∈gstr∈g
  2. 整数型:0
  3. 浮点型:0.0

输出数据类型

  1. 瞬时数据(instant vector):qps
  2. 区间数据(range vector):qps[1d]
  3. 标量数据(scalar):count(qps)

运算符

算术运算符

  1. 乘、除、取模

比较运算符

  1. 精确匹配:==!=
  2. 正则匹配:=~!~

逻辑运算符

  1. andunless
  2. or
  3. bywithout

条件运算符

  1. {key ? value}

聚合操作

  1. sum, min, max, avg, stddev, stdvar, count
  2. count:对键计数,count(qps)
  3. count_values:对值计数,count_values("count", qps)
  4. bottomk, topk:后 k 位 - bottomk(3, qps);前 k 位 - topk(3, qps)
  5. quantile:分位数,quantile(0.5, qps)
  6. offset:时间前偏移量,offset 1d

内置函数

  1. rate:平均的增长率
  2. irate:瞬时的增长率
  3. increase:每分钟的增量

# PromQL

Comments

Related Issues not found

Please contact @LotteWong to initialize the comment


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK