Back to godoc.org

Package metric

v0.1.0
Latest Go to latest

The latest major version is .

Published: Oct 9, 2020 | License: Apache-2.0 | Module: github.com/UnderTreeTech/waterdrop

Index

Variables

var (
	HTTPServerReqDuration = NewHistogramVec(&HistogramVecOpts{
		Namespace: _httpServerNamespace,
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "http server requests duration(ms).",
		Labels:    []string{"path", "method", "peer"},
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	})

	HTTPServerHandleCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _httpServerNamespace,
		Subsystem: "requests",
		Name:      "code_total",
		Help:      "http server requests error count.",
		Labels:    []string{"path", "method", "peer", "code"},
	})
)

http metrics

var (
	UnaryServerReqDuration = NewHistogramVec(&HistogramVecOpts{
		Namespace: _unaryServerNamespace,
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "unary server requests duration(ms).",
		Labels:    []string{"peer", "method"},
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	})

	UnaryServerHandleCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _unaryServerNamespace,
		Subsystem: "requests",
		Name:      "code_total",
		Help:      "unary server requests error count.",
		Labels:    []string{"peer", "method", "code"},
	})
)

unary metrics

var (
	RedisClientReqDuration = NewHistogramVec(&HistogramVecOpts{
		Namespace: _redisClientNamespace,
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "redis client requests duration(ms).",
		Labels:    []string{"name", "peer", "command"},
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	})

	RedisClientErrCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _redisClientNamespace,
		Subsystem: "requests",
		Name:      "error_total",
		Help:      "redis client requests error count.",
		Labels:    []string{"name", "peer", "command", "error"},
	})

	RedisHitCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _redisClientNamespace,
		Subsystem: "requests",
		Name:      "hits_total",
		Help:      "redis client hits total.",
		Labels:    []string{"name", "peer", "command"},
	})

	RedisMissCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _redisClientNamespace,
		Subsystem: "requests",
		Name:      "misses_total",
		Help:      "redis client misses total.",
		Labels:    []string{"name", "peer", "command"},
	})
)

redis metrics

var (
	RocketMQClientHandleCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _rocketmqClientNamespace,
		Subsystem: "requests",
		Name:      "code_total",
		Help:      "rocketmq client requests code count.",
		Labels:    []string{"peer", "type", "name", "command", "code"},
	})

	RocketMQClientReqDuration = NewHistogramVec(&HistogramVecOpts{
		Namespace: _rocketmqClientNamespace,
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "rocketmq client requests duration(ms).",
		Labels:    []string{"peer", "type", "name", "command"},
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	})
)

rocketmq metrics

var (
	KafkaClientHandleCounter = NewCounterVec(&CounterVecOpts{
		Namespace: _kafkaClientNamespace,
		Subsystem: "requests",
		Name:      "code_total",
		Help:      "kafka client requests code count.",
		Labels:    []string{"peer", "type", "name", "command", "code"},
	})

	KafkaClientReqDuration = NewHistogramVec(&HistogramVecOpts{
		Namespace: _kafkaClientNamespace,
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "kafka client requests duration(ms).",
		Labels:    []string{"peer", "type", "name", "command"},
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	})
)

kafka metrics

var (
	MySQLClientReqDuration = NewHistogramVec(&HistogramVecOpts{
		Namespace: _mysqlClientNamespace,
		Subsystem: "requests",
		Name:      "duration_ms",
		Help:      "mysql client requests duration(ms).",
		Labels:    []string{"name", "addr", "command"},
		Buckets:   []float64{5, 10, 25, 50, 100, 250, 500, 1000},
	})
)

mysql metrics

func NewCounterVec

func NewCounterVec(opt *CounterVecOpts) *counterVec

func NewGaugeVec

func NewGaugeVec(opt *GaugeVecOpts) *gaugeVec

func NewHistogramVec

func NewHistogramVec(opt *HistogramVecOpts) *histogramVec

func RegisterMetric

func RegisterMetric(engine *gin.Engine)

type CounterVecOpts

type CounterVecOpts struct {
	Namespace string
	Subsystem string
	Name      string
	Help      string
	Labels    []string
}

type GaugeVecOpts

type GaugeVecOpts struct {
	Namespace string
	Subsystem string
	Name      string
	Help      string
	Labels    []string
}

type HistogramVecOpts

type HistogramVecOpts struct {
	Namespace string
	Subsystem string
	Name      string
	Help      string
	Labels    []string
	Buckets   []float64
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier