diff --git a/middleware/metrics/metrics.go b/middleware/metrics/metrics.go index 46205df2e..c054ae978 100644 --- a/middleware/metrics/metrics.go +++ b/middleware/metrics/metrics.go @@ -16,6 +16,20 @@ import ( // Option is metrics option. 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 { // counter: __requests_code_total{method, path, code} requests metrics.Counter