rollbar 2.25.1 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,18 +2,13 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
9
+ gem 'mixlib-shellout', '<= 2.0.0'
10
+ gem 'net-ssh', '<= 3.1.1'
11
+ gem 'public_suffix', '<= 2.0.5'
17
12
  gem 'rails', '4.1.12'
18
13
  gem 'rake'
19
14
  gem 'rspec-rails', '~> 3.4'
@@ -32,20 +27,15 @@ platforms :rbx do
32
27
  gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
33
28
  end
34
29
 
35
- if RUBY_VERSION.start_with?('1.9')
36
- gem 'capistrano', '<= 3.4.1', :require => false
37
- gem 'sucker_punch', '~> 1.0'
38
- gem 'shoryuken', '>= 4.0.0', '<= 4.0.2'
39
- elsif RUBY_VERSION.start_with?('2')
40
- gem 'capistrano', :require => false
41
- gem 'sucker_punch', '~> 2.0'
42
- gem 'shoryuken'
43
- gem 'codacy-coverage'
44
- gem 'simplecov'
45
- end
30
+ gem 'capistrano', :require => false
31
+ gem 'sucker_punch', '~> 2.0'
32
+ gem 'shoryuken'
33
+ gem 'codacy-coverage'
34
+ gem 'simplecov', '<= 0.17.1'
46
35
 
47
36
  gem 'delayed_job', :require => false
48
- gem 'redis'
37
+ gem 'redis', '<= 3.3.5'
38
+ gem 'redis-namespace', '<= 1.5.0'
49
39
  gem 'resque'
50
40
  gem 'sinatra'
51
41
 
@@ -54,13 +44,7 @@ gem 'generator_spec'
54
44
  gem 'girl_friday', '>= 0.11.1'
55
45
  gem 'rspec-command'
56
46
 
57
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
58
- gem 'mime-types', '< 3.0'
59
- gem 'public_suffix', '< 1.5'
60
- gem 'webmock', '< 2.3.0', :require => false
61
- else
62
- gem 'webmock', :require => false
63
- end
47
+ gem 'webmock', :require => false
64
48
 
65
49
  gem 'resque'
66
50
  gem 'aws-sdk-sqs'
@@ -2,19 +2,13 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
  is_not_jruby = !is_jruby
14
7
 
15
- gem 'appraisal'
16
8
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
17
9
  gem 'jruby-openssl', :platform => :jruby
10
+ gem 'net-ssh', '<= 3.1.1'
11
+ gem 'public_suffix', '<= 2.0.5'
18
12
  gem 'rails', '4.2.8'
19
13
  gem 'rake'
20
14
  gem 'rspec-rails', '~> 3.4'
@@ -37,36 +31,24 @@ else
37
31
  gem 'sidekiq', '>= 2.13.0'
38
32
  end
39
33
 
40
- if RUBY_VERSION.start_with?('1.9')
41
- gem 'capistrano', '<= 3.4.1', :require => false
42
- gem 'shoryuken', '>= 4.0.0', '<= 4.0.2'
43
- elsif RUBY_VERSION.start_with?('2')
44
- gem 'capistrano', :require => false
45
- gem 'shoryuken'
46
- end
34
+ gem 'capistrano', :require => false
35
+ gem 'shoryuken'
47
36
 
48
37
  gem 'database_cleaner', '~> 1.0.0'
49
38
  gem 'delayed_job', :require => false
50
39
  gem 'generator_spec'
51
40
  gem 'girl_friday', '>= 0.11.1'
52
41
  gem 'rspec-command'
53
- gem 'redis'
42
+ gem 'redis', '<= 3.3.5'
54
43
  gem 'resque'
55
44
  gem 'sinatra'
56
45
 
57
46
  gem 'nokogiri', '~> 1.6.0' if Gem::Version.new(RUBY_VERSION) <= Gem::Version.new('2.0')
58
47
 
59
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
60
- gem 'mime-types', '< 3.0'
61
- gem 'public_suffix', '< 1.5'
62
- gem 'sucker_punch', '~> 1.0'
63
- gem 'webmock', '< 2.3.0', :require => false
64
- else
65
- gem 'sucker_punch', '~> 2.0'
66
- gem 'webmock', :require => false
67
- gem 'codacy-coverage'
68
- gem 'simplecov'
69
- end
48
+ gem 'sucker_punch', '~> 2.0'
49
+ gem 'webmock', :require => false
50
+ gem 'codacy-coverage'
51
+ gem 'simplecov', '<= 0.17.1'
70
52
 
