prometheus/client_model

GitHub: prometheus/client_model

提供 Prometheus 指标数据模型 protobuf 定义的仓库,现已弃用并迁移至 Prometheus 主仓库与 Buf registry。

Stars: 79 | Forks: 76

# 弃用说明 此代码库过去包含定义 Prometheus 指标数据模型和[展示格式](https://prometheus.io/docs/instrumenting/exposition_formats/#prometheus-protobuf-format)的 [protocol buffer](https://developers.google.com/protocol-buffers) 代码。最初创建 `client_model` 是因为当时缺乏健壮的 protobuf 导入工具。此后,相关工具得到了改进(参见 [Buf](https://buf.build/))。 在 v2 版本之前,生成的 Go 代码仍用于 [`client_golang` 公开且稳定的 API](https://github.com/prometheus/client_golang/blob/74560058a7af7a695db8196c8e84a0754032c6af/prometheus/metric.go#L54) 中。 [展示格式](https://prometheus.io/docs/instrumenting/exposition_formats/#prometheus-protobuf-format) 的唯一事实来源已迁移至 [prometheus/prometheus](https://github.com/prometheus/prometheus/tree/main/prompb/io/prometheus/client),并且也可以在 [Buf registry](https://buf.build/prometheus/prometheus/docs/main%3Aio.prometheus.client) 中获取。 ## 历史 从 v2.0.0 开始,[Prometheus 服务端](https://github.com/prometheus/prometheus) 停止接收基于 protobuf 的展示格式。然而,在 v3.0.0 中,这一限制被取消,并且像原生直方图这样的新功能首先在 protobuf 格式中被引入。目前,[PrometheusProto 展示格式](https://prometheus.io/docs/instrumenting/exposition_formats/#prometheus-protobuf-format) 是一个官方支持的协议,允许社区试验新功能。 ## 推荐用法与 Buf 工具 之前存在于此代码库中对 Go 以外语言(即 C++、Java、Python 和 Ruby)的支持已被移除。 对于其他语言(如 Rust、C++、Java、Python 和 Ruby)的新使用者和 SDK,**我们不建议手动复制 proto 文件或依赖 `client_model`**。相反,现代首选方案是使用 [Buf 工具](https://buf.build/),在 SDK 端通过特定的语言选项直接生成绑定,从而保持清晰的依赖链。 集中式的 Prometheus protobuf 定义可在 Buf registry 中获取,直接来源于 Prometheus 主代码库: [buf.build/prometheus/prometheus (io.prometheus.client)](https://buf.build/prometheus/prometheus/docs/main:io.prometheus.client)
标签:Go, Protocol Buffers, Ruby工具, 数据模型, 日志审计, 监控