mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-10 00:29:01 +02:00
42 lines
1.3 KiB
Go
42 lines
1.3 KiB
Go
package warden
|
|
|
|
import "github.com/bilibili/kratos/pkg/stat/metric"
|
|
|
|
const (
|
|
clientNamespace = "grpc_client"
|
|
serverNamespace = "grpc_server"
|
|
)
|
|
|
|
var (
|
|
_metricServerReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
|
|
Namespace: serverNamespace,
|
|
Subsystem: "requests",
|
|
Name: "duration_ms",
|
|
Help: "grpc server requests duration(ms).",
|
|
Labels: []string{"method", "caller"},
|
|
Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000},
|
|
})
|
|
_metricServerReqCodeTotal = metric.NewCounterVec(&metric.CounterVecOpts{
|
|
Namespace: serverNamespace,
|
|
Subsystem: "requests",
|
|
Name: "code_total",
|
|
Help: "grpc server requests code count.",
|
|
Labels: []string{"method", "caller", "code"},
|
|
})
|
|
_metricClientReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
|
|
Namespace: clientNamespace,
|
|
Subsystem: "requests",
|
|
Name: "duration_ms",
|
|
Help: "grpc client requests duration(ms).",
|
|
Labels: []string{"method"},
|
|
Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000},
|
|
})
|
|
_metricClientReqCodeTotal = metric.NewCounterVec(&metric.CounterVecOpts{
|
|
Namespace: clientNamespace,
|
|
Subsystem: "requests",
|
|
Name: "code_total",
|
|
Help: "grpc client requests code count.",
|
|
Labels: []string{"method", "code"},
|
|
})
|
|
)
|