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.
49 lines
1.5 KiB
49 lines
1.5 KiB
5 years ago
|
package blademaster
|
||
|
|
||
|
import "github.com/bilibili/kratos/pkg/stat/metric"
|
||
|
|
||
|
const (
|
||
|
clientNamespace = "http_client"
|
||
|
serverNamespace = "http_server"
|
||
|
)
|
||
|
|
||
|
var (
|
||
|
_metricServerReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
|
||
|
Namespace: serverNamespace,
|
||
|
Subsystem: "requests",
|
||
|
Name: "duration_ms",
|
||
|
Help: "http server requests duration(ms).",
|
||
|
Labels: []string{"path", "caller"},
|
||
|
Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000},
|
||
|
})
|
||
|
_metricServerReqCodeTotal = metric.NewCounterVec(&metric.CounterVecOpts{
|
||
|
Namespace: serverNamespace,
|
||
|
Subsystem: "requests",
|
||
|
Name: "code_total",
|
||
|
Help: "http server requests error count.",
|
||
|
Labels: []string{"path", "caller", "code"},
|
||
|
})
|
||
|
_metricServerBBR = metric.NewCounterVec(&metric.CounterVecOpts{
|
||
|
Namespace: serverNamespace,
|
||
|
Subsystem: "",
|
||
|
Name: "bbr_total",
|
||
|
Help: "http server bbr total.",
|
||
|
Labels: []string{"url"},
|
||
|
})
|
||
|
_metricClientReqDur = metric.NewHistogramVec(&metric.HistogramVecOpts{
|
||
|
Namespace: clientNamespace,
|
||
|
Subsystem: "requests",
|
||
|
Name: "duration_ms",
|
||
|
Help: "http client requests duration(ms).",
|
||
|
Labels: []string{"path"},
|
||
|
Buckets: []float64{5, 10, 25, 50, 100, 250, 500, 1000},
|
||
|
})
|
||
|
_metricClientReqCodeTotal = metric.NewCounterVec(&metric.CounterVecOpts{
|
||
|
Namespace: clientNamespace,
|
||
|
Subsystem: "requests",
|
||
|
Name: "code_total",
|
||
|
Help: "http client requests code count.",
|
||
|
Labels: []string{"path", "code"},
|
||
|
})
|
||
|
)
|