diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-13 18:02:49 +0000 |
---|---|---|
committer | Dylan Griffith <dyl.griffith@gmail.com> | 2018-11-14 10:14:03 +0000 |
commit | 39830d1e33144a5223db06a6ad092c679661c612 (patch) | |
tree | f552a69021397dd8e24bcba6fd2f7a6de428ad0a | |
parent | d45c920456b7c1f48bf441efcfa390797a4f6f96 (diff) | |
download | gitlab-ce-53922-sentry-errors-for-k8s-integration.tar.gz |
Add Sentry exception tracking for Kubernetes errors53922-sentry-errors-for-k8s-integration
-rw-r--r-- | app/services/clusters/applications/check_installation_progress_service.rb | 1 | ||||
-rw-r--r-- | app/services/clusters/applications/install_service.rb | 2 | ||||
-rw-r--r-- | spec/lib/gitlab/sentry_spec.rb | 26 |
3 files changed, 16 insertions, 13 deletions
diff --git a/app/services/clusters/applications/check_installation_progress_service.rb b/app/services/clusters/applications/check_installation_progress_service.rb index 49b8825c3a4..ca0f7b30053 100644 --- a/app/services/clusters/applications/check_installation_progress_service.rb +++ b/app/services/clusters/applications/check_installation_progress_service.rb @@ -16,6 +16,7 @@ module Clusters end rescue Kubeclient::HttpError => e Rails.logger.error("Kubernetes error: #{e.error_code} #{e.message}") + Gitlab::Sentry.track_acceptable_exception(e, extra: { scope: 'kubernetes', app_id: app.id }) app.make_errored!("Kubernetes error: #{e.error_code}") unless app.errored? end diff --git a/app/services/clusters/applications/install_service.rb b/app/services/clusters/applications/install_service.rb index 947d22022bc..f4385748c43 100644 --- a/app/services/clusters/applications/install_service.rb +++ b/app/services/clusters/applications/install_service.rb @@ -14,9 +14,11 @@ module Clusters ClusterWaitForAppInstallationWorker::INTERVAL, app.name, app.id) rescue Kubeclient::HttpError => e Rails.logger.error("Kubernetes error: #{e.error_code} #{e.message}") + Gitlab::Sentry.track_acceptable_exception(e, extra: { scope: 'kubernetes', app_id: app.id }) app.make_errored!("Kubernetes error: #{e.error_code}") rescue StandardError => e Rails.logger.error "Can't start installation process: #{e.class.name} #{e.message}" + Gitlab::Sentry.track_acceptable_exception(e, extra: { scope: 'kubernetes', app_id: app.id }) app.make_errored!("Can't start installation process.") end end diff --git a/spec/lib/gitlab/sentry_spec.rb b/spec/lib/gitlab/sentry_spec.rb index 1622035ff6a..d3b41b27b80 100644 --- a/spec/lib/gitlab/sentry_spec.rb +++ b/spec/lib/gitlab/sentry_spec.rb @@ -61,19 +61,19 @@ describe Gitlab::Sentry do end it 'calls Raven.capture_exception' do - expected_extras = { - some_other_info: 'info', - issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1' - } - - expect(Raven).to receive(:capture_exception) - .with(exception, extra: a_hash_including(expected_extras)) - - described_class.track_acceptable_exception( - exception, - issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1', - extra: { some_other_info: 'info' } - ) + expected_extras = { + some_other_info: 'info', + issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1' + } + + expect(Raven).to receive(:capture_exception) + .with(exception, extra: a_hash_including(expected_extras)) + + described_class.track_acceptable_exception( + exception, + issue_url: 'http://gitlab.com/gitlab-org/gitlab-ce/issues/1', + extra: { some_other_info: 'info' } + ) end end end |