mirror of
https://github.com/go-kratos/kratos.git
synced 2025-01-22 03:38:41 +02:00
add metrics options
This commit is contained in:
parent
6907a9ee61
commit
1de3a6607f
@ -16,6 +16,20 @@ import (
|
|||||||
// Option is metrics option.
|
// Option is metrics option.
|
||||||
type Option func(*options)
|
type Option func(*options)
|
||||||
|
|
||||||
|
// WithRequests with requests counter.
|
||||||
|
func WithRequests(c metrics.Counter) Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.requests = c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// WithSeconds with seconds histogram.
|
||||||
|
func WithSeconds(c metrics.Observer) Option {
|
||||||
|
return func(o *options) {
|
||||||
|
o.seconds = c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type options struct {
|
type options struct {
|
||||||
// counter: <kind>_<client/server>_requests_code_total{method, path, code}
|
// counter: <kind>_<client/server>_requests_code_total{method, path, code}
|
||||||
requests metrics.Counter
|
requests metrics.Counter
|
||||||
|
Loading…
x
Reference in New Issue
Block a user