Skip to content

Log and pass correlation-id between Unicorn, Sidekiq and Gitaly

Kamil Trzciński requested to merge store-correlation-logs into master

What does this MR do?

The Correlation ID is taken or generated from received X-Request-ID. Then it is being passed to all executed services (sidekiq workers or gitaly calls).

The Correlation ID is logged in all structured logs as correlation_id.

Pass Correlation ID to Sentry.

What was tested?

  • Correlation ID is generated by Workhorse and passed in X-Request-ID,
  • Correlation ID is put into production/development_json for all Controller calls as correlation_id,
  • Correlation ID is put into api_json for all API calls as correlation_id,
  • Correlation ID is put into sidekiq logs for executed Sidekiq workers as correlation_id,
  • Correlation ID is passed to another Sidekiq job if executed by Sidekiq,
  • Correlation ID is passed in HTTP request to Gitaly as correlation_id,
  • A new Correlation ID is generated for all cron-executed sidekiq jobs,
  • A trackable exception (Gitlab::Sentry::trackable_exception) send to sentry includes Correlation ID as a tag,
  • An exception send to sentry includes Correlation ID when originating from Unicorn (it works, but this is hidden as X-Request-ID header),
  • An exception send to sentry includes Correlation ID when originating from Sidekiq (it works, but this is hidden in sidekiq payload),

What are the relevant issue numbers?

Relates to gitlab-com/support/support-team-meta#1259 (closed)

Does this MR meet the acceptance criteria?

Edited by Kamil Trzciński

Merge request reports