rollbar 2.27.0 → 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'
@@ -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
@@ -166,6 +164,21 @@ module Rollbar
166
164
  configuration.ignored_person_ids.include?(person_id)
167
165
  end
168
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
+
169
182
  private
170
183
 
171
184
  def build_environment
@@ -10,10 +10,6 @@ module Rollbar
10
10
  mod.const_get(target, inherit)
11
11
  end
12
12
 
13
- def ruby_19?
14
- version?('1.9')
15
- end
16
-
17
13
  def version?(version)
18
14
  numbers = version.split('.')
19
15
 
@@ -21,8 +17,6 @@ module Rollbar
21
17
  end
22
18
 
23
19
  def timeout_exceptions
24
- return [] if ruby_19?
25
-
26
20
  [Net::ReadTimeout, Net::OpenTimeout]
27
21
  end
28
22
  end
@@ -41,8 +41,6 @@ module Rollbar
41
41
  raw[key] = value
42
42
 
43
43
  loaded_data.delete(key)
44
-
45
- value
46
44
  end
47
45
 
48
46
  def data
@@ -76,8 +74,8 @@ module Rollbar
76
74
  super
77
75
  end
78
76
 
79
- def respond_to?(method_sym)
80
- super || raw.respond_to?(method_sym)
77
+ def respond_to_missing?(method_sym, include_all)
78
+ raw.respond_to?(method_sym, include_all)
81
79
  end
82
80
  end
83
81
  end
@@ -640,7 +640,11 @@ module Rollbar
640
640
  request = Net::HTTP::Post.new(uri.request_uri)
641
641
 
642
642
  request.body = pack_ruby260_bytes(body)
643
- request.add_field('X-Rollbar-Access-Token', access_token)
643
+
644
+ # Ensure the payload token will be used if the option is set.
645
+ unless (configuration.use_payload_access_token)
646
+ request.add_field('X-Rollbar-Access-Token', access_token)
647
+ end
644
648
 
645
649
  handle_net_retries { http.request(request) }
646
650
  end
@@ -698,8 +702,6 @@ module Rollbar
698
702
  end
699
703
 
700
704
  def handle_net_retries
701
- return yield if skip_retries?
702
-
703
705
  retries = configuration.net_retries - 1
704
706
 
705
707
  begin
@@ -713,10 +715,6 @@ module Rollbar
713
715
  end
714
716
  end
715
717
 
716
- def skip_retries?
717
- Rollbar::LanguageSupport.ruby_19?
718
- end
719
-
720
718
  def handle_response(response)
721
719
  if response.code == '200'
722
720
  log_info '[Rollbar] Success'