Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CpuTemp = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "cpu_temperature_celsius",
Help: "Current temperature of the CPU",
})
CpuTemp cpu情况
View Source
var HdFailures = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "hd_errors_total", Help: "Number of hard-disk errors", }, []string{"device"}, )
View Source
var WebRequestDuration = prometheus.NewHistogramVec( prometheus.HistogramOpts{ Name: "web_request_duration_seconds", Help: "web request duration distribution", Buckets: []float64{0.1, 0.3, 0.5, 0.7, 0.9, 1}, }, []string{"method", "endpoint"}, )
WebRequestDuration web_request_duration_seconds, Histogram类型指标,bucket代表duration的分布区间
View Source
var WebRequestTotal = prometheus.NewCounterVec( prometheus.CounterOpts{ Name: "web_request_total", Help: "Number of hello requests in total", }, []string{"method", "endpoint"}, )
WebRequestTotal 初始化 web_request_total, counter类型指标, 表示接收http请求总次数 设置两个标签 请求方法和 路径 对请求总次数在两个
Functions ¶
func MonitorHandler ¶
MonitorHandler 性能监控处理器 可以作为中间件对接口进行打点监控
func MonitorHandlerFunc ¶
func MonitorHandlerFunc(h http.HandlerFunc) http.HandlerFunc
MonitorHandlerFunc 对于http原始的处理器函数,包装 handler function,不侵入业务逻辑 可以对单个接口做metrics监控
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.