metrics

package
v0.0.0-...-da2935b Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NameSpaceMetrics = "gmu"
)

Functions

func GetPromethuesAsFmtText

func GetPromethuesAsFmtText() (string, error)

返回promethues指标

Types

type CounterVec

type CounterVec struct {
	// contains filtered or unexported fields
}

func NewCounterVec

func NewCounterVec(namespace, metricsName, help string, labels []string) *CounterVec

func (*CounterVec) Inc

func (self *CounterVec) Inc(labels ...string)

type GaugeVec

type GaugeVec struct {
	// contains filtered or unexported fields
}

func NewGaugeVec

func NewGaugeVec(namespace, metricsName, help string, labels []string) *GaugeVec

func (*GaugeVec) Dec

func (self *GaugeVec) Dec(labels ...string)

func (*GaugeVec) Inc

func (self *GaugeVec) Inc(labels ...string)

func (*GaugeVec) Set

func (self *GaugeVec) Set(v float64, labels ...string)

type Timer

type Timer struct {
	// contains filtered or unexported fields
}

func NewTimer

func NewTimer(namespace, metricName, help string, labels []string, opts ...TimerOption) *Timer

NewTimer

func (*Timer) Observe

func (t *Timer) Observe(duration time.Duration, label ...string)

Observe :传入duration和labels,

func (*Timer) Timer

func (t *Timer) Timer() func(values ...string)

Timer 返回一个函数,并且开始计时,结束计时则调用返回的函数 请参考timer_test.go 的demo

type TimerOption

type TimerOption func(*timerOptions)

func WithTimerBuckets

func WithTimerBuckets(buk []float64) TimerOption

func WithTimerConstLabels

func WithTimerConstLabels(lables map[string]string) TimerOption

Jump to

Keyboard shortcuts

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