fleet/server/service/metrics.go
Tomas Touceda 545b3f396e
Issue 1362 fleetctl user roles (#1397)
* WIP

* Add get user_roles and apply for a user_roles spec to fleetctl

* Uncomment other tests

* Update test to check output

* Update test with the new struct

* Mock token so that it doesn't pick up the one in the local machine

* Address review comments

* Fix printJSON and printYaml

* Fix merge conflict error

* If both roles are specified, fail

* Fix test

* Switch arguments around

* Update test with the new rule

* Fix other tests that fell through the cracks
2021-07-16 15:28:13 -03:00

27 lines
575 B
Go

package service
import (
"github.com/fleetdm/fleet/v4/server/fleet"
"github.com/go-kit/kit/metrics"
)
type metricsMiddleware struct {
fleet.Service
requestCount metrics.Counter
requestLatency metrics.Histogram
}
// NewMetricsService service takes an existing service and wraps it
// with instrumentation middleware.
func NewMetricsService(
svc fleet.Service,
requestCount metrics.Counter,
requestLatency metrics.Histogram,
) fleet.Service {
return metricsMiddleware{
Service: svc,
requestCount: requestCount,
requestLatency: requestLatency,
}
}