Skip to content

Commit

Permalink
add request_id for each request (#28)
Browse files Browse the repository at this point in the history
Co-authored-by: Victor Varza <[email protected]>
  • Loading branch information
victorvarza and Victor Varza authored May 9, 2022
1 parent 3968b97 commit d9c852b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/apiserver/web/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ governing permissions and limitations under the License.
package web

import (
"github.com/google/uuid"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
"github.com/labstack/gommon/log"
Expand All @@ -30,5 +31,11 @@ func NewRouter() *echo.Echo {
AllowMethods: []string{echo.GET, echo.HEAD},
}))
e.Validator = NewValidator()
e.Use(middleware.RequestIDWithConfig(middleware.RequestIDConfig{
Generator: func() string {
id := uuid.New()
return id.String()
},
}))
return e
}

0 comments on commit d9c852b

Please sign in to comment.