Skip to content

Commit

Permalink
enhance: do not log out the full req(#36546) (#37948)
Browse files Browse the repository at this point in the history
pr: #36546

Signed-off-by: lixinguo <[email protected]>
Co-authored-by: lixinguo <[email protected]>
  • Loading branch information
smellthemoon and lixinguo authored Nov 26, 2024
1 parent 93063ce commit ef6f990
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/distributed/proxy/httpserver/handler_v2.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,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),
Expand Down Expand Up @@ -208,7 +208,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)
}
}
Expand Down Expand Up @@ -313,7 +313,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 = ""
Expand All @@ -326,7 +326,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()})
}
Expand All @@ -350,7 +350,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,
Expand Down

0 comments on commit ef6f990

Please sign in to comment.