debian-mirror-gitlab/lib/gitlab/sentry.rb

28 lines
529 B
Ruby
Raw Normal View History

2016-09-29 09:46:39 +05:30
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,
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