Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Export ¶
func Export(metrics *Metrics) gin.HandlerFunc
Export gin的中间件 namespace 代表接口统计所属的命名空间,中间件可以统计不同的接口或者端口 registry 代表 prometheus的 registry
Types ¶
type Metrics ¶
type Metrics struct { TotalRequest int64 Uptime int64 // TODO duration QPS int64 // 当前qps ReceivedBytes int64 // 总接受字节数(少小于时实际) SentBytes int64 // 总发送字节数 CurrentReceivedBytes int64 // 当前接受字节数 CurrentSentBytes int64 // 当前发送字节数 // 当前请求总数 PromTotalRequest *prometheus.CounterVec PromUptime prometheus.Counter PromQPS prometheus.Gauge PromDuration *prometheus.HistogramVec PromReceivedBytes *prometheus.CounterVec PromSentBytes *prometheus.CounterVec }
func NewMetrics ¶
func NewMetrics(namespace string, registry *prometheus.Registry) *Metrics
Click to show internal directories.
Click to hide internal directories.