Skip to content

Commit c274d89

Browse files
authored
Merge pull request #2256 from broadinstitute/jb-sentry-ruby
Updating to sentry-ruby gem for error reporting (SCP-5260)
2 parents 603a367 + 0b7b337 commit c274d89

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ gem 'ruby_native_statistics'
6565
gem 'mongoid_rails_migrations'
6666
gem 'secure_headers'
6767
gem 'swagger-blocks'
68-
gem 'sentry-raven'
68+
gem 'sentry-ruby'
69+
gem "sentry-rails"
6970
gem 'rubyzip'
7071
gem 'rack-brotli'
7172
gem 'time_difference'

Gemfile.lock

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,12 @@ GEM
479479
sdoc (2.1.0)
480480
rdoc (>= 5.0)
481481
secure_headers (6.3.2)
482-
sentry-raven (3.1.2)
483-
faraday (>= 1.0)
482+
sentry-rails (5.23.0)
483+
railties (>= 5.0)
484+
sentry-ruby (~> 5.23.0)
485+
sentry-ruby (5.23.0)
486+
bigdecimal
487+
concurrent-ruby (~> 1.0, >= 1.0.2)
484488
signet (0.17.0)
485489
addressable (~> 2.8)
486490
faraday (>= 0.17.5, < 3.a)
@@ -626,7 +630,8 @@ DEPENDENCIES
626630
sass-rails (>= 6)
627631
sdoc
628632
secure_headers
629-
sentry-raven
633+
sentry-rails
634+
sentry-ruby
630635
simplecov
631636
simplecov-lcov
632637
stackprof

app/controllers/api/v1/search_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class SearchController < ApiBaseController
170170

171171
def index
172172
@viewable = Study.viewable(current_api_user)
173-
@search_type = params[:type].to_sym
173+
@search_type = params[:type]&.to_sym || :study # handle empty type
174174

175175
# filter results by branding group, if specified
176176
if @selected_branding_group.present?

config/initializers/sentry.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Sentry.init do |config|
2+
config.dsn = ENV['SENTRY_DSN']
3+
# Add data like request headers and IP for users, if applicable;
4+
# see https://docs.sentry.io/platforms/ruby/data-management/data-collected/ for more info
5+
config.send_default_pii = true
6+
end

lib/error_tracker.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def self.report_exception(exception, user, *context_objects)
77
if %w(development test).include?(Rails.env) || ENV['SENTRY_DSN'].nil?
88
Rails.logger.error "Suppressing error reporting to Sentry: #{exception.class.name}:#{exception.message}, context: #{context}"
99
else
10-
Raven.capture_exception(exception, user: {identifer: extract_user_identifier(user)}, extra: context)
10+
Sentry.capture_exception(exception, user: {identifer: extract_user_identifier(user)}, extra: context)
1111
end
1212
end
1313

test/lib/summary_stats_utils_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class SummaryStatsUtilsTest < ActiveSupport::TestCase
168168
end
169169
file_mock.expect :any?, true
170170
bucket_mock.expect :files, file_mock
171-
client_mock.expect :get_workspace_bucket, bucket_mock, [@study.bucket_id]
171+
client_mock.expect :get_workspace_bucket, bucket_mock, [String]
172172
FireCloudClient.stub :new, client_mock do
173173
SummaryStatsUtils.stub :bytes_and_last_created_for,
174174
[250.gigabytes, created_at],

test/services/study_search_service_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class StudySearchServiceTest < ActiveSupport::TestCase
1818
name: 'cell_type',
1919
type: 'group',
2020
values: [
21-
'B cell', 'amacrine cell', 'retinal cone cell'
21+
'B cell', 'amacrine cell', 'retinal cone cell', 'bipolar neuron'
2222
]
2323
}
2424
])

0 commit comments

Comments
 (0)