从零开始的时序化数据库
存储数据如下(y轴表示时间线,也就是一个个的监控指标;x轴表示时间)
metric
^
│ . . . . . . . . . . . . . . . . . . . node_cpu{cpu="cpu0",mode="idle"}
│ . . . . . . . . . . . . . . . . . . . node_cpu{cpu="cpu0",mode="system"}
│ . . . . . . . . . . . . . . . . . . node_load1{}
│ . . . . . . . . . . . . . . . . . .
v
<----------------------------------> time
- 基于某指标(metric)或者叫某时间线(time-series)搜索某段时间时间的样本(sample)
# 比如查询 某个metric 在 2021-08-29 17:34:44 到 2021-08-29 17:35:44 的数据 select ... where y = http_request_total{status="200", method="GET"} AND x in [1630229684, 1630229744]
- 基于
labels查询 - metricName (
__name__) 模糊查询
api_http_requests_total{method="POST", handler="/messages"} 等同于
{__name__="api_http_requests_total",method="POST", handler="/messages"}
type Metric LabelSet
type LabelSet map[LabelName]LabelValue
type LabelName string
type LabelValue string
- 建模
- 内存存储与查询
- 持久化
- 倒排序索引
- 数据压缩
- compaction
- 可用性
- wal 日志