Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sentry_helper.rb « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f8cccade15b5520ffb8405d393fab7fbc34f0ea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module SentryHelper
  def sentry_enabled?
    Rails.env.production? && current_application_settings.sentry_enabled?
  end

  def sentry_context
    return unless sentry_enabled?

    if current_user
      Raven.user_context(
        id: current_user.id,
        email: current_user.email,
        username: current_user.username,
      )
    end

    Raven.tags_context(program: sentry_program_context)
  end

  def sentry_program_context
    if Sidekiq.server?
      'sidekiq'
    else
      'rails'
    end
  end
end