lograge doesn't log requests handled by middleware

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Spun out of #220768 (closed) because that had a derail about Sentry.

We use lograge for structured logging. However, it doesn't (can't?) log requests handled by a Rails middleware: https://github.com/roidrage/lograge/issues/48

For example:

$ curl -si https://gitlab.com/gitlab-org/gitlab?go-get=1 | grep x-request-id
x-request-id: egScJBAIkX6

This request will be handled by https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/middleware/go.rb. It shows up in Workhorse logs but not Rails logs:

image

This is not a huge problem for a request like that, which worked OK, but it is a problem for when a middleware errors: we'll have no log entry with the exception.

According to that issue, the best options seem to be:

  1. Add a middleware to pass details to lograge: https://github.com/roidrage/lograge/issues/48#issuecomment-114154396
  2. Switch to something else like https://github.com/rocketjob/semantic_logger which does (apparently) handle this.
Edited by 🤖 GitLab Bot 🤖