1
0
mirror of https://github.com/go-kratos/kratos.git synced 2025-01-28 03:57:02 +02:00
kratos/pkg/database/tidb/metrics.go

38 lines
1.1 KiB
Go
Raw Normal View History

2019-07-20 19:38:44 +08:00
package tidb
2020-03-28 18:02:25 +08:00
import "github.com/go-kratos/kratos/pkg/stat/metric"
2019-07-20 19:38:44 +08:00
const namespace = "tidb_client"
var (
_metricReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
Namespace: namespace,
Subsystem: "requests",
Name: "duration_ms",
Help: "tidb client requests duration(ms).",
Labels: []string{"name", "addr", "command"},
Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000, 2500},
})
_metricReqErr = metric.NewCounterVec(&metric.CounterVecOpts{
Namespace: namespace,
Subsystem: "requests",
Name: "error_total",
Help: "tidb client requests error count.",
Labels: []string{"name", "addr", "command", "error"},
})
_metricConnTotal = metric.NewCounterVec(&metric.CounterVecOpts{
Namespace: namespace,
Subsystem: "connections",
Name: "total",
Help: "tidb client connections total count.",
Labels: []string{"name", "addr", "state"},
})
_metricConnCurrent = metric.NewGaugeVec(&metric.GaugeVecOpts{
Namespace: namespace,
Subsystem: "connections",
Name: "current",
Help: "tidb client connections current.",
Labels: []string{"name", "addr", "state"},
})
)