diff options
author | Stan Hu <stanhu@gmail.com> | 2018-05-26 06:14:46 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-05-26 06:58:28 -0700 |
commit | a8450618ca5ab238f590385cfefb4ae2d9b751e0 (patch) | |
tree | a0a3a264a16c4a58b60516564f6d922ef280f388 | |
parent | cb868f414490f6c446514784922a05b6ed46c2fc (diff) | |
download | gitlab-ce-sh-sentry-async.tar.gz |
Move Sentry notifications to a Sidekiq processsh-sentry-async
We've seen that the API exception handling can take upwards of 30 seconds
to handle. During times where lots of events are occurring, the POST request
to the Sentry server could block other requests.
-rw-r--r-- | app/workers/all_queues.yml | 1 | ||||
-rw-r--r-- | app/workers/sentry_worker.rb | 8 | ||||
-rw-r--r-- | changelogs/unreleased/sh-sentry-async.yml | 5 | ||||
-rw-r--r-- | config/initializers/sentry.rb | 3 | ||||
-rw-r--r-- | config/sidekiq_queues.yml | 2 |
5 files changed, 18 insertions, 1 deletions
diff --git a/app/workers/all_queues.yml b/app/workers/all_queues.yml index b6433eb3eff..30b50986973 100644 --- a/app/workers/all_queues.yml +++ b/app/workers/all_queues.yml @@ -108,6 +108,7 @@ - repository_fork - repository_import - repository_remove_remote +- sentry - storage_migrator - system_hook_push - update_merge_requests diff --git a/app/workers/sentry_worker.rb b/app/workers/sentry_worker.rb new file mode 100644 index 00000000000..4420db894d7 --- /dev/null +++ b/app/workers/sentry_worker.rb @@ -0,0 +1,8 @@ +class SentryWorker + include ApplicationWorker + + def perform(event_hash) + # Sidekiq has converted the argument back into a Ruby hash object + Raven.send_event(event_hash) # send_event takes a hash or a Raven::Event. + end +end diff --git a/changelogs/unreleased/sh-sentry-async.yml b/changelogs/unreleased/sh-sentry-async.yml new file mode 100644 index 00000000000..4abaac68ce1 --- /dev/null +++ b/changelogs/unreleased/sh-sentry-async.yml @@ -0,0 +1,5 @@ +--- +title: Move Sentry notifications to a Sidekiq process +merge_request: +author: +type: performance diff --git a/config/initializers/sentry.rb b/config/initializers/sentry.rb index 17d09293205..cbfa6ab5cc1 100644 --- a/config/initializers/sentry.rb +++ b/config/initializers/sentry.rb @@ -20,6 +20,9 @@ def configure_sentry # Sanitize authentication headers config.sanitize_http_headers = %w[Authorization Private-Token] config.tags = { program: Gitlab::Sentry.program_context } + config.async = lambda do |event| + SentryWorker.perform_async(event) + end end end end diff --git a/config/sidekiq_queues.yml b/config/sidekiq_queues.yml index e1e8f36b663..3f84d0e0d63 100644 --- a/config/sidekiq_queues.yml +++ b/config/sidekiq_queues.yml @@ -75,4 +75,4 @@ - [pipeline_background, 1] - [repository_update_remote_mirror, 1] - [repository_remove_remote, 1] - + - [sentry, 1] |