chore: update goctl version to 1.6.0 (#3674)

This commit is contained in:
Kevin Wan
2023-10-27 21:59:35 +08:00
committed by GitHub
parent f8adc71529
commit 9394e59597
4 changed files with 32 additions and 29 deletions

View File

@@ -31,26 +31,24 @@ var (
})
)
type (
MetricsURLRewriter func(u url.URL) string
)
type MetricsURLRewriter func(u url.URL) string
func MetricsInterceptor(name string, pr MetricsURLRewriter) Interceptor {
return func(r *http.Request) (*http.Request, ResponseHandler) {
startTime := timex.Now()
return r, func(resp *http.Response, err error) {
u := cleanURL(*r.URL)
method := r.Method
var (
code int
path string
)
var code int
var path string
// error or resp is nil, set code=500
if err != nil || resp == nil {
code = http.StatusInternalServerError
} else {
code = resp.StatusCode
}
u := cleanURL(*r.URL)
method := r.Method
if pr != nil {
path = pr(u)
} else {