71
53
  gem 'aws-sdk-sqs'
72
54
 
@@ -2,18 +2,12 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
9
+ gem 'net-ssh', '<= 3.1.1'
10
+ gem 'public_suffix', '<= 3.1.1'
17
11
  gem 'rails', '~> 5.0.7'
18
12
  gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
19
13
 
@@ -34,15 +28,10 @@ platforms :rbx do
34
28
  gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
35
29
  end
36
30
 
37
- if RUBY_VERSION.start_with?('1.9')
38
- gem 'capistrano', '<= 3.4.1', :require => false
39
- gem 'sucker_punch', '~> 1.0'
40
- elsif RUBY_VERSION.start_with?('2')
41
- gem 'capistrano', :require => false
42
- gem 'sucker_punch', '~> 2.0'
43
- gem 'codacy-coverage'
44
- gem 'simplecov'
45
- end
31
+ gem 'capistrano', :require => false
32
+ gem 'sucker_punch', '~> 2.0'
33
+ gem 'codacy-coverage'
34
+ gem 'simplecov', '<= 0.17.1'
46
35
 
47
36
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
48
37
  gem 'rack', '2.1.2'
@@ -54,7 +43,7 @@ gem 'database_cleaner'
54
43
  gem 'delayed_job', :require => false
55
44
  gem 'generator_spec'
56
45
  gem 'girl_friday', '>= 0.11.1'
57
- gem 'redis'
46
+ gem 'redis', '<= 3.3.5'
58
47
  gem 'resque'
59
48
 
60
49
  unless is_jruby
@@ -62,10 +51,6 @@ unless is_jruby
62
51
  gem 'rspec-command'
63
52
  end
64
53
 
65
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
66
- gem 'mime-types', '< 3.0'
67
- end
68
-
69
54
  gem 'webmock', :require => false
70
55
 
71
56
  gem 'aws-sdk-sqs'
@@ -2,18 +2,12 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
9
+ gem 'net-ssh', '<= 3.1.1'
10
+ gem 'public_suffix', '<= 3.1.1'
17
11
  gem 'rails', '~> 5.1.7'
18
12
  gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
19
13
 
@@ -34,15 +28,10 @@ platforms :rbx do
34
28
  gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
35
29
  end
36
30
 
37
- if RUBY_VERSION.start_with?('1.9')
38
- gem 'capistrano', '<= 3.4.1', :require => false
39
- gem 'sucker_punch', '~> 1.0'
40
- elsif RUBY_VERSION.start_with?('2')
41
- gem 'capistrano', :require => false
42
- gem 'sucker_punch', '~> 2.0'
43
- gem 'codacy-coverage'
44
- gem 'simplecov'
45
- end
31
+ gem 'capistrano', :require => false
32
+ gem 'sucker_punch', '~> 2.0'
33
+ gem 'codacy-coverage'
34
+ gem 'simplecov', '<= 0.17.1'
46
35
 
47
36
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
48
37
  gem 'rack', '2.1.2'
@@ -55,7 +44,7 @@ gem 'database_cleaner'
55
44
  gem 'delayed_job', :require => false
56
45
  gem 'generator_spec'
57
46
  gem 'girl_friday', '>= 0.11.1'
58
- gem 'redis'
47
+ gem 'redis', '<= 3.3.5'
59
48
  gem 'resque'
60
49
 
61
50
  unless is_jruby
@@ -63,10 +52,6 @@ unless is_jruby
63
52
  gem 'rspec-command'
64
53
  end
65
54
 
66
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
67
- gem 'mime-types', '< 3.0'
68
- end
69
-
70
55
  gem 'webmock', :require => false
71
56
 
72
57
  gem 'aws-sdk-sqs'
@@ -2,16 +2,8 @@ require 'rubygems/version'
2
2
 
3
3
  source 'https://rubygems.org'
4
4
 
5
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
6
- # new process is created during tests. (Testing rake tasks, for example.)
7
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
8
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
9
- # with the wrong gemfile path.
10
- ENV['CURRENT_GEMFILE'] ||= __FILE__
11
-
12
5
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
13
6
 
14
- gem 'appraisal'
15
7
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
16
8
  gem 'jruby-openssl', :platform => :jruby
17
9
  gem 'rails', '~> 5.2.3'
@@ -46,7 +38,7 @@ gem 'generator_spec'
46
38
  gem 'girl_friday', '>= 0.11.1'
