Skip to content

Commit f3f7a54

Browse files
authored
Merge pull request #13 from fastruby/sentry
Add integration to Sentry
2 parents 38b523f + 64d0749 commit f3f7a54

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

Gemfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,8 @@ group :test do
7777
gem "capybara"
7878
gem "selenium-webdriver"
7979
end
80+
81+
group :production do
82+
gem "sentry-ruby"
83+
gem "sentry-rails"
84+
end

Gemfile.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,12 @@ GEM
374374
rexml (~> 3.2, >= 3.2.5)
375375
rubyzip (>= 1.2.2, < 3.0)
376376
websocket (~> 1.0)
377+
sentry-rails (5.26.0)
378+
railties (>= 5.0)
379+
sentry-ruby (~> 5.26.0)
380+
sentry-ruby (5.26.0)
381+
bigdecimal
382+
concurrent-ruby (~> 1.0, >= 1.0.2)
377383
sidekiq (7.3.9)
378384
base64
379385
connection_pool (>= 2.3.0)
@@ -489,6 +495,8 @@ DEPENDENCIES
489495
rails (~> 8.0.2)
490496
rubocop-rails-omakase
491497
selenium-webdriver
498+
sentry-rails
499+
sentry-ruby
492500
sidekiq
493501
sidekiq-scheduler
494502
slack-ruby-block-kit (>= 0.24.0)

app/views/layouts/application.html.erb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
<%# Includes all stylesheet files in app/assets/stylesheets %>
1717
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
1818
<%= javascript_importmap_tags %>
19+
<% if Rails.env.production? %>
20+
<%= Sentry.get_trace_propagation_meta.html_safe %>
21+
<% end %>
1922
</head>
2023

2124
<body>
@@ -28,7 +31,7 @@
2831
<% end %>
2932
</div>
3033
<% end %>
31-
34+
3235
<%= yield %>
3336
</body>
3437
</html>

config/initializers/sentry.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# frozen_string_literal: true
2+
3+
if Rails.env.production?
4+
Sentry.init do |config|
5+
config.breadcrumbs_logger = [ :active_support_logger ]
6+
config.dsn = ENV["SENTRY_DSN"]
7+
config.traces_sample_rate = 1.0
8+
end
9+
end

0 commit comments

Comments
 (0)