2016-09-29 09:46:39 +05:30
|
|
|
module Gitlab
|
|
|
|
module Sentry
|
|
|
|
def self.enabled?
|
2018-03-17 18:26:18 +05:30
|
|
|
Rails.env.production? && Gitlab::CurrentSettings.sentry_enabled?
|
2016-09-29 09:46:39 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
def self.context(current_user = nil)
|
|
|
|
return unless self.enabled?
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
Raven.tags_context(locale: I18n.locale)
|
|
|
|
|
2016-09-29 09:46:39 +05:30
|
|
|
if current_user
|
|
|
|
Raven.user_context(
|
|
|
|
id: current_user.id,
|
|
|
|
email: current_user.email,
|
2017-09-10 17:25:29 +05:30
|
|
|
username: current_user.username
|
2016-09-29 09:46:39 +05:30
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.program_context
|
|
|
|
if Sidekiq.server?
|
|
|
|
'sidekiq'
|
|
|
|
else
|
|
|
|
'rails'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|