gitlab-org--gitlab-foss/lib/gitlab/sentry.rb
Stan Hu 0fe4cf2b0f Fix Sentry not reporting right program for Sidekiq workers
Moves program tag into the global configuration since this doesn't
change and since Sidekiq workers get a unique context for each event.

Closes #21410
2016-08-25 19:42:52 -07:00

27 lines
530 B
Ruby

module Gitlab
module Sentry
def self.enabled?
Rails.env.production? && current_application_settings.sentry_enabled?
end
def self.context(current_user = nil)
return unless self.enabled?
if current_user
Raven.user_context(
id: current_user.id,
email: current_user.email,
username: current_user.username,
)
end
end
def self.program_context
if Sidekiq.server?
'sidekiq'
else
'rails'
end
end
end
end