OpenMetrics 是云原生计算基金会(CNCF)项目,旨在标准化云原生应用程序中暴露指标的过程。OpenMetrics 的规范是公开的,可以在github上阅读。本文简要介绍与数据模型相关的规范,有助于你学习Prometheus及相关的监控系统。
Prometheus Exposition Format
OpenMetrics规范基于Prometheus Exposition Format的。它是一种简单的、基于文本的、人类可读的数据格式,在社区中被广泛采用。围绕Prometheus暴露指标数据格式有数百种集成,甚至一些其他监控工具也已经直接使用它。然而,在名称中加入“Prometheus”
使其难以获得竞争对手或其他相关方的支持。OpenMetrics希望通过基于厂商中立和开放数据格式原则来改变现状,这看起来像是策略性的公关行动,但它已经得到了一些大型组织的支持。所以看起来它有一个美好的未来。
数据模型
OpenMetrics中展示的度量数据大致如下:、
# TYPE acme_http_router_request_seconds summary
# UNIT acme_http_router_request_seconds seconds
# HELP acme_http_router_request_seconds Latency though all of ACME's HTTP request router.
acme_http_router_request_seconds_sum{
path="/api/v1",method="GET"} 9036.32
acme_http_router_request_seconds_count{
path="/api/v1",method="GET"} 807283.0
acme_http_router_request_seconds_created{
path="/api/v1",method="GET"} 1605281325.0
acme_http_router_request_seconds_sum{
path="/api/v2",method