Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Leitzen <pleitzen@gitlab.com>2018-12-13 17:24:44 +0300
committerPeter Leitzen <pleitzen@gitlab.com>2018-12-13 17:24:44 +0300
commitf6c869dd3fdaede5be3e70f143b5146142255b06 (patch)
tree40b5c560d2b6dd7b6834d80e8f5f1d2e0c407674
parentb7fdab6fc8d32ac83b0bceb8b34170ef3e73bdf2 (diff)
Wire Sentry issues service with the controller
-rw-r--r--app/controllers/projects/error_tracking_controller.rb57
1 files changed, 11 insertions, 46 deletions
diff --git a/app/controllers/projects/error_tracking_controller.rb b/app/controllers/projects/error_tracking_controller.rb
index 39d3c02d853..51cfa40bb1a 100644
--- a/app/controllers/projects/error_tracking_controller.rb
+++ b/app/controllers/projects/error_tracking_controller.rb
@@ -13,52 +13,17 @@ class Projects::ErrorTrackingController < Projects::ApplicationController
private
def query_errors
- [
- {
- "id": 2,
- "first_seen": "2018-11-06T21:19:56Z",
- "last_seen": "2018-11-06T21:19:56Z",
- "message": "Authentication failed, token expired!",
- "culprit": "io.sentry.example.ApiRequest in perform",
- "count": 1,
- "external_url": "https://sentry.io/the-interstellar-jurisdiction/pump-station/issues/2/",
- "project": {
- "id": "2",
- "name": "Pump Station",
- "slug": "pump-station"
- },
- "short_id": "PUMP-STATION-2",
- "status": "unresolved",
- "title": "ApiException: Authentication failed, token expired!",
- "type": "error",
- "user_count": 0
- },
- {
- "id": 3,
- "first_seen": "2018-10-06T21:19:56Z",
- "last_seen": "2018-11-06T21:19:56Z",
- "message": "All the things failed.",
- "culprit": "system.tasks.do.things",
- "count": 3,
- "external_url": "https://sentry.io/the-interstellar-jurisdiction/pump-station/issues/3/",
- "project": {
- "id": "2",
- "name": "Pump Station",
- "slug": "pump-station"
- },
- "short_id": "PUMP-STATION-3",
- "status": "unresolved",
- "title": "BigError: All the things failed.",
- "type": "error",
- "user_count": 0
- }
- ].map do |json|
- project = json.delete(:project)
- json[:project_id] = project.fetch(:id)
- json[:project_name] = project.fetch(:name)
- json[:project_slug] = project.fetch(:slug)
- ErrorTracking::Error.new(json)
- end
+ setting = fetch_settings(@project)
+ return [] unless setting
+
+ ErrorTracking::SentryIssuesService
+ .new(setting.uri, setting.token)
+ .execute
+ end
+
+ def fetch_settings(project)
+ setting = project.error_tracking_setting
+ return setting if setting&.enabled?
end
def check_feature_flag!