rollbar 3.2.0 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +81 -34
- data/Gemfile +8 -8
- data/gemfiles/rails30.gemfile +10 -12
- data/gemfiles/rails31.gemfile +10 -12
- data/gemfiles/rails32.gemfile +3 -5
- data/gemfiles/rails40.gemfile +2 -4
- data/gemfiles/rails41.gemfile +2 -5
- data/gemfiles/rails42.gemfile +4 -9
- data/gemfiles/rails50.gemfile +7 -9
- data/gemfiles/rails51.gemfile +6 -8
- data/gemfiles/rails52.gemfile +5 -5
- data/gemfiles/rails60.gemfile +3 -4
- data/gemfiles/rails61.gemfile +3 -3
- data/lib/generators/rollbar/rollbar_generator.rb +18 -14
- data/lib/generators/rollbar/templates/{initializer.rb → initializer.erb} +0 -0
- data/lib/rails/rollbar_runner.rb +12 -5
- data/lib/rollbar/capistrano.rb +16 -8
- data/lib/rollbar/capistrano3.rb +8 -2
- data/lib/rollbar/capistrano_tasks.rb +16 -7
- data/lib/rollbar/configuration.rb +113 -91
- data/lib/rollbar/delay/shoryuken.rb +4 -3
- data/lib/rollbar/delay/sidekiq.rb +3 -1
- data/lib/rollbar/delay/sucker_punch.rb +1 -2
- data/lib/rollbar/delay/thread.rb +3 -2
- data/lib/rollbar/deploy.rb +6 -7
- data/lib/rollbar/encoding/encoder.rb +7 -3
- data/lib/rollbar/exception_reporter.rb +17 -8
- data/lib/rollbar/item/backtrace.rb +10 -8
- data/lib/rollbar/item/frame.rb +6 -5
- data/lib/rollbar/item/locals.rb +3 -1
- data/lib/rollbar/item.rb +47 -38
- data/lib/rollbar/json.rb +1 -1
- data/lib/rollbar/lazy_store.rb +1 -3
- data/lib/rollbar/logger.rb +2 -0
- data/lib/rollbar/logger_proxy.rb +3 -1
- data/lib/rollbar/middleware/js.rb +32 -20
- data/lib/rollbar/middleware/rack/builder.rb +3 -3
- data/lib/rollbar/middleware/rack/test_session.rb +3 -3
- data/lib/rollbar/middleware/rack.rb +4 -4
- data/lib/rollbar/middleware/rails/rollbar.rb +9 -6
- data/lib/rollbar/middleware/rails/show_exceptions.rb +8 -4
- data/lib/rollbar/notifier/trace_with_bindings.rb +4 -2
- data/lib/rollbar/notifier.rb +179 -133
- data/lib/rollbar/plugin.rb +8 -8
- data/lib/rollbar/plugins/active_job.rb +11 -2
- data/lib/rollbar/plugins/delayed_job/plugin.rb +10 -3
- data/lib/rollbar/plugins/goalie.rb +27 -16
- data/lib/rollbar/plugins/rails/controller_methods.rb +18 -14
- data/lib/rollbar/plugins/rails/railtie30.rb +2 -1
- data/lib/rollbar/plugins/rails/railtie32.rb +2 -1
- data/lib/rollbar/plugins/rails/railtie_mixin.rb +2 -2
- data/lib/rollbar/plugins/rails.rb +5 -2
- data/lib/rollbar/plugins/rake.rb +2 -1
- data/lib/rollbar/plugins/sidekiq/plugin.rb +5 -5
- data/lib/rollbar/plugins/thread.rb +1 -1
- data/lib/rollbar/plugins/validations.rb +3 -1
- data/lib/rollbar/rake_tasks.rb +0 -1
- data/lib/rollbar/request_data_extractor.rb +38 -17
- data/lib/rollbar/rollbar_test.rb +3 -1
- data/lib/rollbar/scrubbers/params.rb +13 -7
- data/lib/rollbar/scrubbers/url.rb +37 -17
- data/lib/rollbar/scrubbers.rb +1 -1
- data/lib/rollbar/truncation/remove_any_key_strategy.rb +4 -1
- data/lib/rollbar/truncation/remove_extra_strategy.rb +3 -1
- data/lib/rollbar/util/hash.rb +14 -7
- data/lib/rollbar/util/ip_anonymizer.rb +1 -1
- data/lib/rollbar/util.rb +19 -13
- data/lib/rollbar/version.rb +1 -1
- data/lib/rollbar.rb +12 -7
- data/lib/tasks/benchmark.rake +2 -1
- data/rollbar.gemspec +3 -1
- metadata +3 -3
@@ -5,7 +5,8 @@ require 'generators/rollbar/rollbar_generator'
|
|
5
5
|
module Rollbar
|
6
6
|
module Generators
|
7
7
|
class RollbarGenerator < ::Rails::Generators::Base
|
8
|
-
argument :access_token, :type => :string, :banner => 'access_token',
|
8
|
+
argument :access_token, :type => :string, :banner => 'access_token',
|
9
|
+
:default => :use_env_sentinel
|
9
10
|
|
10
11
|
source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
|
11
12
|
|
@@ -13,32 +14,35 @@ module Rollbar
|
|
13
14
|
say 'creating initializer...'
|
14
15
|
if access_token_configured?
|
15
16
|
say "It looks like you've already configured Rollbar."
|
16
|
-
say 'To re-create the config file, remove it first:
|
17
|
+
say 'To re-create the config file, remove it first: ' \
|
18
|
+
'config/initializers/rollbar.rb'
|
17
19
|
exit
|
18
20
|
end
|
19
21
|
|
20
22
|
begin
|
21
23
|
require 'ey_config'
|
22
24
|
rescue LoadError
|
25
|
+
# Skip loading
|
23
26
|
end
|
24
27
|
|
25
28
|
if defined? EY::Config
|
26
29
|
say 'Access token will be read from Engine Yard configuration'
|
30
|
+
elsif access_token === :use_env_sentinel
|
31
|
+
say 'Generator run without an access token; assuming you want to ' \
|
32
|
+
'configure using an environment variable.'
|
33
|
+
say "You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN " \
|
34
|
+
'with your access token:'
|
35
|
+
say "\n$ export ROLLBAR_ACCESS_TOKEN=yourtokenhere"
|
36
|
+
say "\nIf that's not what you wanted to do:"
|
37
|
+
say "\n$ rm config/initializers/rollbar.rb"
|
38
|
+
say '$ rails generate rollbar yourtokenhere'
|
39
|
+
say "\n"
|
27
40
|
else
|
28
|
-
|
29
|
-
say 'Generator run without an access token; assuming you want to configure using an environment variable.'
|
30
|
-
say "You'll need to add an environment variable ROLLBAR_ACCESS_TOKEN with your access token:"
|
31
|
-
say "\n$ export ROLLBAR_ACCESS_TOKEN=yourtokenhere"
|
32
|
-
say "\nIf that's not what you wanted to do:"
|
33
|
-
say "\n$ rm config/initializers/rollbar.rb"
|
34
|
-
say '$ rails generate rollbar yourtokenhere'
|
35
|
-
say "\n"
|
36
|
-
else
|
37
|
-
say 'access token: ' << access_token
|
38
|
-
end
|
41
|
+
say 'access token: ' << access_token
|
39
42
|
end
|
40
43
|
|
41
|
-
template 'initializer.
|
44
|
+
template 'initializer.erb', 'config/initializers/rollbar.rb',
|
45
|
+
:assigns => { :access_token => access_token_expr }
|
42
46
|
|
43
47
|
# TODO: run rake test task
|
44
48
|
end
|
File without changes
|
data/lib/rails/rollbar_runner.rb
CHANGED
@@ -4,7 +4,10 @@ require 'rollbar'
|
|
4
4
|
# Rails.root is not present here.
|
5
5
|
# RSpec needs ENV['DUMMYAPP_PATH'] in order to have a valid path.
|
6
6
|
# Dir.pwd is used in normal operation.
|
7
|
-
APP_PATH = File.expand_path(
|
7
|
+
APP_PATH = File.expand_path(
|
8
|
+
'config/application',
|
9
|
+
(ENV['DUMMYAPP_PATH'] || Dir.pwd)
|
10
|
+
)
|
8
11
|
|
9
12
|
module Rails
|
10
13
|
class RollbarRunner
|
@@ -49,9 +52,9 @@ module Rails
|
|
49
52
|
def legacy_runner
|
50
53
|
string_to_eval = File.read(runner_path)
|
51
54
|
|
52
|
-
::Rails.module_eval(<<-
|
55
|
+
::Rails.module_eval(<<-FILE, __FILE__, __LINE__ + 1)
|
53
56
|
#{string_to_eval}
|
54
|
-
|
57
|
+
FILE
|
55
58
|
end
|
56
59
|
|
57
60
|
def rails5_runner
|
@@ -68,11 +71,15 @@ module Rails
|
|
68
71
|
end
|
69
72
|
|
70
73
|
def runner_path
|
71
|
-
railties_gem_dir
|
74
|
+
"#{railties_gem_dir}/lib/rails/commands/runner.rb"
|
72
75
|
end
|
73
76
|
|
74
77
|
def railties_gem
|
75
|
-
resolver_class = Gem::Specification.respond_to?(:find_by_name)
|
78
|
+
resolver_class = if Gem::Specification.respond_to?(:find_by_name)
|
79
|
+
GemResolver
|
80
|
+
else
|
81
|
+
LegacyGemResolver
|
82
|
+
end
|
76
83
|
gem = resolver_class.new.railties_gem
|
77
84
|
|
78
85
|
abort 'railties gem not found' unless gem
|
data/lib/rollbar/capistrano.rb
CHANGED
@@ -34,7 +34,11 @@ module Rollbar
|
|
34
34
|
_cset(:rollbar_role) { :app }
|
35
35
|
_cset(:rollbar_user) { ENV['USER'] || ENV['USERNAME'] }
|
36
36
|
_cset(:rollbar_env) { fetch(:rails_env, 'production') }
|
37
|
-
_cset(:rollbar_token)
|
37
|
+
_cset(:rollbar_token) do
|
38
|
+
abort(
|
39
|
+
"Please specify the Rollbar access token, set :rollbar_token, 'your token'"
|
40
|
+
)
|
41
|
+
end
|
38
42
|
_cset(:rollbar_revision) { real_revision }
|
39
43
|
_cset(:rollbar_comment) { nil }
|
40
44
|
end
|
@@ -51,7 +55,9 @@ module Rollbar
|
|
51
55
|
:task => :deploy_started,
|
52
56
|
:configuration => configuration
|
53
57
|
) do
|
54
|
-
::Rollbar::CapistranoTasks.deploy_started(
|
58
|
+
::Rollbar::CapistranoTasks.deploy_started(
|
59
|
+
configuration, configuration.logger, configuration.dry_run
|
60
|
+
)
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
@@ -61,17 +67,17 @@ module Rollbar
|
|
61
67
|
:task => :deploy_succeeded,
|
62
68
|
:configuration => configuration
|
63
69
|
) do
|
64
|
-
::Rollbar::CapistranoTasks.deploy_succeeded(
|
70
|
+
::Rollbar::CapistranoTasks.deploy_succeeded(
|
71
|
+
configuration, configuration.logger, configuration.dry_run
|
72
|
+
)
|
65
73
|
end
|
66
74
|
end
|
67
75
|
|
68
|
-
def load_task(configuration:, desc:, task
|
76
|
+
def load_task(configuration:, desc:, task:, &block)
|
69
77
|
configuration.load do
|
70
78
|
namespace :rollbar do
|
71
79
|
desc(desc)
|
72
|
-
task(task)
|
73
|
-
yield
|
74
|
-
end
|
80
|
+
task(task, &block)
|
75
81
|
end
|
76
82
|
end
|
77
83
|
end
|
@@ -79,4 +85,6 @@ module Rollbar
|
|
79
85
|
end
|
80
86
|
end
|
81
87
|
|
82
|
-
|
88
|
+
if Capistrano::Configuration.instance
|
89
|
+
Rollbar::Capistrano2.load_into(Capistrano::Configuration.instance)
|
90
|
+
end
|
data/lib/rollbar/capistrano3.rb
CHANGED
@@ -8,7 +8,10 @@ require 'rollbar/capistrano_tasks'
|
|
8
8
|
|
9
9
|
namespace :rollbar do
|
10
10
|
# dry_run? wasn't introduced till Capistrano 3.5.0; use the old fetch(:sshkit_backed)
|
11
|
-
set :dry_run, (proc {
|
11
|
+
set :dry_run, (proc {
|
12
|
+
::Capistrano::Configuration.env.fetch(:sshkit_backend) ==
|
13
|
+
::SSHKit::Backend::Printer
|
14
|
+
})
|
12
15
|
|
13
16
|
desc 'Send deployment started notification to Rollbar.'
|
14
17
|
task :deploy_started do
|
@@ -49,7 +52,10 @@ namespace :load do
|
|
49
52
|
task :defaults do
|
50
53
|
set :rollbar_user, (proc { fetch :local_user, ENV['USER'] || ENV['USERNAME'] })
|
51
54
|
set :rollbar_env, (proc { fetch :rails_env, 'production' })
|
52
|
-
set :rollbar_token, (proc {
|
55
|
+
set :rollbar_token, (proc {
|
56
|
+
abort 'Please specify the Rollbar access token, ' \
|
57
|
+
"set :rollbar_token, 'your token'"
|
58
|
+
})
|
53
59
|
set :rollbar_role, (proc { :app })
|
54
60
|
set :rollbar_revision, (proc { fetch :current_revision })
|
55
61
|
end
|
@@ -13,7 +13,9 @@ module Rollbar
|
|
13
13
|
capistrano.set(:rollbar_deploy_id, 123) if dry_run
|
14
14
|
|
15
15
|
skip_in_dry_run(logger, dry_run) do
|
16
|
-
if result[:success] &&
|
16
|
+
if result[:success] &&
|
17
|
+
(deploy_id = result[:data] &&
|
18
|
+
result[:data][:deploy_id])
|
17
19
|
capistrano.set :rollbar_deploy_id, deploy_id
|
18
20
|
else
|
19
21
|
message = format_message('Unable to report deploy to Rollbar',
|
@@ -25,13 +27,17 @@ module Rollbar
|
|
25
27
|
end
|
26
28
|
|
27
29
|
def deploy_succeeded(capistrano, logger, dry_run)
|
28
|
-
deploy_update(
|
30
|
+
deploy_update(
|
31
|
+
capistrano, logger, dry_run,
|
32
|
+
:desc => 'Setting deployment status to `succeeded` in Rollbar'
|
33
|
+
) do
|
29
34
|
report_deploy_succeeded(capistrano, dry_run)
|
30
35
|
end
|
31
36
|
end
|
32
37
|
|
33
38
|
def deploy_failed(capistrano, logger, dry_run)
|
34
|
-
deploy_update(capistrano, logger, dry_run,
|
39
|
+
deploy_update(capistrano, logger, dry_run,
|
40
|
+
:desc => 'Setting deployment status to `failed` in Rollbar') do
|
35
41
|
report_deploy_failed(capistrano, dry_run)
|
36
42
|
end
|
37
43
|
end
|
@@ -42,7 +48,6 @@ module Rollbar
|
|
42
48
|
capistrano_300_warning(logger)
|
43
49
|
logger.info opts[:desc] if opts[:desc]
|
44
50
|
yield
|
45
|
-
|
46
51
|
rescue StandardError => e
|
47
52
|
log_error logger, "Error reporting to Rollbar: #{e.inspect}"
|
48
53
|
end
|
@@ -68,7 +73,9 @@ module Rollbar
|
|
68
73
|
end
|
69
74
|
|
70
75
|
def capistrano_300_warning(logger)
|
71
|
-
|
76
|
+
unless ::Capistrano.const_defined?('VERSION') && ::Capistrano::VERSION =~ /^3\.0/
|
77
|
+
return
|
78
|
+
end
|
72
79
|
|
73
80
|
logger.warn('You need to upgrade capistrano to >= 3.1 version in order'\
|
74
81
|
'to correctly report deploys to Rollbar. (On 3.0, the reported revision'\
|
@@ -121,7 +128,8 @@ module Rollbar
|
|
121
128
|
if capistrano.fetch(:rollbar_deploy_id)
|
122
129
|
yield
|
123
130
|
else
|
124
|
-
log_error logger,
|
131
|
+
log_error logger,
|
132
|
+
'Failed to update the deploy in Rollbar. No deploy id available.'
|
125
133
|
end
|
126
134
|
end
|
127
135
|
|
@@ -134,7 +142,8 @@ module Rollbar
|
|
134
142
|
end
|
135
143
|
|
136
144
|
def debug_request_response(logger, result)
|
137
|
-
# NOTE: in Capistrano debug messages go to log/capistrano.log but not to
|
145
|
+
# NOTE: in Capistrano debug messages go to log/capistrano.log but not to
|
146
|
+
# stdout even if log_level == :debug
|
138
147
|
logger.debug result[:request_info]
|
139
148
|
logger.debug result[:response_info] if result[:response_info]
|
140
149
|
end
|
@@ -4,82 +4,82 @@ module Rollbar
|
|
4
4
|
class Configuration
|
5
5
|
SEND_EXTRA_FRAME_DATA_OPTIONS = [:none, :app, :all].freeze
|
6
6
|
|
7
|
-
attr_accessor :access_token
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
7
|
+
attr_accessor :access_token,
|
8
|
+
:anonymize_user_ip,
|
9
|
+
:async_handler,
|
10
|
+
:async_json_payload,
|
11
|
+
:async_skip_report_handler,
|
12
|
+
:backtrace_cleaner,
|
13
|
+
:branch,
|
14
|
+
:capture_uncaught,
|
15
|
+
:code_version,
|
16
|
+
:collect_user_ip,
|
17
|
+
:configured_options,
|
18
|
+
:custom_data_method,
|
19
|
+
:default_logger,
|
20
|
+
:delayed_job_enabled,
|
21
|
+
:disable_core_monkey_patch,
|
22
|
+
:disable_monkey_patch,
|
23
|
+
:disable_rack_monkey_patch,
|
24
|
+
:dj_threshold,
|
25
|
+
:enable_error_context,
|
26
|
+
:enabled,
|
27
|
+
:endpoint,
|
28
|
+
:environment,
|
29
|
+
:exception_level_filters,
|
30
|
+
:failover_handlers,
|
31
|
+
:filepath,
|
32
|
+
:files_processed_duration,
|
33
|
+
:files_processed_enabled,
|
34
|
+
:files_processed_size,
|
35
|
+
:files_with_pid_name_enabled,
|
36
|
+
:framework,
|
37
|
+
:ignore_internal_errors,
|
38
|
+
:ignored_person_ids,
|
39
|
+
:js_enabled,
|
40
|
+
:js_options,
|
41
|
+
:host,
|
42
|
+
:locals,
|
43
|
+
:log_payload,
|
44
|
+
:net_retries,
|
45
|
+
:open_timeout,
|
46
|
+
:payload_options,
|
47
|
+
:person_email_method,
|
48
|
+
:person_id_method,
|
49
|
+
:person_method,
|
50
|
+
:person_username_method,
|
51
|
+
:populate_empty_backtraces,
|
52
|
+
:proxy,
|
53
|
+
:raise_on_error,
|
54
|
+
:randomize_scrub_length,
|
55
|
+
:report_dj_data,
|
56
|
+
:request_timeout,
|
57
|
+
:root,
|
58
|
+
:safely,
|
59
|
+
:scrub_fields,
|
60
|
+
:scrub_password,
|
61
|
+
:scrub_user,
|
62
|
+
:scrub_whitelist,
|
63
|
+
:transmit,
|
64
|
+
:uncaught_exception_level,
|
65
|
+
:user_ip_obfuscator_secret,
|
66
|
+
:user_ip_rack_env_key,
|
67
|
+
:scrub_headers,
|
68
|
+
:sidekiq_threshold,
|
69
|
+
:sidekiq_use_scoped_block,
|
70
|
+
:use_async,
|
71
|
+
:use_exception_level_filters_default,
|
72
|
+
:use_payload_access_token,
|
73
|
+
:verify_ssl_peer,
|
74
|
+
:web_base,
|
75
|
+
:write_to_file
|
76
|
+
attr_reader :before_process,
|
77
|
+
:logger_level,
|
78
|
+
:project_gem_paths,
|
79
|
+
:send_extra_frame_data,
|
80
|
+
:transform,
|
81
|
+
:use_eventmachine
|
82
|
+
attr_writer :logger # seconds # bytes
|
83
83
|
|
84
84
|
alias safely? safely
|
85
85
|
|
@@ -94,7 +94,7 @@ module Rollbar
|
|
94
94
|
@capture_uncaught = nil
|
95
95
|
@code_version = nil
|
96
96
|
@custom_data_method = nil
|
97
|
-
@default_logger = lambda { ::Logger.new(
|
97
|
+
@default_logger = lambda { ::Logger.new($stderr) }
|
98
98
|
@logger_level = :info
|
99
99
|
@delayed_job_enabled = true
|
100
100
|
@disable_monkey_patch = false
|
@@ -113,6 +113,11 @@ module Rollbar
|
|
113
113
|
}
|
114
114
|
@failover_handlers = []
|
115
115
|
@framework = 'Plain'
|
116
|
+
@ignore_internal_errors = [
|
117
|
+
'Net::ReadTimeout',
|
118
|
+
'Net::OpenTimeout',
|
119
|
+
'SocketError'
|
120
|
+
]
|
116
121
|
@ignored_person_ids = []
|
117
122
|
@host = nil
|
118
123
|
@payload_options = {}
|
@@ -158,6 +163,7 @@ module Rollbar
|
|
158
163
|
@collect_user_ip = true
|
159
164
|
@anonymize_user_ip = false
|
160
165
|
@user_ip_obfuscator_secret = nil
|
166
|
+
@user_ip_rack_env_key = nil
|
161
167
|
@backtrace_cleaner = nil
|
162
168
|
@hooks = {
|
163
169
|
:on_error_response => nil, # params: response
|
@@ -214,7 +220,8 @@ module Rollbar
|
|
214
220
|
def use_active_job(options = {})
|
215
221
|
require 'rollbar/delay/active_job'
|
216
222
|
|
217
|
-
Rollbar::Delay::ActiveJob.queue_as(options[:queue] ||
|
223
|
+
Rollbar::Delay::ActiveJob.queue_as(options[:queue] ||
|
224
|
+
Rollbar::Delay::ActiveJob.default_queue_name)
|
218
225
|
|
219
226
|
@use_async = true
|
220
227
|
@async_handler = Rollbar::Delay::ActiveJob
|
@@ -254,8 +261,13 @@ module Rollbar
|
|
254
261
|
end
|
255
262
|
|
256
263
|
def use_sidekiq=(value)
|
257
|
-
deprecation_message = '#use_sidekiq=(value) has been deprecated in favor
|
258
|
-
|
264
|
+
deprecation_message = '#use_sidekiq=(value) has been deprecated in favor ' \
|
265
|
+
'of #use_sidekiq(options = {}). Please update your rollbar configuration.'
|
266
|
+
if defined?(ActiveSupport)
|
267
|
+
ActiveSupport::Deprecation.warn(deprecation_message)
|
268
|
+
else
|
269
|
+
puts(deprecation_message)
|
270
|
+
end
|
259
271
|
|
260
272
|
value.is_a?(Hash) ? use_sidekiq(value) : use_sidekiq
|
261
273
|
end
|
@@ -274,8 +286,13 @@ module Rollbar
|
|
274
286
|
end
|
275
287
|
|
276
288
|
def use_sucker_punch=(_value)
|
277
|
-
deprecation_message = '#use_sucker_punch=(value) has been deprecated in
|
278
|
-
|
289
|
+
deprecation_message = '#use_sucker_punch=(value) has been deprecated in ' \
|
290
|
+
'favor of #use_sucker_punch. Please update your rollbar configuration.'
|
291
|
+
if defined?(ActiveSupport)
|
292
|
+
ActiveSupport::Deprecation.warn(deprecation_message)
|
293
|
+
else
|
294
|
+
puts(deprecation_message)
|
295
|
+
end
|
279
296
|
|
280
297
|
use_sucker_punch
|
281
298
|
end
|
@@ -306,7 +323,9 @@ module Rollbar
|
|
306
323
|
|
307
324
|
def send_extra_frame_data=(value)
|
308
325
|
unless SEND_EXTRA_FRAME_DATA_OPTIONS.include?(value)
|
309
|
-
logger.warning(
|
326
|
+
logger.warning(
|
327
|
+
"Wrong 'send_extra_frame_data' value, :none, :app or :full is expected"
|
328
|
+
)
|
310
329
|
|
311
330
|
return
|
312
331
|
end
|
@@ -332,14 +351,14 @@ module Rollbar
|
|
332
351
|
end
|
333
352
|
|
334
353
|
def hook(symbol, &block)
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
354
|
+
unless @hooks.key?(symbol)
|
355
|
+
raise StandardError, "Hook :#{symbol} is not supported by Rollbar SDK."
|
356
|
+
end
|
357
|
+
|
358
|
+
if block_given?
|
359
|
+
@hooks[symbol] = block
|
341
360
|
else
|
342
|
-
|
361
|
+
@hooks[symbol]
|
343
362
|
end
|
344
363
|
end
|
345
364
|
|
@@ -360,7 +379,10 @@ module Rollbar
|
|
360
379
|
return super unless configuration.respond_to?(method)
|
361
380
|
|
362
381
|
method_string = method.to_s
|
363
|
-
|
382
|
+
if method_string.end_with?('=')
|
383
|
+
configured[method_string.chomp('=').to_sym] =
|
384
|
+
args.first
|
385
|
+
end
|
364
386
|
|
365
387
|
configuration.send(method, *args, &block)
|
366
388
|
end
|
@@ -2,9 +2,10 @@ require 'shoryuken'
|
|
2
2
|
|
3
3
|
module Rollbar
|
4
4
|
module Delay
|
5
|
-
# Following class allows to send rollbars using Sho-ryu-ken as a background
|
6
|
-
#
|
7
|
-
#
|
5
|
+
# Following class allows to send rollbars using Sho-ryu-ken as a background
|
6
|
+
# jobs processor. See the queue_name method which states that your queues
|
7
|
+
# needs to be names as "rollbar_ENVIRONMENT". Retry intervals will be used
|
8
|
+
# to retry sending the same message again if failed before.
|
8
9
|
class Shoryuken
|
9
10
|
include ::Shoryuken::Worker
|
10
11
|
|
@@ -10,7 +10,9 @@ module Rollbar
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def call(payload)
|
13
|
-
|
13
|
+
return unless ::Sidekiq::Client.push(@options.merge('args' => [payload])).nil?
|
14
|
+
|
15
|
+
raise(StandardError, 'Unable to push the job to Sidekiq')
|
14
16
|
end
|
15
17
|
|
16
18
|
include ::Sidekiq::Worker
|
data/lib/rollbar/delay/thread.rb
CHANGED
@@ -62,11 +62,12 @@ module Rollbar
|
|
62
62
|
reaper.join
|
63
63
|
end
|
64
64
|
rescue Timeout::Error
|
65
|
-
raise TimeoutError,
|
65
|
+
raise TimeoutError,
|
66
|
+
"unable to reap all threads within #{EXIT_TIMEOUT} seconds"
|
66
67
|
end
|
67
68
|
end
|
68
69
|
end
|
69
|
-
end
|
70
|
+
end
|
70
71
|
|
71
72
|
def priority
|
72
73
|
self.class.options[:priority] || DEFAULT_PRIORITY
|
data/lib/rollbar/deploy.rb
CHANGED
@@ -30,9 +30,7 @@ module Rollbar
|
|
30
30
|
return {} unless access_token && !access_token.empty?
|
31
31
|
|
32
32
|
uri = ::URI.parse(
|
33
|
-
::Rollbar::Deploy::ENDPOINT
|
34
|
-
deploy_id.to_s +
|
35
|
-
'?access_token=' + access_token
|
33
|
+
"#{::Rollbar::Deploy::ENDPOINT}#{deploy_id}?access_token=#{access_token}"
|
36
34
|
)
|
37
35
|
|
38
36
|
request = ::Net::HTTP::Patch.new(uri.request_uri)
|
@@ -74,17 +72,18 @@ module Rollbar
|
|
74
72
|
|
75
73
|
def request_result(uri, request)
|
76
74
|
{
|
77
|
-
:request_info => uri.inspect
|
75
|
+
:request_info => "#{uri.inspect}: #{request.body}",
|
78
76
|
:request => request
|
79
77
|
}
|
80
78
|
end
|
81
79
|
|
82
80
|
def response_result(response)
|
81
|
+
code = response.code
|
82
|
+
message = response.message
|
83
|
+
body = response.body.delete("\n")
|
83
84
|
{
|
84
85
|
:response => response,
|
85
|
-
:response_info =>
|
86
|
-
response.message + '; ' +
|
87
|
-
response.body.delete("\n")
|
86
|
+
:response_info => "#{code}; #{message}; #{body}"
|
88
87
|
}.merge(::JSON.parse(response.body, :symbolize_names => true))
|
89
88
|
end
|
90
89
|
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Rollbar
|
2
2
|
module Encoding
|
3
3
|
class Encoder
|
4
|
-
ALL_ENCODINGS = [::Encoding::UTF_8, ::Encoding::ISO_8859_1, ::Encoding::ASCII_8BIT,
|
5
|
-
|
4
|
+
ALL_ENCODINGS = [::Encoding::UTF_8, ::Encoding::ISO_8859_1, ::Encoding::ASCII_8BIT,
|
5
|
+
::Encoding::US_ASCII].freeze
|
6
|
+
ASCII_ENCODINGS = [::Encoding::US_ASCII, ::Encoding::ASCII_8BIT,
|
7
|
+
::Encoding::ISO_8859_1].freeze
|
6
8
|
UTF8 = 'UTF-8'.freeze
|
7
9
|
BINARY = 'binary'.freeze
|
8
10
|
|
@@ -40,7 +42,9 @@ module Rollbar
|
|
40
42
|
def force_encoding(value)
|
41
43
|
return value if value.frozen?
|
42
44
|
|
43
|
-
|
45
|
+
if value.encoding == ::Encoding::UTF_8
|
46
|
+
value.force_encoding(detect_encoding(value))
|
47
|
+
end
|
44
48
|
|
45
49
|
value
|
46
50
|
end
|