探索Prometheus Go客户端指标
原文是 Exploring Prometheus Go client metrics,有删改。
在这篇文章中,我将探索下Prometheus Go 客户端指标,这些指标由client_go通过promhttp.Handler()暴露出来的。通过这些指标能帮助你更好的理解 Go 是如何工作的。
想对Prometheus了解更多吗?你可以去学习下Monitoring Systems and Services with Prometheus,这是一门很棒的课程,可以让你快速上手。
让我们从一个简单的程序开始,它注册prom handler并且监听8080端口:
package main
import (
"log"
"net/http"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(":8080", nil))
}

