18 lines
399 B
Go
18 lines
399 B
Go
package metrics
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
|
|
)
|
|
|
|
// TracingHandler
|
|
func TracingHandler(operation string) func(next http.Handler) http.Handler {
|
|
return func(next http.Handler) http.Handler {
|
|
fn := func(w http.ResponseWriter, r *http.Request) {
|
|
next.ServeHTTP(w, r)
|
|
}
|
|
return otelhttp.NewHandler(http.HandlerFunc(fn), operation)
|
|
}
|
|
}
|