47
39
  gem 'redis'
48
40
  gem 'resque'
49
- gem 'simplecov'
41
+ gem 'simplecov', '<= 0.17.1'
50
42
 
51
43
  unless is_jruby
52
44
  # JRuby doesn't support fork, which is required for this test helper.
@@ -3,16 +3,8 @@ require 'rubygems/version'
3
3
 
4
4
  source 'https://rubygems.org'
5
5
 
6
- # Used by spec/commands/rollbar_rails_runner_spec, and can be used whenever a
7
- # new process is created during tests. (Testing rake tasks, for example.)
8
- # This is a workaround for ENV['BUNDLE_GEMFILE'] not working as expected on Travis.
9
- # We use the ||= assignment because Travis loads the gemfile twice, the second time
10
- # with the wrong gemfile path.
11
- ENV['CURRENT_GEMFILE'] ||= __FILE__
12
-
13
6
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
14
7
 
15
- gem 'appraisal'
16
8
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
17
9
  gem 'jruby-openssl', :platform => :jruby
18
10
  gem 'rails', '6.0.2.1'
@@ -35,7 +35,7 @@ module Rollbar
35
35
  _cset(:rollbar_user) { ENV['USER'] || ENV['USERNAME'] }
36
36
  _cset(:rollbar_env) { fetch(:rails_env, 'production') }
37
37
  _cset(:rollbar_token) { abort("Please specify the Rollbar access token, set :rollbar_token, 'your token'") }
38
- _cset(:rollbar_revision) { current_revision }
38
+ _cset(:rollbar_revision) { real_revision }
39
39
  _cset(:rollbar_comment) { nil }
40
40
  end
41
41
  end
@@ -40,6 +40,9 @@ module Rollbar
40
40
  capistrano_300_warning(logger)
41
41
  logger.info opts[:desc] if opts[:desc]
42
42
  yield
43
+
44
+ rescue StandardError => e
45
+ logger.error "Error reporting to Rollbar: #{e.inspect}"
43
46
  end
44
47
 
45
48
  def deploy_update(capistrano, logger, dry_run, opts = {})
@@ -61,7 +64,11 @@ module Rollbar
61
64
  end
62
65
 
63
66
  def capistrano_300_warning(logger)
64
- logger.warn("You need to upgrade capistrano to '>= 3.1' version in order to correctly report deploys to Rollbar. (On 3.0, the reported revision will be incorrect.)") if ::Capistrano::VERSION =~ /^3\.0/
67
+ return unless ::Capistrano.const_defined?('VERSION') && ::Capistrano::VERSION =~ /^3\.0/
68
+
69
+ logger.warn('You need to upgrade capistrano to >= 3.1 version in order'\
70
+ 'to correctly report deploys to Rollbar. (On 3.0, the reported revision'\
71
+ 'will be incorrect.)')
65
72
  end
66
73
 
67
74
  def report_deploy_started(capistrano, dry_run)
@@ -83,6 +90,7 @@ module Rollbar
83
90
  def report_deploy_succeeded(capistrano, dry_run)
