You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
5 years ago
|
package sql
|
||
|
|
||
|
import "github.com/bilibili/kratos/pkg/stat/metric"
|
||
|
|
||
|
const namespace = "mysql_client"
|
||
|
|
||
|
var (
|
||
|
_metricReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
|
||
|
Namespace: namespace,
|
||
|
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, 2500},
|
||
|
})
|
||
|
_metricReqErr = metric.NewCounterVec(&metric.CounterVecOpts{
|
||
|
Namespace: namespace,
|
||
|
Subsystem: "requests",
|
||
|
Name: "error_total",
|
||
|
Help: "mysql client requests error count.",
|
||
|
Labels: []string{"name", "addr", "command", "error"},
|
||
|
})
|
||
|
_metricConnTotal = metric.NewCounterVec(&metric.CounterVecOpts{
|
||
|
Namespace: namespace,
|
||
|
Subsystem: "connections",
|
||
|
Name: "total",
|
||
|
Help: "mysql client connections total count.",
|
||
|
Labels: []string{"name", "addr", "state"},
|
||
|
})
|
||
|
_metricConnCurrent = metric.NewGaugeVec(&metric.GaugeVecOpts{
|
||
|
Namespace: namespace,
|
||
|
Subsystem: "connections",
|
||
|
Name: "current",
|
||
|
Help: "mysql client connections current.",
|
||
|
Labels: []string{"name", "addr", "state"},
|
||
|
})
|
||
|
)
|