prometheus/client_golang
GitHub: prometheus/client_golang
Prometheus 官方 Go 客户端库,提供应用指标埋点和 HTTP API 通信能力,是 Go 服务接入 Prometheus 监控体系的标准方案。
Stars: 5980 | Forks: 1280
# Prometheus Go 客户端库
[](https://github.com/prometheus/client_golang/actions/workflows/ci.yml)
[](https://goreportcard.com/report/github.com/prometheus/client_golang)
[](https://pkg.go.dev/github.com/prometheus/client_golang)
[](https://securityscorecards.dev/viewer/?uri=github.com/prometheus/client_golang)
[](https://slack.cncf.io/)
这是 [Prometheus](http://prometheus.io) 的 [Go](http://golang.org) 客户端库。它包含两个独立的部分:一部分用于埋点应用程序代码,另一部分用于创建与 Prometheus HTTP API 通信的客户端。
## 版本兼容性
本库支持 Go 的两个最新主要版本。虽然它可能可以在旧版本上运行,但我们仅对当前受支持的 Go 版本提供修复和支持。
## 关于发布和稳定性的重要说明
本仓库通常遵循[语义化版本控制](https://semver.org/)。但是,`prometheus/client_golang/api/…` 中的 API 客户端仍被视为实验性质。API 客户端的破坏性变更 _不会_ 触发新的主要版本。对于 CHANGELOG.md 中明确标记为 **EXPERIMENTAL** 的其他选定新功能也是如此。
需要对仓库稳定部分进行破坏性变更的功能正在被集中处理,并在 [v2 里程碑](https://github.com/prometheus/client_golang/milestone/2)中进行跟踪,但目前有进一步开发 v2 的计划。
## 埋点应用程序
[](https://pkg.go.dev/github.com/prometheus/client_golang/prometheus)
[`prometheus` 目录](https://github.com/prometheus/client_golang/tree/main/prometheus)包含了埋点库。请参阅 Prometheus 网站上的[指南](https://prometheus.io/docs/guides/go-application/)以了解更多关于应用程序埋点的信息。
[`examples` 目录](https://github.com/prometheus/client_golang/tree/main/examples)包含了埋点代码的简单示例。
## Prometheus HTTP API 客户端
[](https://pkg.go.dev/github.com/prometheus/client_golang/api)
[`api/prometheus` 目录](https://github.com/prometheus/client_golang/tree/main/api/prometheus)包含了 [Prometheus HTTP API](http://prometheus.io/docs/querying/api/) 的客户端。它允许您编写 Go 应用程序,从 Prometheus 服务器查询时间序列数据。它目前仍处于 alpha 阶段。
## `model`、`extraction` 和 `text` 在哪里?
`model` 包已移至 [`prometheus/common/model`](https://github.com/prometheus/common/tree/main/model)。
`extraction` 和 `text` 包现在包含在 [`prometheus/common/expfmt`](https://github.com/prometheus/common/tree/main/expfmt) 中。
## 贡献与社区
请参阅[贡献指南](CONTRIBUTING.md)以及主页的[社区部分](http://prometheus.io/community/)。
`client_golang` 社区也活跃在 CNCF Slack 的 `#prometheus-client_golang` 频道中。
标签:API集成, Go, Golang, HTTP API, Ruby工具, SOC Prime, 仪表化, 可观测性, 埋点, 多引擎聚合, 安全编程, 客户端库, 应用监控, 开发工具, 开源库, 指标采集, 搜索引擎爬虫, 日志审计, 时序数据, 监控系统, 自定义请求头