Skip to content

Introduce ErrorRepository to abstract data access for Error Tracking

Peter Leitzen requested to merge pl-error-tracking-model into master

What does this MR do and why?

This MR adds ErrorRepository, a data layer for accessing errors and error events for Category:Error Tracking.

Note this change is behind a feature flag :integrated_error_tracking.

See Data access layer interface for Error Tracking (#359843 - closed). Refs #358158 (comment 917746138).

Notes:

  • This is just a refactor
  • We only implement a ActiveRecord strategy
  • ClickHouse and more work to be done in e.g. !86544 (closed)
  • ErrorFinder is removed in favor of ErrorRepository#list_errors
  • Individual commits left for review but will be squashed

Screenshots or screen recordings

Still works with Sentry backend and GitLab backend

Backend Error list Error details
GitLab Screenshot_from_2022-04-26_13-30-20 Screenshot_from_2022-04-26_13-30-33
Sentry verified with sentry.gitlab.net verified with sentry.gitlab.net

How to set up and validate locally

  1. Enable feature flag integrated_error_tracking via Feature.enable(:integrated_error_tracking)
  2. Via Settings > Monitor > Error Tracking Enable Error Tracking Backend GitLab
  3. Create some errors via FactoryBot.create(:error_tracking_error, project: project)
  4. Create some error events
    • Via console error = _; FactoryBot.create(:error_tracking_error_event, error: error)
    • Via IRB: Setup via Setnry.init { |config| config.dsn = "<DSN FROM SETTINGS PAGE>" } and capture an error (not capture message).
  5. Verify via Monitor > Error Tracking

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Peter Leitzen

Merge request reports