github.com/anuvu/tyk@v2.9.0-beta9-dl-apic+incompatible/trace/handler.go (about)

     1  package trace
     2  
     3  import "net/http"
     4  
     5  // Handle returns a http.Handler with root opentracting setup. This should be
     6  // the topmost handler.
     7  func Handle(service string, h http.Handler) http.Handler {
     8  	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
     9  		span, req := Root(service, r)
    10  		defer span.Finish()
    11  		h.ServeHTTP(w, req)
    12  	})
    13  }