2016-09-28 11:35:15 +00:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/go-kit/kit/metrics"
|
2017-02-01 17:20:50 +00:00
|
|
|
"github.com/kolide/kolide/server/kolide"
|
2016-09-28 11:35:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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,
|
|
|
|
}
|
|
|
|
}
|