Skip to content

Merge Sentry's contexts and users into Application Context

What does this MR do?

A part of gitlab-com/gl-infra/scalability#846 (closed), and a part of gitlab-com/gl-infra&396 (closed) epic.

This MR is to merge Sentry's own context stack into Gitlab::ApplicationContext and refactor Gitlab::ErrorTracking to extract the functionalities into dedicated modules. We also want to make sure all logic related to Error Tracking staying unchanged. In detail:

  • Remove Gitlab::ApplicaionContext#with_context.
  • Remove all direct accesses to Raven#capture_exception.
  • Move logging-related logic to Gitlab::ErrorTracking::LogFormatter.
  • Utilize context payload in manually-created events, auto-captured event, and loggger.

As a result of the merger, all events captured by Sentry built-in integrations now include application-context tags and user information, especially feature_category.

Screenshots (strongly suggested)

Exception captured in API handlers

Screenshot_from_2021-02-09_11-31-31

Exception captured in GraphQL Controller

Screenshot_from_2021-02-09_11-13-13

Exception captured in a Web Controller (captured automatically)

Screenshot_from_2021-02-09_11-11-19

Exception captured in a Web Controller (captured manually)

Screenshot_from_2021-02-09_12-02-15

Exception captured in a Worker (captured manually)

Screenshot_from_2021-02-09_12-05-12

Exception captured in a Worker (captured automatically)

Screenshot_from_2021-02-09_12-03-03

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Quang-Minh Nguyen

Merge request reports