summaryrefslogtreecommitdiff
path: root/lib/sentry/client.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sentry/client.rb')
-rw-r--r--lib/sentry/client.rb54
1 files changed, 1 insertions, 53 deletions
diff --git a/lib/sentry/client.rb b/lib/sentry/client.rb
index 3df688a1fda..dd589b6194d 100644
--- a/lib/sentry/client.rb
+++ b/lib/sentry/client.rb
@@ -3,6 +3,7 @@
module Sentry
class Client
include Sentry::Client::Projects
+ include Sentry::Client::Issue
Error = Class.new(StandardError)
MissingKeysError = Class.new(StandardError)
@@ -23,12 +24,6 @@ module Sentry
@token = token
end
- def issue_details(issue_id:)
- issue = get_issue(issue_id: issue_id)
-
- map_to_detailed_error(issue)
- end
-
def issue_latest_event(issue_id:)
latest_event = get_issue_latest_event(issue_id: issue_id)
@@ -107,10 +102,6 @@ module Sentry
}.compact
end
- def get_issue(issue_id:)
- http_get(issue_api_url(issue_id))[:body]
- end
-
def get_issue_latest_event(issue_id:)
http_get(issue_latest_event_api_url(issue_id))[:body]
end
@@ -145,13 +136,6 @@ module Sentry
raise Client::Error, message
end
- def issue_api_url(issue_id)
- issue_url = URI(@url)
- issue_url.path = "/api/0/issues/#{issue_id}/"
-
- issue_url
- end
-
def issue_latest_event_api_url(issue_id)
latest_event_url = URI(@url)
latest_event_url.path = "/api/0/issues/#{issue_id}/events/latest/"
@@ -212,42 +196,6 @@ module Sentry
stack_trace_entry.dig('stacktrace', 'frames')
end
- def parse_gitlab_issue(plugin_issues)
- return unless plugin_issues
-
- gitlab_plugin = plugin_issues.detect { |item| item['id'] == 'gitlab' }
- return unless gitlab_plugin
-
- gitlab_plugin.dig('issue', 'url')
- end
-
- def map_to_detailed_error(issue)
- Gitlab::ErrorTracking::DetailedError.new(
- id: issue.fetch('id'),
- first_seen: issue.fetch('firstSeen', nil),
- last_seen: issue.fetch('lastSeen', nil),
- title: issue.fetch('title', nil),
- type: issue.fetch('type', nil),
- user_count: issue.fetch('userCount', nil),
- count: issue.fetch('count', nil),
- message: issue.dig('metadata', 'value'),
- culprit: issue.fetch('culprit', nil),
- external_url: issue_url(issue.fetch('id')),
- external_base_url: project_url,
- short_id: issue.fetch('shortId', nil),
- status: issue.fetch('status', nil),
- frequency: issue.dig('stats', '24h'),
- project_id: issue.dig('project', 'id'),
- project_name: issue.dig('project', 'name'),
- project_slug: issue.dig('project', 'slug'),
- gitlab_issue: parse_gitlab_issue(issue.fetch('pluginIssues', nil)),
- first_release_last_commit: issue.dig('firstRelease', 'lastCommit'),
- last_release_last_commit: issue.dig('lastRelease', 'lastCommit'),
- first_release_short_version: issue.dig('firstRelease', 'shortVersion'),
- last_release_short_version: issue.dig('lastRelease', 'shortVersion')
- )
- end
-
def map_to_error(issue)
Gitlab::ErrorTracking::Error.new(
id: issue.fetch('id'),