84
91
  ::Rollbar::Deploy.update(
85
92
  {
93
+ :comment => capistrano.fetch(:rollbar_comment),
86
94
  :proxy => :ENV,
87
95
  :dry_run => dry_run
88
96
  },
@@ -95,6 +103,7 @@ module Rollbar
95
103
  def report_deploy_failed(capistrano, dry_run)
96
104
  ::Rollbar::Deploy.update(
97
105
  {
106
+ :comment => capistrano.fetch(:rollbar_comment),
98
107
  :proxy => :ENV,
99
108
  :dry_run => dry_run
100
109
  },
@@ -19,6 +19,7 @@ module Rollbar
19
19
  attr_accessor :disable_core_monkey_patch
20
20
  attr_accessor :enable_error_context
21
21
  attr_accessor :dj_threshold
22
+ attr_accessor :async_skip_report_handler
22
23
  attr_accessor :enabled
23
24
  attr_accessor :endpoint
24
25
  attr_accessor :environment
@@ -74,6 +75,7 @@ module Rollbar
74
75
  attr_accessor :files_processed_enabled
75
76
  attr_accessor :files_processed_duration # seconds
76
77
  attr_accessor :files_processed_size # bytes
78
+ attr_accessor :use_payload_access_token
77
79
 
78
80
  attr_reader :project_gem_paths
79
81
  attr_accessor :configured_options
@@ -84,8 +86,10 @@ module Rollbar
84
86
  DEFAULT_WEB_BASE = 'https://rollbar.com'.freeze
85
87
 
86
88
  def initialize
89
+ @access_token = nil
87
90
  @async_handler = nil
88
91
  @before_process = []
92
+ @branch = nil
89
93
  @capture_uncaught = nil
90
94
  @code_version = nil
91
95
  @custom_data_method = nil
@@ -97,6 +101,7 @@ module Rollbar
97
101
  @disable_rack_monkey_patch = false
98
102
  @enable_error_context = true
99
103
  @dj_threshold = 0
104
+ @async_skip_report_handler = nil
100
105
  @enabled = nil # set to true when configure is called
101
106
  @endpoint = DEFAULT_ENDPOINT
102
107
  @environment = nil
@@ -108,6 +113,7 @@ module Rollbar
108
113
  @failover_handlers = []
109
114
  @framework = 'Plain'
110
115
  @ignored_person_ids = []
116
+ @host = nil
111
117
  @payload_options = {}
112
118
  @person_method = 'current_user'
113
119
  @person_id_method = 'id'
@@ -119,6 +125,7 @@ module Rollbar
119
125
  @open_timeout = 3
120
126
  @request_timeout = 3
121
127
  @net_retries = 3
128
+ @root = nil
122
129
  @js_enabled = false
123
130
  @js_options = {}
124
131
  @locals = {}
@@ -148,6 +155,7 @@ module Rollbar
148
155
  @log_payload = false
149
156
  @collect_user_ip = true
150
157
  @anonymize_user_ip = false
158
+ @user_ip_obfuscator_secret = nil
151
159
  @backtrace_cleaner = nil
152
160
  @hooks = {
153
161
  :on_error_response => nil, # params: response
@@ -155,10 +163,12 @@ module Rollbar
155
163
  }
156
164
 
157
165
  @write_to_file = false
166
+ @filepath = nil
158
167
  @files_with_pid_name_enabled = false
159
168
  @files_processed_enabled = false
160
169
  @files_processed_duration = 60
161
170
  @files_processed_size = 5 * 1000 * 1000
171
+ @use_payload_access_token = false
162
172
 
163
173
  @configured_options = ConfiguredOptions.new(self)
164
174
  end
@@ -40,7 +40,7 @@ module Rollbar
40
40
  class << self
41
41
  def build_with(payload, options = {})
42
42
  new(options).tap do |item|
43
- item.payload = payload
43
+ item.payload = item.add_access_token_to_payload(payload)
44
44
  end
45
45
  end
46
46
  end
@@ -64,9 +64,7 @@ module Rollbar
64
64
 
65
65
  def build
66
66
  data = build_data
67
- self.payload = {
68
- 'data' => data
69
- }
67
+ self.payload = add_access_token_to_payload({'data' => data})
70
68
 
71
69
  enforce_valid_utf8
72
70
  transform
@@ -136,11 +134,18 @@ module Rollbar
136
134
  uuid = stringified_payload['data']['uuid']
137
135
  host = stringified_payload['data'].fetch('server', {})['host']
138
136
 
137
+ original_error = {
138
+ :message => message,
139
+ :exception => exception,
140
+ :configuration => configuration,
141
+ :uuid => uuid,
142
+ :host => host
143
+ }
144
+
139
145
  notifier.send_failsafe(
140
146
  too_large_payload_string(attempts),
141
147
  nil,
142
- uuid,
143
- host
148
+ original_error
144
149
  )
145
150
  logger.error("[Rollbar] Payload too large to be sent for UUID #{uuid}: #{Rollbar::JSON.dump(payload)}")
146
151
  end
@@ -159,6 +164,21 @@ module Rollbar
159
164
  configuration.ignored_person_ids.include?(person_id)
160
165
  end
161
166
 
167
+ def add_access_token_to_payload(payload)
168
+ # Some use cases remain where the token is needed in the payload. For example:
169
+ #
170
+ # When using async senders, if the access token is changed dynamically in
171
+ # the main process config, the sender process won't see that change.
172
+ #
173
+ # Until the delayed sender interface is changed to allow passing dynamic config options,
174
+ # this workaround allows the main process to set the token by adding it to the payload.
175
+ if (configuration && configuration.use_payload_access_token)
176
+ payload['access_token'] ||= configuration.access_token
177
+ end
178
+
179
+ payload
180
+ end
181
+
162
182
  private
163
183
 
164
184
  def build_environment