首页  

PromQL 基础     所属分类 prometheus 浏览量 83
PromQL   Prometheus Query Language

http_requests_total{code="200"}

PromQL 查询结果 类型
瞬时数据 (Instant vector): 包含一组时序,每个时序只有一个点,例如:http_requests_total
区间数据 (Range vector): 包含一组时序,每个时序有多个点,例如:http_requests_total[5m]
纯量数据 (Scalar): 纯量只有一个数字,没有时序,例如:count(http_requests_total)

时序数据  名字 + 一组标签

一个简单的查询相当于是对各种标签的筛选 

http_requests_total{code="200"} 
查询名字为 http_requests_total,code 为  200 的数据

查询条件支持正则匹配 

http_requests_total{code!="200"}  // code 不为 200 
http_requests_total{code=~"2.."} // code 为 2xx 
http_requests_total{code!~"2.."} // code 不为  2xx 


操作符 算术运算符 +,-,*,/,%,^ http_requests_total * 2 比较运算符 ==,!=,>,<,>=,<= http_requests_total > 100 http_requests_total 结果中大于 100 的数据 逻辑运算符 and,or,unless http_requests_total == 5 or http_requests_total == 2 聚合运算符 sum,min,max,avg,stddev,stdvar,count,count_values,bottomk,topk,quantile max(http_requests_total) 运算符优先级 (^)> (*, /, %) > (+, -) > (==, !=, <=, <, >=, >) > (and, unless) > (or)
内置函数 floor(avg(http_requests_total{code="200"})) ceil(avg(http_requests_total{code="200"})) 5分钟内,平均每秒请求数 rate(http_requests_total[5m]) prometheus server自己的指标 http://localhost:9090/metrics prometheus_http_requests_total 最大的7个序列 topk(7, prometheus_http_requests_total) prometheus_http_requests_total 最小的7个序列 bottomk(7, prometheus_http_requests_total) sum by (code) (prometheus_http_requests_total) sum(prometheus_http_requests_total) by (code) 每条记录的平均大小 sum(increase(doris_be_stream_load{type='receive_bytes'}[5m])) / sum(increase(doris_be_load_rows[5m])) 与5分钟前比较 doris_be_load_rows / doris_be_load_rows offset 5m

上一篇     下一篇
flinkcdc3.0 checkpoint 和 restart 策略 配置及测试

flink job 快照机制 恢复机制 checkpoint 和 savepoint

Grafana 告警设置

杭州登山路线2024

zookeeper Monitor prometheus + grafana

Prometheus node_exporter 告警规则