gitlab.com/gitlab-org/labkit@v1.21.0/tracing/outbound_http_options.go (about) 1 package tracing 2 3 import ( 4 "fmt" 5 "net/http" 6 ) 7 8 // The configuration for InjectCorrelationID. 9 type roundTripperConfig struct { 10 getOperationName OperationNamer 11 } 12 13 // RoundTripperOption will configure a correlation handler. 14 type RoundTripperOption func(*roundTripperConfig) 15 16 func applyRoundTripperOptions(opts []RoundTripperOption) roundTripperConfig { 17 config := roundTripperConfig{ 18 getOperationName: func(req *http.Request) string { 19 // By default use `GET https://localhost` for operation names 20 return fmt.Sprintf("%s %s://%s", req.Method, req.URL.Scheme, req.URL.Host) 21 }, 22 } 23 for _, v := range opts { 24 v(&config) 25 } 26 27 return config 28 }