Golang 应用集成 Prometheus 统计数据支持
", Help: "web request duration distribution", Buckets: []float64{0.1, 0.3, 0.5, 0.7, 0.9, 1}, }, []string{"method", "endpoint"}, ) func init() { // 注册监控指标 prometheus.MustRegister(WebRequestTotal) prometheus.MustRegister(WebRequestDuration) } 在适当切入点对指标进行记录变更 // 包装 handler function,不侵入业务逻辑 func Monitor(h http.HandlerFunc) http.HandlerFunc { return func(w...阅读全文