Skip to content

Commit 2538eaa

Browse files
Merge pull request #6 from datacite/fix-sentry-issues
change to suggested sentry gems
2 parents 8d6ed7c + 53f8ee2 commit 2538eaa

File tree

5 files changed

+42
-14
lines changed

5 files changed

+42
-14
lines changed

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ gem "logstash-event", "~> 1.2", ">= 1.2.02"
1515
gem "logstash-logger", "~> 0.26.1"
1616
gem "mysql2", "~> 0.5.3"
1717
gem "dotenv"
18-
gem "sentry-raven", "~> 3.1", ">= 3.1.2"
18+
# gem "sentry-raven", "~> 3.1", ">= 3.1.2"
19+
gem "sentry-ruby"
20+
gem "sentry-rails"
1921
gem "elasticsearch", "~> 7.17", ">= 7.17.10"
2022
gem "elasticsearch-model", "~> 7.2.1", ">= 7.2.1", require: "elasticsearch/model"
2123
gem "elasticsearch-rails", "~> 7.2.1", ">= 7.2.1"

Gemfile.lock

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,12 @@ GEM
331331
rubocop (~> 1.62)
332332
ruby-progressbar (1.13.0)
333333
securerandom (0.4.1)
334-
sentry-raven (3.1.2)
335-
faraday (>= 1.0)
334+
sentry-rails (5.23.0)
335+
railties (>= 5.0)
336+
sentry-ruby (~> 5.23.0)
337+
sentry-ruby (5.23.0)
338+
bigdecimal
339+
concurrent-ruby (~> 1.0, >= 1.0.2)
336340
shoryuken (4.0.3)
337341
aws-sdk-core (>= 2)
338342
concurrent-ruby
@@ -385,7 +389,8 @@ DEPENDENCIES
385389
rubocop-rails
386390
rubocop-rspec
387391
rubocop-shopify
388-
sentry-raven (~> 3.1, >= 3.1.2)
392+
sentry-rails
393+
sentry-ruby
389394
shoryuken (~> 4.0)
390395

391396
RUBY VERSION

app/controllers/events_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
class EventsController < ApplicationController
44
def index
5+
Sentry.capture_message("events_controller test message")
56
render(json: { message: "index" })
67
end
78

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
# frozen_string_literal: true
22

3-
# Be sure to restart your server when you modify this file.
4-
5-
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
6-
# Use this to limit dissemination of sensitive information.
7-
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
83
Rails.application.config.filter_parameters += [
9-
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn,
4+
:password, :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn,
105
]

config/initializers/sentry.rb

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
11
# frozen_string_literal: true
22

3-
Raven.configure do |config|
4-
config.environments = ["stage", "production"]
3+
Sentry.init do |config|
4+
config.enabled_environments = ["stage", "production"]
55
config.dsn = ENV["SENTRY_DSN"]
66
config.release = "events:" + Events::Application::VERSION
7-
config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
8-
config.logger = Rails.application.config.lograge.logger
7+
# config.logger = Rails.application.config.lograge.logger
8+
config.send_default_pii = true
9+
10+
filter = ActiveSupport::ParameterFilter.new(Rails.application.config.filter_parameters)
11+
12+
config.before_send = lambda do |event, _hint|
13+
if event.extra
14+
event.extra = filter.filter(event.extra)
15+
end
16+
17+
if event.user
18+
event.user = filter.filter(event.user)
19+
end
20+
21+
if event.contexts
22+
event.contexts = filter.filter(event.contexts)
23+
end
24+
25+
event
26+
end
927
end
28+
# Raven.configure do |config|
29+
# config.environments = ["stage", "production"]
30+
# config.dsn = ENV["SENTRY_DSN"]
31+
# config.release = "events:" + Events::Application::VERSION
32+
# config.sanitize_fields = Rails.application.config.filter_parameters.map(&:to_s)
33+
# config.logger = Rails.application.config.lograge.logger
34+
# end

0 commit comments

Comments
 (0)