可观测性
做下自我介绍
Grafana
https://github.com/grafana/grafana
The open-source platform for monitoring and observability
- 一个开源的数据可视化工具:将数据源中的数据转换成可视化图表
- 支持多种数据源,包括Prometheus、InfluxDB、Elasticsearch、MySQL等
- 另外就是Dashboard、Alert
Loki - Grafana
https://github.com/grafana/loki
Loki: like Prometheus, but for logs.
- 开源,多租户,日志聚合系统
- 受到Prometheus的启发
- LogQL(跟PromQL很像,不过多了日志流处理)
Prometheus - CNCF
https://github.com/prometheus/prometheus
https://prometheus.io/docs/introduction/overview/
From metrics to insight
Power your metrics and alerting with the leading
open-source monitoring solution.
- 一个开源的完整监控解决方案
- PromQL
- 2016年加入云原生计算基金会(CNCF),成为继Kubernetes之后的第二个托管项目
Tempo - Grafana - CNCF
https://github.com/grafana/tempo
Grafana Tempo is an open source, easy-to-use and high-scale distributed tracing backend.
- trace
- TraceQL (受LogQL和PromQL的启发…)
一些概念
PromQL
允许用户实时选择和汇聚时间序列数据。表达式的结果可以在浏览器中显示为图形,也可以显示为表格数据,或者由外部系统通过 HTTP API 调用。
在 Prometheus 的表达式语言中,表达式或子表达式包括以下四种类型之一:
- 瞬时向量(Instant vector) - 一组时间序列,每个时间序列包含单个样本,它们共享相同的时间戳。也就是说,表达式的返回值中只会包含该时间序列中的最新的一个样本值。而相应的这样的表达式称之为瞬时向量表达式。
- 区间向量(Range vector) - 一组时间序列,每个时间序列包含一段时间范围内的样本数据。
- 标量(Scalar) - 一个浮点型的数据值。
- 字符串(String) - 一个简单的字符串值。
其他说明
Metric:指标
Label:标签
Time Series:时间序列
标量(scalar): 普通值,如1,2,3
向量(vector):一组时间序列数据,每个时间序列数据都有一个指标名称和一组键值对label
1
2
3
4指标名称{label}
http_requests_total{method="GET", handler="/api/comments"} 100
http_requests_total{method="POST", handler="/api/comments"} 200
http_requests_total{method="GET", handler="/api/posts"} 300Function:接受一个或多个参数,并返回一个标量或向量
Range vector selector:选择一个时间范围内的所有时间序列
Instant vector selector:选择一个时间点上的所有时间序列
怎么查日志?
诞生之旅:PromQL >> LogQL >> TraceQL
PromQL文档:https://prometheus.fuckcloudnative.io/di-san-zhang-prometheus/di-4-jie-cha-xun/basics