Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup Sentry #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ group :production do
gem 'dalli'
gem 'sendgrid-ruby'
gem 'lograge'
gem "sentry-rails"
gem 'sentry-raven'
gem "sentry-ruby"
gem "sentry-sidekiq"
gem 'sidekiq'
gem 'rails_autoscale_agent'
gem 'scout_apm'
gem "stackprof"
gem 'rexml'
end
14 changes: 14 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,17 @@ GEM
semantic_range (3.0.0)
sendgrid-ruby (6.7.0)
ruby_http_client (~> 3.4)
sentry-rails (5.19.0)
railties (>= 5.0)
sentry-ruby (~> 5.19.0)
sentry-raven (3.1.2)
faraday (>= 1.0)
sentry-ruby (5.19.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
sentry-sidekiq (5.19.0)
sentry-ruby (~> 5.19.0)
sidekiq (>= 3.0)
shakapacker (7.1.0)
activesupport (>= 5.2)
rack-proxy (>= 0.6.1)
Expand Down Expand Up @@ -806,6 +815,7 @@ GEM
spring-watcher-listen (2.1.0)
listen (>= 2.7, < 4.0)
spring (>= 4)
stackprof (0.2.26)
statsd-ruby (1.5.0)
stringio (3.1.1)
temple (0.10.3)
Expand Down Expand Up @@ -898,8 +908,12 @@ DEPENDENCIES
rspec-rails
scout_apm
sendgrid-ruby
sentry-rails
sentry-raven
sentry-ruby
sentry-sidekiq
sidekiq
stackprof
web-console
wkhtmltopdf-binary (= 0.12.6.6)

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/decidim_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class DecidimController < ApplicationController
private

def set_raven_context
return unless Rails.application.secrets.sentry_enabled?
return unless Rails.application.secrets.sentry_enabled
Raven.user_context({id: try(:current_user).try(:id)}.merge(session))
Raven.extra_context(params: params.to_unsafe_h, url: request.url)
end
Expand Down
10 changes: 10 additions & 0 deletions config/initializers/sentry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# frozen_string_literal: true

if Rails.application.secrets.sentry_enabled
Sentry.init do |config|
config.dsn = ENV.fetch("SENTRY_DSN", nil)
config.traces_sample_rate = ENV.fetch("SENTRY_TRACES_SAMPLE_RATE", "0.5").to_f
config.profiles_sample_rate = ENV.fetch("SENTRY_PROFILES_SAMPLE_RATE", "0.5").to_f
config.environment = ENV["HEROKU_APP_NAME"].presence || "production"
end
end
Loading