metrics

package
v0.25.3 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metrics

type Metrics struct {
	ModuleName   string    `mapstructure:"module-name" yaml:"module-name" json:"moduleName"`       // 模块名称
	Enabled      bool      `mapstructure:"enabled" yaml:"enabled" json:"enabled"`                  // 是否启用指标
	Path         string    `mapstructure:"path" yaml:"path" json:"path"`                           // 指标路径
	Namespace    string    `mapstructure:"namespace" yaml:"namespace" json:"namespace"`            // 命名空间
	Subsystem    string    `mapstructure:"subsystem" yaml:"subsystem" json:"subsystem"`            // 子系统名称
	SkipPaths    []string  `mapstructure:"skip-paths" yaml:"skip-paths" json:"skipPaths"`          // 跳过的路径
	Buckets      []float64 `mapstructure:"buckets" yaml:"buckets" json:"buckets"`                  // 直方图桶
	RequestCount bool      `mapstructure:"request-count" yaml:"request-count" json:"requestCount"` // 请求计数
	Duration     bool      `mapstructure:"duration" yaml:"duration" json:"duration"`               // 请求时长
	RequestSize  bool      `mapstructure:"request-size" yaml:"request-size" json:"requestSize"`    // 请求大小
	ResponseSize bool      `mapstructure:"response-size" yaml:"response-size" json:"responseSize"` // 响应大小
}

Metrics 指标中间件配置

func Default

func Default() *Metrics

Default 创建默认指标配置

func (*Metrics) Clone

func (m *Metrics) Clone() internal.Configurable

Clone 返回配置的副本

func (*Metrics) Disable

func (m *Metrics) Disable() *Metrics

Disable 禁用指标中间件

func (*Metrics) Enable

func (m *Metrics) Enable() *Metrics

Enable 启用指标中间件

func (*Metrics) Get

func (m *Metrics) Get() interface{}

Get 返回配置接口

func (*Metrics) IsEnabled

func (m *Metrics) IsEnabled() bool

IsEnabled 检查是否启用

func (*Metrics) Set

func (m *Metrics) Set(data interface{})

Set 设置配置数据

func (*Metrics) Validate

func (m *Metrics) Validate() error

Validate 验证配置

func (*Metrics) WithBuckets

func (m *Metrics) WithBuckets(buckets []float64) *Metrics

WithBuckets 设置直方图桶

func (*Metrics) WithNamespace

func (m *Metrics) WithNamespace(namespace string) *Metrics

WithNamespace 设置命名空间

func (*Metrics) WithPath

func (m *Metrics) WithPath(path string) *Metrics

WithPath 设置指标路径

func (*Metrics) WithSkipPaths

func (m *Metrics) WithSkipPaths(skipPaths []string) *Metrics

WithSkipPaths 设置跳过的路径

func (*Metrics) WithSubsystem

func (m *Metrics) WithSubsystem(subsystem string) *Metrics

WithSubsystem 设置子系统名称

Jump to

Keyboard shortcuts

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