fleet/server/service/metrics.go

27 lines
568 B
Go
Raw Normal View History

package service
import (
2021-06-26 04:46:51 +00:00
"github.com/fleetdm/fleet/v4/server/fleet"
"github.com/go-kit/kit/metrics"
)
type metricsMiddleware struct {
fleet.Service
requestCount metrics.Counter
requestLatency metrics.Histogram
}
// NewMetrics 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,
}
}