prometheus

package
v0.0.0-...-f664ad0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsPlugin

type MetricsPlugin struct {
	Namespace  string
	Subsystem  string
	InstanceID string
	// contains filtered or unexported fields
}

func NewMetricsPlugin

func NewMetricsPlugin(namespace, subsystem, instanceID string) *MetricsPlugin

func (*MetricsPlugin) AddCustomGauge

func (m *MetricsPlugin) AddCustomGauge(name, help string, constLabels map[string]string) prometheus.Gauge

AddCustomGauge 添加一个自定义的 Gauge 类型的指标

func (*MetricsPlugin) AddCustomSummaryVec

func (m *MetricsPlugin) AddCustomSummaryVec(name, help string, labels []string, objectives map[float64]float64, constLabels map[string]string) *prometheus.SummaryVec

AddCustomSummaryVec 添加一个自定义的 SummaryVec 类型的指标

func (*MetricsPlugin) Apply

func (m *MetricsPlugin) Apply(router *gin.Engine)

Apply 将所有的 Prometheus 中间件应用到 Gin 路由

func (*MetricsPlugin) RegisterMetrics

func (m *MetricsPlugin) RegisterMetrics()

RegisterMetrics 注册所有 Prometheus 指标 包括响应时间SummaryVec和活跃请求数Gauge

func (*MetricsPlugin) TrackActiveRequestsMiddleware

func (m *MetricsPlugin) TrackActiveRequestsMiddleware() gin.HandlerFunc

TrackActiveRequestsMiddleware 返回一个 Gin 中间件,用于跟踪活跃 HTTP 请求数

func (*MetricsPlugin) TrackResponseTimeMiddleware

func (m *MetricsPlugin) TrackResponseTimeMiddleware() gin.HandlerFunc

TrackResponseTimeMiddleware 返回一个 Gin 中间件,用于跟踪 HTTP 请求的响应时间

Jump to

Keyboard shortcuts

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