summaryrefslogtreecommitdiff
path: root/app/graphql/types
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 09:06:39 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-06 09:06:39 +0000
commitcd15d0e6c32da7f69689c7cff2e90aeda33b8318 (patch)
tree8343899f0873ab05f3eadca72c5f6e0a653a12ac /app/graphql/types
parentdd6afb4b4785ed1889defc6d7bb8ef114dd4eb50 (diff)
downloadgitlab-ce-cd15d0e6c32da7f69689c7cff2e90aeda33b8318.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/graphql/types')
-rw-r--r--app/graphql/types/error_tracking/sentry_detailed_error_type.rb93
-rw-r--r--app/graphql/types/error_tracking/sentry_error_frequency_type.rb18
-rw-r--r--app/graphql/types/error_tracking/sentry_error_status_enum.rb15
-rw-r--r--app/graphql/types/project_type.rb6
4 files changed, 132 insertions, 0 deletions
diff --git a/app/graphql/types/error_tracking/sentry_detailed_error_type.rb b/app/graphql/types/error_tracking/sentry_detailed_error_type.rb
new file mode 100644
index 00000000000..c680f387a9a
--- /dev/null
+++ b/app/graphql/types/error_tracking/sentry_detailed_error_type.rb
@@ -0,0 +1,93 @@
+# frozen_string_literal: true
+
+module Types
+ module ErrorTracking
+ class SentryDetailedErrorType < ::Types::BaseObject
+ graphql_name 'SentryDetailedError'
+
+ present_using SentryDetailedErrorPresenter
+
+ authorize :read_sentry_issue
+
+ field :id, GraphQL::ID_TYPE,
+ null: false,
+ description: "ID (global ID) of the error"
+ field :sentry_id, GraphQL::STRING_TYPE,
+ method: :id,
+ null: false,
+ description: "ID (Sentry ID) of the error"
+ field :title, GraphQL::STRING_TYPE,
+ null: false,
+ description: "Title of the error"
+ field :type, GraphQL::STRING_TYPE,
+ null: false,
+ description: "Type of the error"
+ field :user_count, GraphQL::INT_TYPE,
+ null: false,
+ description: "Count of users affected by the error"
+ field :count, GraphQL::INT_TYPE,
+ null: false,
+ description: "Count of occurrences"
+ field :first_seen, Types::TimeType,
+ null: false,
+ description: "Timestamp when the error was first seen"
+ field :last_seen, Types::TimeType,
+ null: false,
+ description: "Timestamp when the error was last seen"
+ field :message, GraphQL::STRING_TYPE,
+ null: true,
+ description: "Sentry metadata message of the error"
+ field :culprit, GraphQL::STRING_TYPE,
+ null: false,
+ description: "Culprit of the error"
+ field :external_url, GraphQL::STRING_TYPE,
+ null: false,
+ description: "External URL of the error"
+ field :sentry_project_id, GraphQL::ID_TYPE,
+ method: :project_id,
+ null: false,
+ description: "ID of the project (Sentry project)"
+ field :sentry_project_name, GraphQL::STRING_TYPE,
+ method: :project_name,
+ null: false,
+ description: "Name of the project affected by the error"
+ field :sentry_project_slug, GraphQL::STRING_TYPE,
+ method: :project_slug,
+ null: false,
+ description: "Slug of the project affected by the error"
+ field :short_id, GraphQL::STRING_TYPE,
+ null: false,
+ description: "Short ID (Sentry ID) of the error"
+ field :status, Types::ErrorTracking::SentryErrorStatusEnum,
+ null: false,
+ description: "Status of the error"
+ field :frequency, [Types::ErrorTracking::SentryErrorFrequencyType],
+ null: false,
+ description: "Last 24hr stats of the error"
+ field :first_release_last_commit, GraphQL::STRING_TYPE,
+ null: true,
+ description: "Commit the error was first seen"
+ field :last_release_last_commit, GraphQL::STRING_TYPE,
+ null: true,
+ description: "Commit the error was last seen"
+ field :first_release_short_version, GraphQL::STRING_TYPE,
+ null: true,
+ description: "Release version the error was first seen"
+ field :last_release_short_version, GraphQL::STRING_TYPE,
+ null: true,
+ description: "Release version the error was last seen"
+
+ def first_seen
+ DateTime.parse(object.first_seen)
+ end
+
+ def last_seen
+ DateTime.parse(object.last_seen)
+ end
+
+ def project_id
+ Gitlab::GlobalId.build(model_name: 'Project', id: object.project_id).to_s
+ end
+ end
+ end
+end
diff --git a/app/graphql/types/error_tracking/sentry_error_frequency_type.rb b/app/graphql/types/error_tracking/sentry_error_frequency_type.rb
new file mode 100644
index 00000000000..a44ca0684b6
--- /dev/null
+++ b/app/graphql/types/error_tracking/sentry_error_frequency_type.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Types
+ module ErrorTracking
+ # rubocop: disable Graphql/AuthorizeTypes
+ class SentryErrorFrequencyType < ::Types::BaseObject
+ graphql_name 'SentryErrorFrequency'
+
+ field :time, Types::TimeType,
+ null: false,
+ description: "Time the error frequency stats were recorded"
+ field :count, GraphQL::INT_TYPE,
+ null: false,
+ description: "Count of errors received since the previously recorded time"
+ end
+ # rubocop: enable Graphql/AuthorizeTypes
+ end
+end
diff --git a/app/graphql/types/error_tracking/sentry_error_status_enum.rb b/app/graphql/types/error_tracking/sentry_error_status_enum.rb
new file mode 100644
index 00000000000..df68eef4f3c
--- /dev/null
+++ b/app/graphql/types/error_tracking/sentry_error_status_enum.rb
@@ -0,0 +1,15 @@
+# frozen_string_literal: true
+
+module Types
+ module ErrorTracking
+ class SentryErrorStatusEnum < ::Types::BaseEnum
+ graphql_name 'SentryErrorStatus'
+ description 'State of a Sentry error'
+
+ value 'RESOLVED', value: 'resolved', description: 'Error has been resolved'
+ value 'RESOLVED_IN_NEXT_RELEASE', value: 'resolvedInNextRelease', description: 'Error has been ignored until next release'
+ value 'UNRESOLVED', value: 'unresolved', description: 'Error is unresolved'
+ value 'IGNORED', value: 'ignored', description: 'Error has been ignored'
+ end
+ end
+end
diff --git a/app/graphql/types/project_type.rb b/app/graphql/types/project_type.rb
index 73255021119..d2a163b70db 100644
--- a/app/graphql/types/project_type.rb
+++ b/app/graphql/types/project_type.rb
@@ -145,5 +145,11 @@ module Types
null: true,
description: 'Build pipelines of the project',
resolver: Resolvers::ProjectPipelinesResolver
+
+ field :sentry_detailed_error,
+ Types::ErrorTracking::SentryDetailedErrorType,
+ null: true,
+ description: 'Detailed version of a Sentry error on the project',
+ resolver: Resolvers::ErrorTracking::SentryDetailedErrorResolver
end
end