mirror of
				https://github.com/3ybactuk/marketplace-go-service-project.git
				synced 2025-10-31 22:43:45 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			18 lines
		
	
	
		
			357 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			357 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| package middlewares
 | |
| 
 | |
| import (
 | |
| 	"net/http"
 | |
| 
 | |
| 	"route256/cart/internal/infra/tracing"
 | |
| )
 | |
| 
 | |
| func NewTracingMiddleware(h http.Handler) http.Handler {
 | |
| 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 | |
| 		ctx, span := tracing.Tracer().Start(r.Context(),
 | |
| 			r.Method+" "+r.URL.Path)
 | |
| 		defer span.End()
 | |
| 
 | |
| 		h.ServeHTTP(w, r.WithContext(ctx))
 | |
| 	})
 | |
| }
 | 
