Commit 7fed2d7a authored by Sean Arnold's avatar Sean Arnold Committed by Lin Jen-Shin

Add tags to detailed error response

- Fetched from Sentry API
parent f44d48a0
...@@ -21,6 +21,7 @@ module ErrorTracking ...@@ -21,6 +21,7 @@ module ErrorTracking
:project_slug, :project_slug,
:short_id, :short_id,
:status, :status,
:tags,
:title, :title,
:type, :type,
:user_count :user_count
......
---
title: Add tags to sentry detailed error response
merge_request: 22068
author:
type: added
...@@ -26,6 +26,7 @@ module Gitlab ...@@ -26,6 +26,7 @@ module Gitlab
:project_slug, :project_slug,
:short_id, :short_id,
:status, :status,
:tags,
:title, :title,
:type, :type,
:user_count :user_count
......
...@@ -36,6 +36,7 @@ module Sentry ...@@ -36,6 +36,7 @@ module Sentry
id: issue.fetch('id'), id: issue.fetch('id'),
first_seen: issue.fetch('firstSeen', nil), first_seen: issue.fetch('firstSeen', nil),
last_seen: issue.fetch('lastSeen', nil), last_seen: issue.fetch('lastSeen', nil),
tags: extract_tags(issue),
title: issue.fetch('title', nil), title: issue.fetch('title', nil),
type: issue.fetch('type', nil), type: issue.fetch('type', nil),
user_count: issue.fetch('userCount', nil), user_count: issue.fetch('userCount', nil),
...@@ -57,6 +58,13 @@ module Sentry ...@@ -57,6 +58,13 @@ module Sentry
last_release_short_version: issue.dig('lastRelease', 'shortVersion') last_release_short_version: issue.dig('lastRelease', 'shortVersion')
) )
end end
def extract_tags(issue)
{
level: issue.fetch('level', nil),
logger: issue.fetch('logger', nil)
}
end
end end
end end
end end
...@@ -18,6 +18,12 @@ FactoryBot.define do ...@@ -18,6 +18,12 @@ FactoryBot.define do
project_slug { 'project_name' } project_slug { 'project_name' }
short_id { 'ID' } short_id { 'ID' }
status { 'unresolved' } status { 'unresolved' }
tags do
{
level: 'error',
logger: 'rails'
}
end
frequency do frequency do
[ [
[Time.now.to_i, 10] [Time.now.to_i, 10]
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"external_base_url", "external_base_url",
"last_seen", "last_seen",
"message", "message",
"tags",
"type", "type",
"title", "title",
"project_id", "project_id",
...@@ -20,23 +21,38 @@ ...@@ -20,23 +21,38 @@
"last_release_short_version" "last_release_short_version"
], ],
"properties" : { "properties" : {
"id": { "type": "string"}, "id": { "type": "string" },
"first_seen": { "type": "string", "format": "date-time" }, "first_seen": { "type": "string", "format": "date-time" },
"last_seen": { "type": "string", "format": "date-time" }, "last_seen": { "type": "string", "format": "date-time" },
"type": { "type": "string" }, "type": { "type": "string" },
"message": { "type": "string" }, "message": { "type": "string" },
"culprit": { "type": "string" }, "culprit": { "type": "string" },
"count": { "type": "integer"}, "count": { "type": "integer" },
"external_url": { "type": "string" }, "external_url": { "type": "string" },
"external_base_url": { "type": "string" }, "external_base_url": { "type": "string" },
"user_count": { "type": "integer"}, "user_count": { "type": "integer"},
"title": { "type": "string"}, "tags": {
"project_id": { "type": "string"}, "type": "object",
"project_name": { "type": "string"}, "required" : [
"project_slug": { "type": "string"}, "level",
"short_id": { "type": "string"}, "logger"
"status": { "type": "string"}, ],
"frequency": { "type": "array"}, "properties": {
"level": {
"type": "string"
},
"logger": {
"type": "string"
}
}
},
"title": { "type": "string" },
"project_id": { "type": "string" },
"project_name": { "type": "string" },
"project_slug": { "type": "string" },
"short_id": { "type": "string" },
"status": { "type": "string" },
"frequency": { "type": "array" },
"gitlab_issue": { "type": ["string", "null"] }, "gitlab_issue": { "type": ["string", "null"] },
"first_release_last_commit": { "type": ["string", "null"] }, "first_release_last_commit": { "type": ["string", "null"] },
"last_release_last_commit": { "type": ["string", "null"] }, "last_release_last_commit": { "type": ["string", "null"] },
......
...@@ -74,6 +74,10 @@ describe Sentry::Client::Issue do ...@@ -74,6 +74,10 @@ describe Sentry::Client::Issue do
it 'has a correct GitLab issue url' do it 'has a correct GitLab issue url' do
expect(subject.gitlab_issue).to eq('https://gitlab.com/gitlab-org/gitlab/issues/1') expect(subject.gitlab_issue).to eq('https://gitlab.com/gitlab-org/gitlab/issues/1')
end end
it 'has the correct tags' do
expect(subject.tags).to eq({ level: issue_sample_response['level'], logger: issue_sample_response['logger'] })
end
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment