Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHINENG-11685: modify temp debug logging #1469

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions manager/middlewares/limits.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

func LimitRequestBodySize(size int64) gin.HandlerFunc {
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "LimitRequestBodySize")
if c.Request != nil && c.Request.Body != nil {
c.Request.Body = http.MaxBytesReader(c.Writer, c.Request.Body, size)
}
Expand All @@ -20,7 +19,6 @@ func LimitRequestBodySize(size int64) gin.HandlerFunc {

func LimitRequestHeaders(maxHeaderCount int) gin.HandlerFunc {
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "LimitRequestHeaders")
if len(c.Request.Header) > maxHeaderCount {
c.AbortWithStatusJSON(http.StatusRequestEntityTooLarge, utils.ErrorResponse{Error: "too many headers"})
}
Expand All @@ -30,7 +28,6 @@ func LimitRequestHeaders(maxHeaderCount int) gin.HandlerFunc {
func MaxConnections(max int) gin.HandlerFunc {
conns := make(chan struct{}, max)
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "MaxConnections")
conns <- struct{}{}
defer func() { <-conns }()
c.Next()
Expand All @@ -40,7 +37,6 @@ func MaxConnections(max int) gin.HandlerFunc {
func Ratelimit(max int) gin.HandlerFunc {
rl := ratelimit.New(max)
return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "Ratelimit")
rl.Take()
c.Next()
}
Expand Down
3 changes: 2 additions & 1 deletion manager/middlewares/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ func RBAC() gin.HandlerFunc {
}

return func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "RBAC")
tempLogDebugGinContextRequestHeader(c, "RBAC before")
defer tempLogDebugGinContextRequestHeader(c, "RBAC after")
if isAccessGranted(c) {
return
}
Expand Down
2 changes: 0 additions & 2 deletions manager/middlewares/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ func WithTimeout(seconds time.Duration) gin.HandlerFunc {
return timeout.New(
timeout.WithTimeout(seconds*time.Second),
timeout.WithHandler(func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "TimeoutWithHandler")
c.Next()
}),
timeout.WithResponse(func(c *gin.Context) {
tempLogDebugGinContextRequestHeader(c, "TimeoutWithResponse")
c.AbortWithStatusJSON(http.StatusRequestTimeout, utils.ErrorResponse{Error: "Request timeout"})
c.Done()
}),
Expand Down
Loading