Skip to content

Commit d9c852b

Browse files
victorvarzaVictor Varza
andauthored
add request_id for each request (#28)
Co-authored-by: Victor Varza <[email protected]>
1 parent 3968b97 commit d9c852b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pkg/apiserver/web/router.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ governing permissions and limitations under the License.
1313
package web
1414

1515
import (
16+
"github.com/google/uuid"
1617
"github.com/labstack/echo/v4"
1718
"github.com/labstack/echo/v4/middleware"
1819
"github.com/labstack/gommon/log"
@@ -30,5 +31,11 @@ func NewRouter() *echo.Echo {
3031
AllowMethods: []string{echo.GET, echo.HEAD},
3132
}))
3233
e.Validator = NewValidator()
34+
e.Use(middleware.RequestIDWithConfig(middleware.RequestIDConfig{
35+
Generator: func() string {
36+
id := uuid.New()
37+
return id.String()
38+
},
39+
}))
3340
return e
3441
}

0 commit comments

Comments
 (0)