Commit 629c9dd8 authored by Lin Jen-Shin's avatar Lin Jen-Shin

Merge branch '119031-add-tags-to-sentry-error-api-rest' into 'master'

Add tags to detailed error response

See merge request gitlab-org/gitlab!22068
parents f44d48a0 7fed2d7a
......@@ -21,6 +21,7 @@ module ErrorTracking
:project_slug,
:short_id,
:status,
:tags,
:title,
:type,
:user_count
......
---
title: Add tags to sentry detailed error response
merge_request: 22068
author:
type: added
......@@ -26,6 +26,7 @@ module Gitlab
:project_slug,
:short_id,
:status,
:tags,
:title,
:type,
:user_count
......
......@@ -36,6 +36,7 @@ module Sentry
id: issue.fetch('id'),
first_seen: issue.fetch('firstSeen', nil),
last_seen: issue.fetch('lastSeen', nil),
tags: extract_tags(issue),
title: issue.fetch('title', nil),
type: issue.fetch('type', nil),
user_count: issue.fetch('userCount', nil),
......@@ -57,6 +58,13 @@ module Sentry
last_release_short_version: issue.dig('lastRelease', 'shortVersion')
)
end
def extract_tags(issue)
{
level: issue.fetch('level', nil),
logger: issue.fetch('logger', nil)
}
end
end
end
end
......@@ -18,6 +18,12 @@ FactoryBot.define do
project_slug { 'project_name' }
short_id { 'ID' }
status { 'unresolved' }
tags do
{
level: 'error',
logger: 'rails'
}
end
frequency do
[
[Time.now.to_i, 10]
......
......@@ -5,6 +5,7 @@
"external_base_url",
"last_seen",
"message",
"tags",
"type",
"title",
"project_id",
......@@ -20,23 +21,38 @@
"last_release_short_version"
],
"properties" : {
"id": { "type": "string"},
"id": { "type": "string" },
"first_seen": { "type": "string", "format": "date-time" },
"last_seen": { "type": "string", "format": "date-time" },
"type": { "type": "string" },
"message": { "type": "string" },
"culprit": { "type": "string" },
"count": { "type": "integer"},
"count": { "type": "integer" },
"external_url": { "type": "string" },
"external_base_url": { "type": "string" },
"user_count": { "type": "integer"},
"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"},
"tags": {
"type": "object",
"required" : [
"level",
"logger"
],
"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"] },
"first_release_last_commit": { "type": ["string", "null"] },
"last_release_last_commit": { "type": ["string", "null"] },
......
......@@ -74,6 +74,10 @@ describe Sentry::Client::Issue do
it 'has a correct GitLab issue url' do
expect(subject.gitlab_issue).to eq('https://gitlab.com/gitlab-org/gitlab/issues/1')
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
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