Commit ae042c87 authored by Nick Thomas's avatar Nick Thomas

Merge branch '194164-add-missing-fields-for-sentry-error-details-graphql' into 'master'

Resolve "Add missing fields for Sentry error details GraphQL"

See merge request gitlab-org/gitlab!23483
parents a2580ca6 cd8c04cd
...@@ -11,77 +11,87 @@ module Types ...@@ -11,77 +11,87 @@ module Types
field :id, GraphQL::ID_TYPE, field :id, GraphQL::ID_TYPE,
null: false, null: false,
description: "ID (global ID) of the error" description: 'ID (global ID) of the error'
field :sentry_id, GraphQL::STRING_TYPE, field :sentry_id, GraphQL::STRING_TYPE,
method: :id, method: :id,
null: false, null: false,
description: "ID (Sentry ID) of the error" description: 'ID (Sentry ID) of the error'
field :title, GraphQL::STRING_TYPE, field :title, GraphQL::STRING_TYPE,
null: false, null: false,
description: "Title of the error" description: 'Title of the error'
field :type, GraphQL::STRING_TYPE, field :type, GraphQL::STRING_TYPE,
null: false, null: false,
description: "Type of the error" description: 'Type of the error'
field :user_count, GraphQL::INT_TYPE, field :user_count, GraphQL::INT_TYPE,
null: false, null: false,
description: "Count of users affected by the error" description: 'Count of users affected by the error'
field :count, GraphQL::INT_TYPE, field :count, GraphQL::INT_TYPE,
null: false, null: false,
description: "Count of occurrences" description: 'Count of occurrences'
field :first_seen, Types::TimeType, field :first_seen, Types::TimeType,
null: false, null: false,
description: "Timestamp when the error was first seen" description: 'Timestamp when the error was first seen'
field :last_seen, Types::TimeType, field :last_seen, Types::TimeType,
null: false, null: false,
description: "Timestamp when the error was last seen" description: 'Timestamp when the error was last seen'
field :message, GraphQL::STRING_TYPE, field :message, GraphQL::STRING_TYPE,
null: true, null: true,
description: "Sentry metadata message of the error" description: 'Sentry metadata message of the error'
field :culprit, GraphQL::STRING_TYPE, field :culprit, GraphQL::STRING_TYPE,
null: false, null: false,
description: "Culprit of the error" description: 'Culprit of the error'
field :external_base_url, GraphQL::STRING_TYPE,
null: false,
description: 'External Base URL of the Sentry Instance'
field :external_url, GraphQL::STRING_TYPE, field :external_url, GraphQL::STRING_TYPE,
null: false, null: false,
description: "External URL of the error" description: 'External URL of the error'
field :sentry_project_id, GraphQL::ID_TYPE, field :sentry_project_id, GraphQL::ID_TYPE,
method: :project_id, method: :project_id,
null: false, null: false,
description: "ID of the project (Sentry project)" description: 'ID of the project (Sentry project)'
field :sentry_project_name, GraphQL::STRING_TYPE, field :sentry_project_name, GraphQL::STRING_TYPE,
method: :project_name, method: :project_name,
null: false, null: false,
description: "Name of the project affected by the error" description: 'Name of the project affected by the error'
field :sentry_project_slug, GraphQL::STRING_TYPE, field :sentry_project_slug, GraphQL::STRING_TYPE,
method: :project_slug, method: :project_slug,
null: false, null: false,
description: "Slug of the project affected by the error" description: 'Slug of the project affected by the error'
field :short_id, GraphQL::STRING_TYPE, field :short_id, GraphQL::STRING_TYPE,
null: false, null: false,
description: "Short ID (Sentry ID) of the error" description: 'Short ID (Sentry ID) of the error'
field :status, Types::ErrorTracking::SentryErrorStatusEnum, field :status, Types::ErrorTracking::SentryErrorStatusEnum,
null: false, null: false,
description: "Status of the error" description: 'Status of the error'
field :frequency, [Types::ErrorTracking::SentryErrorFrequencyType], field :frequency, [Types::ErrorTracking::SentryErrorFrequencyType],
null: false, null: false,
description: "Last 24hr stats of the error" description: 'Last 24hr stats of the error'
field :first_release_last_commit, GraphQL::STRING_TYPE, field :first_release_last_commit, GraphQL::STRING_TYPE,
null: true, null: true,
description: "Commit the error was first seen" description: 'Commit the error was first seen'
field :last_release_last_commit, GraphQL::STRING_TYPE, field :last_release_last_commit, GraphQL::STRING_TYPE,
null: true, null: true,
description: "Commit the error was last seen" description: 'Commit the error was last seen'
field :first_release_short_version, GraphQL::STRING_TYPE, field :first_release_short_version, GraphQL::STRING_TYPE,
null: true, null: true,
description: "Release version the error was first seen" description: 'Release version the error was first seen'
field :last_release_short_version, GraphQL::STRING_TYPE, field :last_release_short_version, GraphQL::STRING_TYPE,
null: true, null: true,
description: "Release version the error was last seen" description: 'Release version the error was last seen'
field :gitlab_commit, GraphQL::STRING_TYPE, field :gitlab_commit, GraphQL::STRING_TYPE,
null: true, null: true,
description: "GitLab commit SHA attributed to the Error based on the release version" description: 'GitLab commit SHA attributed to the Error based on the release version'
field :gitlab_commit_path, GraphQL::STRING_TYPE, field :gitlab_commit_path, GraphQL::STRING_TYPE,
null: true, null: true,
description: "Path to the GitLab page for the GitLab commit attributed to the error" description: 'Path to the GitLab page for the GitLab commit attributed to the error'
field :gitlab_issue_path, GraphQL::STRING_TYPE,
method: :gitlab_issue,
null: true,
description: 'URL of GitLab Issue'
field :tags, Types::ErrorTracking::SentryErrorTagsType,
null: false,
description: 'Tags associated with the Sentry Error'
def first_seen def first_seen
DateTime.parse(object.first_seen) DateTime.parse(object.first_seen)
......
# frozen_string_literal: true
module Types
module ErrorTracking
# rubocop: disable Graphql/AuthorizeTypes
class SentryErrorTagsType < ::Types::BaseObject
graphql_name 'SentryErrorTags'
description 'State of a Sentry error'
field :level, GraphQL::STRING_TYPE,
null: true,
description: "Severity level of the Sentry Error"
field :logger, GraphQL::STRING_TYPE,
null: true,
description: "Logger of the Sentry Error"
end
# rubocop: enable Graphql/AuthorizeTypes
end
end
---
title: Add tags, external_base_url, gitlab_issue to Sentry Detailed Error graphql
merge_request: 23483
author:
type: added
...@@ -6065,6 +6065,11 @@ type SentryDetailedError { ...@@ -6065,6 +6065,11 @@ type SentryDetailedError {
""" """
culprit: String! culprit: String!
"""
External Base URL of the Sentry Instance
"""
externalBaseUrl: String!
""" """
External URL of the error External URL of the error
""" """
...@@ -6100,6 +6105,11 @@ type SentryDetailedError { ...@@ -6100,6 +6105,11 @@ type SentryDetailedError {
""" """
gitlabCommitPath: String gitlabCommitPath: String
"""
URL of GitLab Issue
"""
gitlabIssuePath: String
""" """
ID (global ID) of the error ID (global ID) of the error
""" """
...@@ -6155,6 +6165,11 @@ type SentryDetailedError { ...@@ -6155,6 +6165,11 @@ type SentryDetailedError {
""" """
status: SentryErrorStatus! status: SentryErrorStatus!
"""
Tags associated with the Sentry Error
"""
tags: SentryErrorTags!
""" """
Title of the error Title of the error
""" """
...@@ -6208,6 +6223,21 @@ enum SentryErrorStatus { ...@@ -6208,6 +6223,21 @@ enum SentryErrorStatus {
UNRESOLVED UNRESOLVED
} }
"""
State of a Sentry error
"""
type SentryErrorTags {
"""
Severity level of the Sentry Error
"""
level: String
"""
Logger of the Sentry Error
"""
logger: String
}
""" """
Represents a snippet entry Represents a snippet entry
""" """
......
...@@ -16746,6 +16746,24 @@ ...@@ -16746,6 +16746,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "externalBaseUrl",
"description": "External Base URL of the Sentry Instance",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "String",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "externalUrl", "name": "externalUrl",
"description": "External URL of the error", "description": "External URL of the error",
...@@ -16864,6 +16882,20 @@ ...@@ -16864,6 +16882,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "gitlabIssuePath",
"description": "URL of GitLab Issue",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "id", "name": "id",
"description": "ID (global ID) of the error", "description": "ID (global ID) of the error",
...@@ -17050,6 +17082,24 @@ ...@@ -17050,6 +17082,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "tags",
"description": "Tags associated with the Sentry Error",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "SentryErrorTags",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "title", "name": "title",
"description": "Title of the error", "description": "Title of the error",
...@@ -17196,6 +17246,47 @@ ...@@ -17196,6 +17246,47 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "OBJECT",
"name": "SentryErrorTags",
"description": "State of a Sentry error",
"fields": [
{
"name": "level",
"description": "Severity level of the Sentry Error",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "logger",
"description": "Logger of the Sentry Error",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
}
],
"inputFields": null,
"interfaces": [
],
"enumValues": null,
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "GrafanaIntegration", "name": "GrafanaIntegration",
......
...@@ -923,6 +923,7 @@ Autogenerated return type of RemoveAwardEmoji ...@@ -923,6 +923,7 @@ Autogenerated return type of RemoveAwardEmoji
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `count` | Int! | Count of occurrences | | `count` | Int! | Count of occurrences |
| `culprit` | String! | Culprit of the error | | `culprit` | String! | Culprit of the error |
| `externalBaseUrl` | String! | External Base URL of the Sentry Instance |
| `externalUrl` | String! | External URL of the error | | `externalUrl` | String! | External URL of the error |
| `firstReleaseLastCommit` | String | Commit the error was first seen | | `firstReleaseLastCommit` | String | Commit the error was first seen |
| `firstReleaseShortVersion` | String | Release version the error was first seen | | `firstReleaseShortVersion` | String | Release version the error was first seen |
...@@ -930,6 +931,7 @@ Autogenerated return type of RemoveAwardEmoji ...@@ -930,6 +931,7 @@ Autogenerated return type of RemoveAwardEmoji
| `frequency` | SentryErrorFrequency! => Array | Last 24hr stats of the error | | `frequency` | SentryErrorFrequency! => Array | Last 24hr stats of the error |
| `gitlabCommit` | String | GitLab commit SHA attributed to the Error based on the release version | | `gitlabCommit` | String | GitLab commit SHA attributed to the Error based on the release version |
| `gitlabCommitPath` | String | Path to the GitLab page for the GitLab commit attributed to the error | | `gitlabCommitPath` | String | Path to the GitLab page for the GitLab commit attributed to the error |
| `gitlabIssuePath` | String | URL of GitLab Issue |
| `id` | ID! | ID (global ID) of the error | | `id` | ID! | ID (global ID) of the error |
| `lastReleaseLastCommit` | String | Commit the error was last seen | | `lastReleaseLastCommit` | String | Commit the error was last seen |
| `lastReleaseShortVersion` | String | Release version the error was last seen | | `lastReleaseShortVersion` | String | Release version the error was last seen |
...@@ -941,6 +943,7 @@ Autogenerated return type of RemoveAwardEmoji ...@@ -941,6 +943,7 @@ Autogenerated return type of RemoveAwardEmoji
| `sentryProjectSlug` | String! | Slug of the project affected by the error | | `sentryProjectSlug` | String! | Slug of the project affected by the error |
| `shortId` | String! | Short ID (Sentry ID) of the error | | `shortId` | String! | Short ID (Sentry ID) of the error |
| `status` | SentryErrorStatus! | Status of the error | | `status` | SentryErrorStatus! | Status of the error |
| `tags` | SentryErrorTags! | Tags associated with the Sentry Error |
| `title` | String! | Title of the error | | `title` | String! | Title of the error |
| `type` | String! | Type of the error | | `type` | String! | Type of the error |
| `userCount` | Int! | Count of users affected by the error | | `userCount` | Int! | Count of users affected by the error |
...@@ -952,6 +955,15 @@ Autogenerated return type of RemoveAwardEmoji ...@@ -952,6 +955,15 @@ Autogenerated return type of RemoveAwardEmoji
| `count` | Int! | Count of errors received since the previously recorded time | | `count` | Int! | Count of errors received since the previously recorded time |
| `time` | Time! | Time the error frequency stats were recorded | | `time` | Time! | Time the error frequency stats were recorded |
## SentryErrorTags
State of a Sentry error
| Name | Type | Description |
| --- | ---- | ---------- |
| `level` | String | Severity level of the Sentry Error |
| `logger` | String | Logger of the Sentry Error |
## Snippet ## Snippet
Represents a snippet entry Represents a snippet entry
......
...@@ -20,6 +20,7 @@ describe GitlabSchema.types['SentryDetailedError'] do ...@@ -20,6 +20,7 @@ describe GitlabSchema.types['SentryDetailedError'] do
message message
culprit culprit
externalUrl externalUrl
externalBaseUrl
sentryProjectId sentryProjectId
sentryProjectName sentryProjectName
sentryProjectSlug sentryProjectSlug
...@@ -30,8 +31,10 @@ describe GitlabSchema.types['SentryDetailedError'] do ...@@ -30,8 +31,10 @@ describe GitlabSchema.types['SentryDetailedError'] do
lastReleaseLastCommit lastReleaseLastCommit
firstReleaseShortVersion firstReleaseShortVersion
lastReleaseShortVersion lastReleaseShortVersion
gitlabIssuePath
gitlabCommit gitlabCommit
gitlabCommitPath gitlabCommitPath
tags
] ]
is_expected.to have_graphql_fields(*expected_fields) is_expected.to have_graphql_fields(*expected_fields)
......
...@@ -57,6 +57,10 @@ describe 'getting a detailed sentry error' do ...@@ -57,6 +57,10 @@ describe 'getting a detailed sentry error' do
expect(error_data['firstSeen']).to eql sentry_detailed_error.first_seen expect(error_data['firstSeen']).to eql sentry_detailed_error.first_seen
expect(error_data['lastSeen']).to eql sentry_detailed_error.last_seen expect(error_data['lastSeen']).to eql sentry_detailed_error.last_seen
expect(error_data['gitlabCommit']).to be nil expect(error_data['gitlabCommit']).to be nil
expect(error_data['externalBaseUrl']).to eq sentry_detailed_error.external_base_url
expect(error_data['gitlabIssuePath']).to eq sentry_detailed_error.gitlab_issue
expect(error_data['tags']['logger']).to eq sentry_detailed_error.tags[:logger]
expect(error_data['tags']['level']).to eq sentry_detailed_error.tags[:level]
end end
it 'is expected to return the frequency correctly' do it 'is expected to return the frequency correctly' do
......
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