mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
27 lines
568 B
Go
27 lines
568 B
Go
package service
|
|
|
|
import (
|
|
"github.com/go-kit/kit/metrics"
|
|
"github.com/kolide/fleet/server/kolide"
|
|
)
|
|
|
|
type metricsMiddleware struct {
|
|
kolide.Service
|
|
requestCount metrics.Counter
|
|
requestLatency metrics.Histogram
|
|
}
|
|
|
|
// NewMetrics service takes an existing service and wraps it
|
|
// with instrumentation middleware.
|
|
func NewMetricsService(
|
|
svc kolide.Service,
|
|
requestCount metrics.Counter,
|
|
requestLatency metrics.Histogram,
|
|
) kolide.Service {
|
|
return metricsMiddleware{
|
|
Service: svc,
|
|
requestCount: requestCount,
|
|
requestLatency: requestLatency,
|
|
}
|
|
}
|