Prometheus Metrics 标准格式是一种文本格式,用于将指标数据暴露给 Prometheus 监控系统。该格式使用键值对的方式来描述指标数据,其中键表示指标名称和相关标签,值表示指标的当前值。
以下是一个示例 Prometheus Metrics 数据:
http_requests_total{method="GET", handler="/api/v1/users"} 1234
http_requests_total{method="POST", handler="/api/v1/users"} 5678
在这个示例中,http_requests_total 是指标名称,method 和 handler 是两个关联的标签。每个记录都有一个与其关联的当前值(例如,在此示例中,“GET”方法下“/api/v1/users”处理程序的请求数为 1234)。
Prometheus Metrics 标准格式还支持注释和带单位的数值。以下是带注释和单位的示例:
# HELP http_requests_total The total number of HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="GET", handler="/api/v1/users"} 1234
在这个示例中,第一行包含了有关 http_requests_total 指标的注释信息。第二行定义了此计数器(counter)类型的指标应如何解释。




