diff options
Diffstat (limited to 'app/services/error_tracking/list_issues_service.rb')
-rw-r--r-- | app/services/error_tracking/list_issues_service.rb | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/app/services/error_tracking/list_issues_service.rb b/app/services/error_tracking/list_issues_service.rb index 7087e3825d6..5ddba748fd4 100644 --- a/app/services/error_tracking/list_issues_service.rb +++ b/app/services/error_tracking/list_issues_service.rb @@ -22,13 +22,15 @@ module ErrorTracking def perform return invalid_status_error unless valid_status? - response = project_error_tracking_setting.list_sentry_issues( + sentry_opts = { issue_status: issue_status, limit: limit, search_term: params[:search_term].presence, sort: sort, cursor: params[:cursor].presence - ) + } + + response = list_issues(sentry_opts) compose_response(response) end @@ -56,5 +58,36 @@ module ErrorTracking def sort params[:sort] || DEFAULT_SORT end + + def list_issues(opts) + # There are 2 types of the data source for the error tracking feature: + # + # * When integrated error tracking is enabled, we use the application database + # to read and save error tracking data. + # + # * When integrated error tracking is disabled we call + # project_error_tracking_setting method which works with Sentry API. + # + # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/329596 + # + if project_error_tracking_setting.integrated_client? + # We are going to support more options in the future. + # For now we implement the bare minimum for rendering the list in UI. + filter_opts = { + status: opts[:issue_status] + } + + errors = ErrorTracking::ErrorsFinder.new(current_user, project, filter_opts).execute + + # We use the same response format as project_error_tracking_setting + # method below for compatibility with existing code. + { + issues: errors.map(&:to_sentry_error), + pagination: {} + } + else + project_error_tracking_setting.list_sentry_issues(**opts) + end + end end end |