Skip to content

Commit ade2b79

Browse files
committed
use Sentry instead of new relic for error tracking
1 parent 0b051b2 commit ade2b79

File tree

5 files changed

+40
-66
lines changed

5 files changed

+40
-66
lines changed

Gemfile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,16 @@ group :development do
134134
gem 'rack-mini-profiler'
135135
gem 'memory_profiler'
136136
gem 'flamegraph'
137-
gem 'stackprof'
138137
gem 'bundler-audit'
139138
end
140139

140+
group :development, :production do
141+
# Profiling / error tracking
142+
gem "stackprof"
143+
gem "sentry-ruby"
144+
gem "sentry-rails"
145+
end
146+
141147
group :worker do
142148
# These gems are only used in workers (and just so happen to slow down app startup
143149
# by quite a bit), so we exclude them from all groups other than RAILS_GROUPS=worker.

Gemfile.lock

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,7 @@ GEM
12701270
multi_json (~> 1)
12711271
statsd-ruby (~> 1.1)
12721272
bcrypt (3.1.18)
1273+
bigdecimal (3.1.9)
12731274
bindex (0.8.1)
12741275
binding_of_caller (1.0.0)
12751276
debug_inspector (>= 0.0.1)
@@ -1475,7 +1476,6 @@ GEM
14751476
net-smtp (0.3.3)
14761477
net-protocol
14771478
netrc (0.11.0)
1478-
newrelic_rpm (9.2.0)
14791479
nio4r (2.5.9)
14801480
nokogiri (1.16.6)
14811481
mini_portile2 (~> 2.8.2)
@@ -1616,6 +1616,12 @@ GEM
16161616
rubyzip (>= 1.2.2, < 3.0)
16171617
websocket (~> 1.0)
16181618
semantic_range (3.0.0)
1619+
sentry-rails (5.23.0)
1620+
railties (>= 5.0)
1621+
sentry-ruby (~> 5.23.0)
1622+
sentry-ruby (5.23.0)
1623+
bigdecimal
1624+
concurrent-ruby (~> 1.0, >= 1.0.2)
16191625
sidekiq (6.5.5)
16201626
connection_pool (>= 2.2.2)
16211627
rack (~> 2.0)
@@ -1733,7 +1739,6 @@ DEPENDENCIES
17331739
memory_profiler
17341740
meta-tags
17351741
mini_racer (~> 0.6.3)
1736-
newrelic_rpm
17371742
onebox!
17381743
paperclip
17391744
paranoia
@@ -1754,6 +1759,8 @@ DEPENDENCIES
17541759
rmagick
17551760
sass-rails
17561761
selenium-webdriver
1762+
sentry-rails
1763+
sentry-ruby
17571764
serendipitous!
17581765
sidekiq
17591766
slack-notifier

app/views/layouts/application.html.erb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<html lang="en">
33
<head>
44
<%= render 'layouts/common_head' %>
5-
</head>
5+
<%= Sentry.get_trace_propagation_meta.html_safe %>
6+
</head>
67
<body data-in-app="true"
78
class="<%= controller_name %> <%= action_name %> <%= 'has-fixed-sidenav' if user_signed_in? %> <%= 'dark' if user_signed_in? && current_user.dark_mode_enabled? %>"
89
>

config/initializers/old_rails_admin.rb

Lines changed: 0 additions & 62 deletions
This file was deleted.

config/initializers/sentry.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Sentry.init do |config|
2+
config.dsn = ENV['SENTRY_DSN']
3+
config.breadcrumbs_logger = [:active_support_logger, :http_logger]
4+
5+
# Add data like request headers and IP for users,
6+
# see https://docs.sentry.io/platforms/ruby/data-management/data-collected/ for more info
7+
config.send_default_pii = true
8+
9+
# Set traces_sample_rate to 1.0 to capture 100%
10+
# of transactions for tracing.
11+
# We recommend adjusting this value in production.
12+
config.traces_sample_rate = 1.0
13+
# or
14+
config.traces_sampler = lambda do |context|
15+
true
16+
end
17+
# Set profiles_sample_rate to profile 100%
18+
# of sampled transactions.
19+
# We recommend adjusting this value in production.
20+
config.profiles_sample_rate = 1.0
21+
end
22+
# frozen_string_literal: true

0 commit comments

Comments
 (0)