Skip to content

Commit

Permalink
log: Set request ID in RequestIDHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
monstermunchkin committed Nov 29, 2024
1 parent 3b03618 commit bafb344
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions maintenance/log/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ func RequestIDHandler(fieldKey, headerName string) func(next http.Handler) http.
ctx = hlog.WithValue(ctx, id)
r = r.WithContext(ctx)

transaction := sentry.TransactionFromContext(ctx)
if transaction != nil {
transaction.SetData("http.request.id", id.String())
}

// log requests with request id
log := zerolog.Ctx(ctx)
log.UpdateContext(func(c zerolog.Context) zerolog.Context {
Expand Down

0 comments on commit bafb344

Please sign in to comment.