mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
Add X-Amz-Request-Id to internode calls (#16146)
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/minio/minio/internal/logger"
|
||||
"github.com/minio/minio/internal/mcontext"
|
||||
iampolicy "github.com/minio/pkg/iam/policy"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/common/expfmt"
|
||||
@@ -569,10 +570,10 @@ func metricsHandler() http.Handler {
|
||||
}
|
||||
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
tc, ok := r.Context().Value(contextTraceReqKey).(*traceCtxt)
|
||||
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
||||
if ok {
|
||||
tc.funcName = "handler.MetricsLegacy"
|
||||
tc.responseRecorder.LogErrBody = true
|
||||
tc.FuncName = "handler.MetricsLegacy"
|
||||
tc.ResponseRecorder.LogErrBody = true
|
||||
}
|
||||
|
||||
mfs, err := gatherers.Gather()
|
||||
@@ -602,13 +603,13 @@ func metricsHandler() http.Handler {
|
||||
// AuthMiddleware checks if the bearer token is valid and authorized.
|
||||
func AuthMiddleware(h http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
tc, ok := r.Context().Value(contextTraceReqKey).(*traceCtxt)
|
||||
tc, ok := r.Context().Value(mcontext.ContextTraceKey).(*mcontext.TraceCtxt)
|
||||
|
||||
claims, groups, owner, authErr := metricsRequestAuthenticate(r)
|
||||
if authErr != nil || !claims.VerifyIssuer("prometheus", true) {
|
||||
if ok {
|
||||
tc.funcName = "handler.MetricsAuth"
|
||||
tc.responseRecorder.LogErrBody = true
|
||||
tc.FuncName = "handler.MetricsAuth"
|
||||
tc.ResponseRecorder.LogErrBody = true
|
||||
}
|
||||
|
||||
writeErrorResponseJSON(r.Context(), w, toAdminAPIErr(r.Context(), errAuthentication), r.URL)
|
||||
@@ -624,8 +625,8 @@ func AuthMiddleware(h http.Handler) http.Handler {
|
||||
Claims: claims.Map(),
|
||||
}) {
|
||||
if ok {
|
||||
tc.funcName = "handler.MetricsAuth"
|
||||
tc.responseRecorder.LogErrBody = true
|
||||
tc.FuncName = "handler.MetricsAuth"
|
||||
tc.ResponseRecorder.LogErrBody = true
|
||||
}
|
||||
|
||||
writeErrorResponseJSON(r.Context(), w, toAdminAPIErr(r.Context(), errAuthentication), r.URL)
|
||||
|
||||
Reference in New Issue
Block a user