ginprom

package module
v0.0.0-...-ea0e0e8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

README

gin-prom

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL