metric

package
v0.0.0-...-a3cb3ec Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// 请求数统计
	ReqCount = NewRegisterCounter(
		prometheus.NewCounterVec(prometheus.CounterOpts{
			Namespace: namespace,
			Name:      "requests_total",
			Help:      "Total number of Requests.",
		}, []string{"env", "service", "protocol", "path", "method"}),
	)

	RespCount = NewRegisterCounter(
		prometheus.NewCounterVec(prometheus.CounterOpts{
			Namespace: namespace,
			Name:      "responses_total",
			Help:      "Total number of Responses.",
		}, labels),
	)

	// 响应时间分布统计
	RespDurationHistogram = NewRegisterHistogram(
		prometheus.NewHistogramVec(prometheus.HistogramOpts{
			Namespace: namespace,
			Name:      "responses_duration_histogram",
			Help:      "responses latencies in histogram seconds.",
		}, labels),
	)

	// 响应最大时间统计
	RespDurationGauge = NewRegisterGauge(
		prometheus.NewGaugeVec(prometheus.GaugeOpts{
			Namespace: namespace,
			Name:      "responses_duration_gauge",
			Help:      "responses latencies in gauge seconds",
		}, labels),
	)

	Count = NewRegisterCounter(
		prometheus.NewCounterVec(prometheus.CounterOpts{
			Namespace: namespace,
			Name:      "count_by_name_total",
			Help:      "Total number of Requests.",
		}, []string{"name"}),
	)
)

Functions

This section is empty.

Types

type Counter

type Counter interface {
	With(lvs ...string) Counter
	Inc()
	Add(delta float64)
}

func NewRegisterCounter

func NewRegisterCounter(cv *prometheus.CounterVec) Counter

Counter new a prometheus counter and returns Counter.

type Gauge

type Gauge interface {
	With(lvs ...string) Gauge
	Inc()
	Set(value float64)
	Add(delta float64)
	Sub(delta float64)
}

Gauge is metrics gauge.

func NewRegisterGauge

func NewRegisterGauge(gv *prometheus.GaugeVec) Gauge

NewGauge new a prometheus gauge and returns Gauge.

type Histogram

type Histogram interface {
	With(lvs ...string) Histogram
	Observe(float64)
}

Histogram is metrics histogram.

func NewRegisterHistogram

func NewRegisterHistogram(hv *prometheus.HistogramVec) Histogram

NewHistogram new a prometheus histogram and returns Histogram.

Jump to

Keyboard shortcuts

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