pkg/tracing/tracing.go

18 lines
399 B
Go

package tracing
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)
}
}