mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-08 04:20:59 -05:00
8e028f17e9
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
26 lines
509 B
Go
26 lines
509 B
Go
package svc
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/opencloud-eu/opencloud/services/idp/pkg/metrics"
|
|
)
|
|
|
|
// NewInstrument returns a service that instruments metrics.
|
|
func NewInstrument(next Service, metrics *metrics.Metrics) Service {
|
|
return instrument{
|
|
next: next,
|
|
metrics: metrics,
|
|
}
|
|
}
|
|
|
|
type instrument struct {
|
|
next Service
|
|
metrics *metrics.Metrics
|
|
}
|
|
|
|
// ServeHTTP implements the Service interface.
|
|
func (i instrument) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|
i.next.ServeHTTP(w, r)
|
|
}
|