From b1ac3f0df00ccc99255ff81dc9f692e3acd2d215 Mon Sep 17 00:00:00 2001 From: smellthemoon <64083300+smellthemoon@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:39:15 +0800 Subject: [PATCH] enhance: do not log out the full req (#36546) ![img_v3_02f3_61ac166c-df6f-4b5e-b06a-756e5f40a65g](https://github.com/user-attachments/assets/df668339-d0d8-4295-a2b6-52d89ad98766) Signed-off-by: lixinguo Co-authored-by: lixinguo --- internal/distributed/proxy/httpserver/handler_v2.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/distributed/proxy/httpserver/handler_v2.go b/internal/distributed/proxy/httpserver/handler_v2.go index 80a9b7e482..58b075a727 100644 --- a/internal/distributed/proxy/httpserver/handler_v2.go +++ b/internal/distributed/proxy/httpserver/handler_v2.go @@ -152,7 +152,7 @@ func wrapperPost(newReq newReqFunc, v2 handlerFuncV2) gin.HandlerFunc { req := newReq() if err := c.ShouldBindBodyWith(req, binding.JSON); err != nil { log.Warn("high level restful api, read parameters from request body fail", zap.Error(err), - zap.Any("url", c.Request.URL.Path), zap.Any("request", req)) + zap.Any("url", c.Request.URL.Path)) if _, ok := err.(validator.ValidationErrors); ok { HTTPAbortReturn(c, http.StatusOK, gin.H{ HTTPReturnCode: merr.Code(merr.ErrMissingRequiredParameters), @@ -189,7 +189,7 @@ func wrapperPost(newReq newReqFunc, v2 handlerFuncV2) gin.HandlerFunc { ctx = log.WithTraceID(ctx, traceID) c.Keys["traceID"] = traceID log.Ctx(ctx).Debug("high level restful api, read parameters from request body, then start to handle.", - zap.Any("url", c.Request.URL.Path), zap.Any("request", req)) + zap.Any("url", c.Request.URL.Path)) v2(ctx, c, req, dbName) } } @@ -272,7 +272,7 @@ func wrapperProxyWithLimit(ctx context.Context, c *gin.Context, req any, checkAu return nil, RestRequestInterceptorErr } } - log.Ctx(ctx).Debug("high level restful api, try to do a grpc call", zap.Any("grpcRequest", req)) + log.Ctx(ctx).Debug("high level restful api, try to do a grpc call") username, ok := c.Get(ContextUsername) if !ok { username = "" @@ -285,7 +285,7 @@ func wrapperProxyWithLimit(ctx context.Context, c *gin.Context, req any, checkAu } } if err != nil { - log.Ctx(ctx).Warn("high level restful api, grpc call failed", zap.Error(err), zap.Any("grpcRequest", req)) + log.Ctx(ctx).Warn("high level restful api, grpc call failed", zap.Error(err)) if !ignoreErr { HTTPAbortReturn(c, http.StatusOK, gin.H{HTTPReturnCode: merr.Code(err), HTTPReturnMessage: err.Error()}) } @@ -309,7 +309,7 @@ func (h *HandlersV2) wrapperCheckDatabase(v2 handlerFuncV2) handlerFuncV2 { return v2(ctx, c, req, dbName) } } - log.Ctx(ctx).Warn("high level restful api, non-exist database", zap.String("database", dbName), zap.Any("request", req)) + log.Ctx(ctx).Warn("high level restful api, non-exist database", zap.String("database", dbName)) HTTPAbortReturn(c, http.StatusOK, gin.H{ HTTPReturnCode: merr.Code(merr.ErrDatabaseNotFound), HTTPReturnMessage: merr.ErrDatabaseNotFound.Error() + ", database: " + dbName,