rollbar 2.16.2 → 2.22.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +47 -0
- data/.travis.yml +182 -94
- data/Appraisals +10 -10
- data/Gemfile +45 -13
- data/README.md +20 -3
- data/Rakefile +0 -0
- data/data/rollbar.snippet.js +1 -1
- data/docs/configuration.md +15 -0
- data/gemfiles/rails30.gemfile +21 -14
- data/gemfiles/rails31.gemfile +21 -12
- data/gemfiles/rails32.gemfile +18 -8
- data/gemfiles/rails40.gemfile +18 -6
- data/gemfiles/rails41.gemfile +17 -6
- data/gemfiles/rails42.gemfile +24 -14
- data/gemfiles/rails50.gemfile +20 -11
- data/gemfiles/rails51.gemfile +20 -10
- data/gemfiles/rails52.gemfile +65 -0
- data/gemfiles/rails60.gemfile +67 -0
- data/lib/generators/rollbar/rollbar_generator.rb +1 -1
- data/lib/rails/rollbar_runner.rb +17 -2
- data/lib/rollbar.rb +2 -3
- data/lib/rollbar/capistrano.rb +71 -39
- data/lib/rollbar/capistrano3.rb +56 -1
- data/lib/rollbar/capistrano_tasks.rb +130 -0
- data/lib/rollbar/configuration.rb +95 -7
- data/lib/rollbar/delay/active_job.rb +17 -0
- data/lib/rollbar/delay/girl_friday.rb +2 -2
- data/lib/rollbar/delay/resque.rb +4 -6
- data/lib/rollbar/delay/shoryuken.rb +15 -9
- data/lib/rollbar/delay/sidekiq.rb +6 -8
- data/lib/rollbar/delay/sucker_punch.rb +17 -19
- data/lib/rollbar/delay/thread.rb +3 -3
- data/lib/rollbar/deploy.rb +90 -0
- data/lib/rollbar/encoding/encoder.rb +9 -9
- data/lib/rollbar/exception_reporter.rb +19 -5
- data/lib/rollbar/item.rb +62 -20
- data/lib/rollbar/item/backtrace.rb +4 -4
- data/lib/rollbar/item/frame.rb +7 -1
- data/lib/rollbar/item/locals.rb +56 -0
- data/lib/rollbar/json.rb +5 -51
- data/lib/rollbar/language_support.rb +4 -20
- data/lib/rollbar/lazy_store.rb +5 -5
- data/lib/rollbar/logger.rb +1 -0
- data/lib/rollbar/logger_proxy.rb +15 -2
- data/lib/rollbar/middleware/js.rb +110 -10
- data/lib/rollbar/middleware/js/json_value.rb +26 -0
- data/lib/rollbar/middleware/rack.rb +4 -1
- data/lib/rollbar/middleware/rails/rollbar.rb +10 -1
- data/lib/rollbar/notifier.rb +118 -49
- data/lib/rollbar/notifier/trace_with_bindings.rb +65 -0
- data/lib/rollbar/plugin.rb +54 -6
- data/lib/rollbar/plugins.rb +7 -1
- data/lib/rollbar/plugins/active_job.rb +5 -1
- data/lib/rollbar/plugins/basic_socket.rb +21 -6
- data/lib/rollbar/plugins/delayed_job/job_data.rb +3 -3
- data/lib/rollbar/plugins/delayed_job/plugin.rb +3 -3
- data/lib/rollbar/plugins/goalie.rb +11 -3
- data/lib/rollbar/plugins/rails/controller_methods.rb +17 -4
- data/lib/rollbar/plugins/rails/railtie_mixin.rb +7 -3
- data/lib/rollbar/plugins/rake.rb +2 -2
- data/lib/rollbar/plugins/sidekiq/plugin.rb +10 -6
- data/lib/rollbar/rake_tasks.rb +3 -86
- data/lib/rollbar/request_data_extractor.rb +35 -21
- data/lib/rollbar/rollbar_test.rb +147 -0
- data/lib/rollbar/scrubbers.rb +7 -3
- data/lib/rollbar/scrubbers/params.rb +38 -20
- data/lib/rollbar/scrubbers/url.rb +27 -13
- data/lib/rollbar/truncation.rb +9 -2
- data/lib/rollbar/truncation/min_body_strategy.rb +2 -3
- data/lib/rollbar/truncation/remove_any_key_strategy.rb +123 -0
- data/lib/rollbar/truncation/remove_extra_strategy.rb +35 -0
- data/lib/rollbar/truncation/remove_request_strategy.rb +21 -0
- data/lib/rollbar/truncation/strings_strategy.rb +3 -4
- data/lib/rollbar/util.rb +75 -45
- data/lib/rollbar/util/hash.rb +30 -6
- data/lib/rollbar/util/ip_anonymizer.rb +8 -7
- data/lib/rollbar/util/ip_obfuscator.rb +1 -1
- data/lib/rollbar/version.rb +1 -1
- data/lib/tasks/benchmark.rake +103 -0
- data/rollbar.gemspec +14 -8
- metadata +25 -277
- data/gemfiles/ruby_1_8_and_1_9_2.gemfile +0 -49
- data/lib/rollbar/json/default.rb +0 -11
- data/lib/rollbar/json/oj.rb +0 -16
- data/lib/rollbar/tasks/rollbar.cap +0 -47
- data/spec/cacert.pem +0 -3988
- data/spec/controllers/home_controller_spec.rb +0 -480
- data/spec/delay/sidekiq_spec.rb +0 -61
- data/spec/delay/sucker_punch_spec.rb +0 -25
- data/spec/delayed/backend/test.rb +0 -140
- data/spec/delayed/serialization/test.rb +0 -0
- data/spec/dummyapp/.gitignore +0 -73
- data/spec/dummyapp/Rakefile +0 -7
- data/spec/dummyapp/app/assets/javascripts/application.js +0 -3
- data/spec/dummyapp/app/assets/stylesheets/application.css.scss +0 -37
- data/spec/dummyapp/app/controllers/application_controller.rb +0 -3
- data/spec/dummyapp/app/controllers/home_controller.rb +0 -60
- data/spec/dummyapp/app/controllers/users_controller.rb +0 -17
- data/spec/dummyapp/app/helpers/.gitkeep +0 -0
- data/spec/dummyapp/app/mailers/.gitkeep +0 -0
- data/spec/dummyapp/app/models/.gitkeep +0 -0
- data/spec/dummyapp/app/models/book.rb +0 -5
- data/spec/dummyapp/app/models/post.rb +0 -9
- data/spec/dummyapp/app/models/user.rb +0 -9
- data/spec/dummyapp/app/views/devise/registrations/edit.html.erb +0 -27
- data/spec/dummyapp/app/views/devise/registrations/new.html.erb +0 -20
- data/spec/dummyapp/app/views/devise/shared/_links.html.erb +0 -25
- data/spec/dummyapp/app/views/home/cause_exception.html.erb +0 -1
- data/spec/dummyapp/app/views/home/index.html.erb +0 -4
- data/spec/dummyapp/app/views/home/report_exception.html.erb +0 -1
- data/spec/dummyapp/app/views/js/test.html.erb +0 -1
- data/spec/dummyapp/app/views/layouts/_messages.html.erb +0 -5
- data/spec/dummyapp/app/views/layouts/_navigation.html.erb +0 -21
- data/spec/dummyapp/app/views/layouts/application.html.erb +0 -25
- data/spec/dummyapp/app/views/layouts/simple.html.erb +0 -18
- data/spec/dummyapp/app/views/users/index.html.erb +0 -8
- data/spec/dummyapp/app/views/users/show.html.erb +0 -3
- data/spec/dummyapp/config.ru +0 -4
- data/spec/dummyapp/config/application.rb +0 -59
- data/spec/dummyapp/config/boot.rb +0 -10
- data/spec/dummyapp/config/database.yml +0 -25
- data/spec/dummyapp/config/environment.rb +0 -5
- data/spec/dummyapp/config/environments/development.rb +0 -37
- data/spec/dummyapp/config/environments/production.rb +0 -67
- data/spec/dummyapp/config/environments/test.rb +0 -37
- data/spec/dummyapp/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/dummyapp/config/initializers/inflections.rb +0 -15
- data/spec/dummyapp/config/initializers/mime_types.rb +0 -5
- data/spec/dummyapp/config/initializers/rollbar.rb +0 -26
- data/spec/dummyapp/config/initializers/secret_token.rb +0 -7
- data/spec/dummyapp/config/initializers/session_store.rb +0 -8
- data/spec/dummyapp/config/initializers/wrap_parameters.rb +0 -16
- data/spec/dummyapp/config/locales/devise.en.yml +0 -58
- data/spec/dummyapp/config/locales/en.yml +0 -5
- data/spec/dummyapp/config/routes.rb +0 -17
- data/spec/dummyapp/config/secrets.yml +0 -2
- data/spec/dummyapp/db/migrate/20121121184652_devise_create_users.rb +0 -46
- data/spec/dummyapp/db/migrate/20121121184654_add_name_to_users.rb +0 -5
- data/spec/dummyapp/db/migrate/20161219184410_create_books.rb +0 -10
- data/spec/dummyapp/db/migrate/20161219185529_add_username_to_users.rb +0 -5
- data/spec/dummyapp/db/schema.rb +0 -41
- data/spec/dummyapp/db/seeds.rb +0 -12
- data/spec/dummyapp/lib/assets/.gitkeep +0 -0
- data/spec/dummyapp/public/404.html +0 -26
- data/spec/dummyapp/public/422.html +0 -26
- data/spec/dummyapp/public/500.html +0 -25
- data/spec/dummyapp/public/favicon.ico +0 -0
- data/spec/dummyapp/script/rails +0 -6
- data/spec/fixtures/file1 +0 -1
- data/spec/fixtures/file2 +0 -1
- data/spec/fixtures/payloads/message.json +0 -25
- data/spec/fixtures/payloads/sample.trace.json +0 -275
- data/spec/fixtures/payloads/sample.trace_chain.json +0 -530
- data/spec/fixtures/plugins/dummy1.rb +0 -5
- data/spec/fixtures/plugins/dummy2.rb +0 -5
- data/spec/generators/rollbar/rollbar_generator_rails30_spec.rb +0 -31
- data/spec/generators/rollbar/rollbar_generator_spec.rb +0 -51
- data/spec/requests/home_spec.rb +0 -49
- data/spec/rollbar/configuration_spec.rb +0 -46
- data/spec/rollbar/delay/delayed_job_spec.rb +0 -22
- data/spec/rollbar/delay/girl_friday_spec.rb +0 -41
- data/spec/rollbar/delay/resque_spec.rb +0 -37
- data/spec/rollbar/delay/thread_spec.rb +0 -27
- data/spec/rollbar/encoding/encoder_spec.rb +0 -63
- data/spec/rollbar/item/backtrace_spec.rb +0 -26
- data/spec/rollbar/item/frame_spec.rb +0 -267
- data/spec/rollbar/item_spec.rb +0 -736
- data/spec/rollbar/json/oj_spec.rb +0 -18
- data/spec/rollbar/json_spec.rb +0 -110
- data/spec/rollbar/lazy_store_spec.rb +0 -99
- data/spec/rollbar/logger_proxy_spec.rb +0 -50
- data/spec/rollbar/logger_spec.rb +0 -124
- data/spec/rollbar/middleware/js_spec.rb +0 -421
- data/spec/rollbar/middleware/sinatra_spec.rb +0 -197
- data/spec/rollbar/notifier_spec.rb +0 -56
- data/spec/rollbar/plugin_spec.rb +0 -209
- data/spec/rollbar/plugins/active_job_spec.rb +0 -38
- data/spec/rollbar/plugins/delayed_job/job_data_spec.rb +0 -48
- data/spec/rollbar/plugins/delayed_job_spec.rb +0 -129
- data/spec/rollbar/plugins/rack_spec.rb +0 -152
- data/spec/rollbar/plugins/rails_js_spec.rb +0 -19
- data/spec/rollbar/plugins/rake_spec.rb +0 -34
- data/spec/rollbar/plugins/resque/failure_spec.rb +0 -36
- data/spec/rollbar/plugins/sidekiq_spec.rb +0 -171
- data/spec/rollbar/plugins/validations_spec.rb +0 -56
- data/spec/rollbar/plugins_spec.rb +0 -68
- data/spec/rollbar/request_data_extractor_spec.rb +0 -270
- data/spec/rollbar/scrubbers/params_spec.rb +0 -314
- data/spec/rollbar/scrubbers/url_spec.rb +0 -136
- data/spec/rollbar/scrubbers_spec.rb +0 -31
- data/spec/rollbar/sidekig/clear_scope_spec.rb +0 -19
- data/spec/rollbar/truncation/frames_strategy_spec.rb +0 -70
- data/spec/rollbar/truncation/min_body_strategy_spec.rb +0 -57
- data/spec/rollbar/truncation/strings_strategy_spec.rb +0 -89
- data/spec/rollbar/truncation_spec.rb +0 -27
- data/spec/rollbar/util/hash_spec.rb +0 -22
- data/spec/rollbar/util/ip_anonymizer_spec.rb +0 -30
- data/spec/rollbar/util_spec.rb +0 -80
- data/spec/rollbar_bc_spec.rb +0 -380
- data/spec/rollbar_spec.rb +0 -1667
- data/spec/spec_helper.rb +0 -84
- data/spec/support/cause_exception.rb +0 -1
- data/spec/support/encoding_helpers.rb +0 -8
- data/spec/support/encodings/iso_8859_9 +0 -1
- data/spec/support/fixture_helpers.rb +0 -10
- data/spec/support/get_ip_raising.rb +0 -7
- data/spec/support/helpers.rb +0 -5
- data/spec/support/matchers.rb +0 -23
- data/spec/support/notifier_helpers.rb +0 -57
- data/spec/support/rollbar_api.rb +0 -57
- data/spec/support/shared_contexts.rb +0 -12
data/lib/rollbar/plugin.rb
CHANGED
@@ -7,6 +7,8 @@ module Rollbar
|
|
7
7
|
attr_reader :name
|
8
8
|
attr_reader :dependencies
|
9
9
|
attr_reader :callables
|
10
|
+
attr_reader :revert_callables
|
11
|
+
attr_accessor :on_demand
|
10
12
|
attr_accessor :loaded
|
11
13
|
|
12
14
|
private :loaded=
|
@@ -15,31 +17,73 @@ module Rollbar
|
|
15
17
|
@name = name
|
16
18
|
@dependencies = []
|
17
19
|
@callables = []
|
20
|
+
@revert_callables = []
|
18
21
|
@loaded = false
|
22
|
+
@on_demand = false
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_on_demand
|
26
|
+
@on_demand = true
|
19
27
|
end
|
20
28
|
|
21
29
|
def configuration
|
22
30
|
Rollbar.configuration
|
23
31
|
end
|
24
32
|
|
33
|
+
def load_scoped!(transparent = false)
|
34
|
+
if transparent
|
35
|
+
load! if load?
|
36
|
+
|
37
|
+
result = yield
|
38
|
+
|
39
|
+
unload! if loaded
|
40
|
+
else
|
41
|
+
return unless load?
|
42
|
+
|
43
|
+
load!
|
44
|
+
|
45
|
+
result = yield
|
46
|
+
|
47
|
+
unload!
|
48
|
+
end
|
49
|
+
|
50
|
+
result
|
51
|
+
end
|
52
|
+
|
25
53
|
def load!
|
26
54
|
return unless load?
|
27
55
|
|
28
56
|
begin
|
29
57
|
callables.each(&:call)
|
30
|
-
rescue => e
|
58
|
+
rescue StandardError => e
|
31
59
|
log_loading_error(e)
|
32
60
|
ensure
|
33
61
|
self.loaded = true
|
34
62
|
end
|
35
63
|
end
|
36
64
|
|
65
|
+
def unload!
|
66
|
+
return unless loaded
|
67
|
+
|
68
|
+
begin
|
69
|
+
revert_callables.each(&:call)
|
70
|
+
rescue StandardError => e
|
71
|
+
log_unloading_error(e)
|
72
|
+
ensure
|
73
|
+
self.loaded = false
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
37
77
|
def execute(&block)
|
38
78
|
callables << block
|
39
79
|
end
|
40
80
|
|
41
|
-
def execute!
|
42
|
-
|
81
|
+
def execute!
|
82
|
+
yield if load?
|
83
|
+
end
|
84
|
+
|
85
|
+
def revert(&block)
|
86
|
+
revert_callables << block
|
43
87
|
end
|
44
88
|
|
45
89
|
private
|
@@ -61,7 +105,7 @@ module Rollbar
|
|
61
105
|
|
62
106
|
def load?
|
63
107
|
!loaded && dependencies_satisfy?
|
64
|
-
rescue => e
|
108
|
+
rescue StandardError => e
|
65
109
|
log_loading_error(e)
|
66
110
|
|
67
111
|
false
|
@@ -71,8 +115,12 @@ module Rollbar
|
|
71
115
|
dependencies.all?(&:call)
|
72
116
|
end
|
73
117
|
|
74
|
-
def log_loading_error(
|
75
|
-
Rollbar.log_error("Error trying to load plugin '#{name}': #{
|
118
|
+
def log_loading_error(error)
|
119
|
+
Rollbar.log_error("Error trying to load plugin '#{name}': #{error.class}, #{error.message}")
|
120
|
+
end
|
121
|
+
|
122
|
+
def log_unloading_error(error)
|
123
|
+
Rollbar.log_error("Error trying to unload plugin '#{name}': #{error.class}, #{error.message}")
|
76
124
|
end
|
77
125
|
end
|
78
126
|
end
|
data/lib/rollbar/plugins.rb
CHANGED
@@ -6,9 +6,13 @@ module Rollbar
|
|
6
6
|
Rollbar.error(exception,
|
7
7
|
:job => self.class.name,
|
8
8
|
:job_id => job_id,
|
9
|
-
:use_exception_level_filters => true
|
9
|
+
:use_exception_level_filters => true,
|
10
|
+
:arguments => arguments)
|
10
11
|
raise exception
|
11
12
|
end
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
16
|
+
|
17
|
+
# Automatically add to ActionMailer::DeliveryJob
|
18
|
+
ActionMailer::DeliveryJob.send(:include, Rollbar::ActiveJob) if defined?(ActionMailer::DeliveryJob)
|
@@ -1,16 +1,31 @@
|
|
1
1
|
Rollbar.plugins.define('basic_socket') do
|
2
|
+
load_on_demand
|
3
|
+
|
2
4
|
dependency { !configuration.disable_core_monkey_patch }
|
3
5
|
|
4
6
|
# Needed to avoid active_support (< 4.1.0) bug serializing JSONs
|
5
|
-
dependency
|
7
|
+
dependency do
|
8
|
+
defined?(ActiveSupport::VERSION::STRING) &&
|
9
|
+
Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new('4.1.0')
|
10
|
+
end
|
6
11
|
|
7
12
|
execute do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
+
class BasicSocket # :nodoc:
|
14
|
+
def new_as_json(_options = nil)
|
15
|
+
{
|
16
|
+
:value => inspect
|
17
|
+
}
|
13
18
|
end
|
19
|
+
# alias_method is recommended over alias when aliasing at runtime.
|
20
|
+
# https://github.com/rubocop-hq/ruby-style-guide#alias-method
|
21
|
+
alias_method :original_as_json, :as_json # rubocop:disable Style/Alias
|
22
|
+
alias_method :as_json, :new_as_json # rubocop:disable Style/Alias
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
revert do
|
27
|
+
class BasicSocket # :nodoc:
|
28
|
+
alias_method :as_json, :original_as_json # rubocop:disable Style/Alias
|
14
29
|
end
|
15
30
|
end
|
16
31
|
end
|
@@ -10,7 +10,7 @@ module Rollbar
|
|
10
10
|
def to_hash
|
11
11
|
job_data = extract_job_data
|
12
12
|
|
13
|
-
handler_parent = job_data['job']
|
13
|
+
handler_parent = job_data['job'] || job_data
|
14
14
|
handler_parent['handler'] = handler_data
|
15
15
|
|
16
16
|
job_data
|
@@ -32,7 +32,7 @@ module Rollbar
|
|
32
32
|
return payload_object unless payload_object.respond_to?(:object)
|
33
33
|
|
34
34
|
object_data(payload_object.object)
|
35
|
-
rescue
|
35
|
+
rescue StandardError
|
36
36
|
{}
|
37
37
|
end
|
38
38
|
|
@@ -42,7 +42,7 @@ module Rollbar
|
|
42
42
|
:args => job.payload_object.args,
|
43
43
|
:object => object.is_a?(Class) ? object.name : object.to_s
|
44
44
|
}
|
45
|
-
rescue
|
45
|
+
rescue StandardError
|
46
46
|
{}
|
47
47
|
end
|
48
48
|
end
|
@@ -9,10 +9,10 @@ module Rollbar
|
|
9
9
|
|
10
10
|
class RollbarPlugin < ::Delayed::Plugin
|
11
11
|
callbacks do |lifecycle|
|
12
|
-
lifecycle.around(:invoke_job, &Delayed
|
12
|
+
lifecycle.around(:invoke_job, &Delayed.invoke_job_callback)
|
13
13
|
lifecycle.after(:failure) do |_, job, _, _|
|
14
14
|
data = Rollbar::Delayed.build_job_data(job)
|
15
|
-
::Rollbar.scope(:request => data).error(job.last_error, :use_exception_level_filters => true) if job.last_error
|
15
|
+
::Rollbar.scope(:request => data).error("Job has failed and won't be retried anymore: " + job.last_error, :use_exception_level_filters => true) if job.last_error
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
@@ -37,7 +37,7 @@ module Rollbar
|
|
37
37
|
proc do |job, *args, &block|
|
38
38
|
begin
|
39
39
|
block.call(job, *args)
|
40
|
-
rescue => e
|
40
|
+
rescue StandardError => e
|
41
41
|
report(e, job)
|
42
42
|
|
43
43
|
raise e
|
@@ -10,10 +10,18 @@ Rollbar.plugins.define('goalie') do
|
|
10
10
|
|
11
11
|
begin
|
12
12
|
controller = env['action_controller.instance']
|
13
|
-
request_data =
|
14
|
-
|
13
|
+
request_data = begin
|
14
|
+
controller.rollbar_request_data
|
15
|
+
rescue StandardError
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
person_data = begin
|
19
|
+
controller.rollbar_person_data
|
20
|
+
rescue StandardError
|
21
|
+
nil
|
22
|
+
end
|
15
23
|
exception_data = Rollbar.scope(:request => request_data, :person => person_data).error(exception, :use_exception_level_filters => true)
|
16
|
-
rescue => e
|
24
|
+
rescue StandardError => e
|
17
25
|
Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e}"
|
18
26
|
end
|
19
27
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rollbar/request_data_extractor'
|
2
|
+
require 'rollbar/util'
|
2
3
|
|
3
4
|
module Rollbar
|
4
5
|
module Rails
|
@@ -6,13 +7,25 @@ module Rollbar
|
|
6
7
|
include RequestDataExtractor
|
7
8
|
|
8
9
|
def rollbar_person_data
|
9
|
-
user = send(Rollbar.configuration.person_method)
|
10
|
+
(user = send(Rollbar.configuration.person_method)) unless Rollbar::Util.method_in_stack_twice(:rollbar_person_data, __FILE__)
|
10
11
|
# include id, username, email if non-empty
|
11
12
|
if user
|
12
13
|
{
|
13
|
-
:id => (
|
14
|
-
|
15
|
-
|
14
|
+
:id => (begin
|
15
|
+
user.send(Rollbar.configuration.person_id_method)
|
16
|
+
rescue StandardError
|
17
|
+
nil
|
18
|
+
end),
|
19
|
+
:username => (begin
|
20
|
+
user.send(Rollbar.configuration.person_username_method)
|
21
|
+
rescue StandardError
|
22
|
+
nil
|
23
|
+
end),
|
24
|
+
:email => (begin
|
25
|
+
user.send(Rollbar.configuration.person_email_method)
|
26
|
+
rescue StandardError
|
27
|
+
nil
|
28
|
+
end)
|
16
29
|
}
|
17
30
|
else
|
18
31
|
{}
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'rollbar'
|
2
|
-
|
3
1
|
module Rollbar
|
4
2
|
module RailtieMixin
|
5
3
|
extend ActiveSupport::Concern
|
@@ -16,7 +14,13 @@ module Rollbar
|
|
16
14
|
config.environment ||= ::Rails.env
|
17
15
|
config.root ||= ::Rails.root
|
18
16
|
config.framework = "Rails: #{::Rails::VERSION::STRING}"
|
19
|
-
config.filepath ||=
|
17
|
+
config.filepath ||= begin
|
18
|
+
if ::Rails.application.class.respond_to?(:module_parent_name)
|
19
|
+
::Rails.application.class.module_parent_name + '.rollbar'
|
20
|
+
else
|
21
|
+
::Rails.application.class.parent_name + '.rollbar'
|
22
|
+
end
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/rollbar/plugins/rake.rb
CHANGED
@@ -2,10 +2,10 @@ require 'rollbar/scrubbers/params'
|
|
2
2
|
|
3
3
|
module Rollbar
|
4
4
|
class Sidekiq
|
5
|
-
PARAM_BLACKLIST = %w[backtrace error_backtrace error_message error_class]
|
5
|
+
PARAM_BLACKLIST = %w[backtrace error_backtrace error_message error_class].freeze
|
6
6
|
|
7
7
|
class ClearScope
|
8
|
-
def call(
|
8
|
+
def call(_worker, _msg, _queue)
|
9
9
|
Rollbar.reset_notifier!
|
10
10
|
|
11
11
|
yield
|
@@ -38,12 +38,16 @@ module Rollbar
|
|
38
38
|
Rollbar::Scrubbers::Params.call(options)
|
39
39
|
end
|
40
40
|
|
41
|
-
def self.skip_report?(job_hash,
|
42
|
-
|
43
|
-
|
41
|
+
def self.skip_report?(job_hash, _e)
|
42
|
+
return false if job_hash.nil?
|
43
|
+
|
44
|
+
# when rollbar middleware catches, sidekiq's retry_job processor hasn't set
|
45
|
+
# the retry_count for the current job yet, so adding 1 gives the actual retry count
|
46
|
+
actual_retry_count = job_hash.fetch('retry_count', -1) + 1
|
47
|
+
job_hash['retry'] && actual_retry_count < ::Rollbar.configuration.sidekiq_threshold
|
44
48
|
end
|
45
49
|
|
46
|
-
def call(
|
50
|
+
def call(_worker, msg, _queue)
|
47
51
|
Rollbar.reset_notifier!
|
48
52
|
|
49
53
|
yield
|
data/lib/rollbar/rake_tasks.rb
CHANGED
@@ -1,93 +1,10 @@
|
|
1
|
-
require 'rollbar'
|
2
|
-
begin
|
3
|
-
require 'rack/mock'
|
4
|
-
rescue LoadError
|
5
|
-
end
|
6
|
-
require 'logger'
|
7
1
|
|
8
2
|
namespace :rollbar do
|
9
3
|
desc 'Verify your gem installation by sending a test exception to Rollbar'
|
10
4
|
task :test => [:environment] do
|
11
|
-
|
12
|
-
|
13
|
-
ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
|
14
|
-
else
|
15
|
-
Logger.new(STDOUT)
|
16
|
-
end
|
17
|
-
|
18
|
-
Rails.logger.level = Logger::DEBUG
|
19
|
-
Rollbar.preconfigure do |config|
|
20
|
-
config.logger = Rails.logger
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
class RollbarTestingException < RuntimeError; end
|
25
|
-
|
26
|
-
unless Rollbar.configuration.access_token
|
27
|
-
puts 'Rollbar needs an access token configured. Check the README for instructions.'
|
28
|
-
|
29
|
-
exit
|
30
|
-
end
|
31
|
-
|
32
|
-
puts 'Testing manual report...'
|
33
|
-
Rollbar.error('Test error from rollbar:test')
|
34
|
-
|
35
|
-
# Module to inject into the Rails controllers or
|
36
|
-
# rack apps
|
37
|
-
module RollbarTest
|
38
|
-
def test_rollbar
|
39
|
-
puts 'Raising RollbarTestingException to simulate app failure.'
|
40
|
-
|
41
|
-
raise RollbarTestingException.new, 'Testing rollbar with "rake rollbar:test". If you can see this, it works.'
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
if defined?(Rack::MockRequest)
|
46
|
-
if defined?(Rails)
|
47
|
-
puts 'Setting up the controller.'
|
48
|
-
|
49
|
-
class RollbarTestController < ActionController::Base
|
50
|
-
include RollbarTest
|
51
|
-
|
52
|
-
def verify
|
53
|
-
test_rollbar
|
54
|
-
end
|
55
|
-
|
56
|
-
def logger
|
57
|
-
nil
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
Rails.application.routes_reloader.execute_if_updated
|
62
|
-
Rails.application.routes.draw do
|
63
|
-
get 'verify' => 'rollbar_test#verify', :as => 'verify'
|
64
|
-
end
|
65
|
-
|
66
|
-
# from http://stackoverflow.com/questions/5270835/authlogic-activation-problems
|
67
|
-
if defined? Authlogic
|
68
|
-
Authlogic::Session::Base.controller = Authlogic::ControllerAdapters::RailsAdapter.new(self)
|
69
|
-
end
|
70
|
-
|
71
|
-
protocol = (defined? Rails.application.config.force_ssl && Rails.application.config.force_ssl) ? 'https' : 'http'
|
72
|
-
app = Rails.application
|
73
|
-
else
|
74
|
-
protocol = 'http'
|
75
|
-
app = Class.new do
|
76
|
-
include RollbarTest
|
77
|
-
|
78
|
-
def self.call(_env)
|
79
|
-
new.test_rollbar
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
puts 'Processing...'
|
85
|
-
env = Rack::MockRequest.env_for("#{protocol}://www.example.com/verify")
|
86
|
-
status, = app.call(env)
|
5
|
+
rollbar_dir = Gem.loaded_specs['rollbar'].full_gem_path
|
6
|
+
require "#{rollbar_dir}/lib/rollbar/rollbar_test"
|
87
7
|
|
88
|
-
|
89
|
-
puts 'Test failed! You may have a configuration issue, or you could be using a gem that\'s blocking the test. Contact support@rollbar.com if you need help troubleshooting.'
|
90
|
-
end
|
91
|
-
end
|
8
|
+
RollbarTest.run
|
92
9
|
end
|
93
10
|
end
|