rollbar 2.21.0 → 2.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +132 -0
- data/.travis.yml +33 -30
- data/Gemfile +2 -0
- data/data/rollbar.snippet.js +1 -1
- data/gemfiles/rails42.gemfile +4 -0
- data/gemfiles/rails60.gemfile +1 -1
- data/lib/rollbar/configuration.rb +48 -4
- data/lib/rollbar/delay/girl_friday.rb +3 -7
- data/lib/rollbar/delay/resque.rb +2 -3
- data/lib/rollbar/delay/sidekiq.rb +2 -4
- data/lib/rollbar/delay/sucker_punch.rb +3 -4
- data/lib/rollbar/delay/thread.rb +14 -0
- data/lib/rollbar/encoding/encoder.rb +7 -3
- data/lib/rollbar/item.rb +26 -3
- data/lib/rollbar/item/backtrace.rb +13 -3
- data/lib/rollbar/item/frame.rb +2 -0
- data/lib/rollbar/item/locals.rb +45 -1
- data/lib/rollbar/middleware/js.rb +6 -1
- data/lib/rollbar/notifier.rb +45 -21
- data/lib/rollbar/plugins/active_job.rb +6 -2
- data/lib/rollbar/plugins/error_context.rb +11 -0
- data/lib/rollbar/scrubbers.rb +1 -5
- data/lib/rollbar/truncation/frames_strategy.rb +1 -1
- data/lib/rollbar/truncation/mixin.rb +1 -1
- data/lib/rollbar/truncation/strings_strategy.rb +4 -2
- data/lib/rollbar/util.rb +4 -0
- data/lib/rollbar/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9073beef837ad644c6679c6f95599b7eb6e387d089c9f8d88448cbf39960ea22
|
4
|
+
data.tar.gz: 148751730bba10444641bd319314b7af7ee69a51e2c15cc686a909f797eec379
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8b0529b951944385beba61f53f43c3ea4270fe38c94fb85639a55a833d2e67c92ae61e88325ba3e3c4a0b64492aab3c95bc6faa6f458df1e9ad792c1e38e77d
|
7
|
+
data.tar.gz: 6d12a2415ac6ba94b7e5b00b944a4de7afe5a4fa6e43c9d86618c944d0968e0aeb8d601a34363fd97b89bc4ff5316b7dfa2cff6a54aee1a7f198b5690391da23
|
data/.rubocop.yml
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require: rubocop-performance
|
2
|
+
|
1
3
|
AllCops:
|
2
4
|
Exclude:
|
3
5
|
- 'vendor/**/*'
|
@@ -66,3 +68,133 @@ Style/FrozenStringLiteralComment:
|
|
66
68
|
# If we do this, it will be in its own PR. It requires adding these magic comments
|
67
69
|
# throughout the project, in order to prepare for a future Ruby 3.x.
|
68
70
|
Enabled: false
|
71
|
+
|
72
|
+
#
|
73
|
+
# Performance cops are opt in, and `Enabled: true` is always required.
|
74
|
+
# Full list is here: https://github.com/rubocop-hq/rubocop-performance/tree/master/lib/rubocop/cop/performance
|
75
|
+
# For travis builds, Codacy will see and use these directives.
|
76
|
+
#
|
77
|
+
Performance/Caller:
|
78
|
+
Enabled: true
|
79
|
+
Exclude:
|
80
|
+
- spec/**/*
|
81
|
+
|
82
|
+
Performance/CaseWhenSplat:
|
83
|
+
Enabled: true
|
84
|
+
Exclude:
|
85
|
+
- spec/**/*
|
86
|
+
|
87
|
+
Performance/Casecmp:
|
88
|
+
Enabled: true
|
89
|
+
Exclude:
|
90
|
+
- spec/**/*
|
91
|
+
|
92
|
+
Performance/ChainArrayAllocation:
|
93
|
+
Enabled: true
|
94
|
+
Exclude:
|
95
|
+
- spec/**/*
|
96
|
+
|
97
|
+
Performance/CompareWithBlock:
|
98
|
+
Enabled: true
|
99
|
+
Exclude:
|
100
|
+
- spec/**/*
|
101
|
+
|
102
|
+
Performance/Count:
|
103
|
+
Enabled: true
|
104
|
+
Exclude:
|
105
|
+
- spec/**/*
|
106
|
+
|
107
|
+
Performance/Detect:
|
108
|
+
Enabled: true
|
109
|
+
Exclude:
|
110
|
+
- spec/**/*
|
111
|
+
|
112
|
+
Performance/DoubleStartEndWith:
|
113
|
+
Enabled: true
|
114
|
+
Exclude:
|
115
|
+
- spec/**/*
|
116
|
+
|
117
|
+
Performance/EndWith:
|
118
|
+
Enabled: true
|
119
|
+
Exclude:
|
120
|
+
- spec/**/*
|
121
|
+
|
122
|
+
Performance/FixedSize:
|
123
|
+
Enabled: true
|
124
|
+
Exclude:
|
125
|
+
- spec/**/*
|
126
|
+
|
127
|
+
Performance/FlatMap:
|
128
|
+
Enabled: true
|
129
|
+
Exclude:
|
130
|
+
- spec/**/*
|
131
|
+
|
132
|
+
Performance/InefficientHashSearch:
|
133
|
+
Enabled: true
|
134
|
+
Exclude:
|
135
|
+
- spec/**/*
|
136
|
+
|
137
|
+
Performance/OpenStruct:
|
138
|
+
Enabled: true
|
139
|
+
Exclude:
|
140
|
+
- spec/**/*
|
141
|
+
|
142
|
+
Performance/RangeInclude:
|
143
|
+
Enabled: true
|
144
|
+
Exclude:
|
145
|
+
- spec/**/*
|
146
|
+
|
147
|
+
Performance/RedundantBlockCall:
|
148
|
+
Enabled: true
|
149
|
+
Exclude:
|
150
|
+
- spec/**/*
|
151
|
+
|
152
|
+
Performance/RedundantMatch:
|
153
|
+
Enabled: true
|
154
|
+
Exclude:
|
155
|
+
- spec/**/*
|
156
|
+
|
157
|
+
Performance/RedundantMerge:
|
158
|
+
Enabled: true
|
159
|
+
Exclude:
|
160
|
+
- spec/**/*
|
161
|
+
|
162
|
+
Performance/RegexpMatch:
|
163
|
+
Enabled: true
|
164
|
+
Exclude:
|
165
|
+
- spec/**/*
|
166
|
+
|
167
|
+
Performance/ReverseEach:
|
168
|
+
Enabled: true
|
169
|
+
Exclude:
|
170
|
+
- spec/**/*
|
171
|
+
|
172
|
+
Performance/Size:
|
173
|
+
Enabled: true
|
174
|
+
Exclude:
|
175
|
+
- spec/**/*
|
176
|
+
|
177
|
+
Performance/StartWith:
|
178
|
+
Enabled: true
|
179
|
+
Exclude:
|
180
|
+
- spec/**/*
|
181
|
+
|
182
|
+
Performance/StringReplacement:
|
183
|
+
Enabled: true
|
184
|
+
Exclude:
|
185
|
+
- spec/**/*
|
186
|
+
|
187
|
+
Performance/TimesMap:
|
188
|
+
Enabled: true
|
189
|
+
Exclude:
|
190
|
+
- spec/**/*
|
191
|
+
|
192
|
+
Performance/UnfreezeString:
|
193
|
+
Enabled: true
|
194
|
+
Exclude:
|
195
|
+
- spec/**/*
|
196
|
+
|
197
|
+
Performance/UriDefaultParser:
|
198
|
+
Enabled: true
|
199
|
+
Exclude:
|
200
|
+
- spec/**/*
|
data/.travis.yml
CHANGED
@@ -3,12 +3,6 @@ dist: trusty
|
|
3
3
|
services:
|
4
4
|
- redis-server
|
5
5
|
language: ruby
|
6
|
-
# Broken bundler on travis CI - https://github.com/bundler/bundler/issues/2784
|
7
|
-
before_install:
|
8
|
-
- gem update --system 2.7.7
|
9
|
-
- gem --version
|
10
|
-
- gem install bundler -v 1.6.1
|
11
|
-
- bundle --version
|
12
6
|
|
13
7
|
rvm:
|
14
8
|
- 1.9.3
|
@@ -18,8 +12,8 @@ rvm:
|
|
18
12
|
- 2.3.8
|
19
13
|
- 2.4.5
|
20
14
|
- 2.5.3
|
21
|
-
- 2.6.
|
22
|
-
- 2.
|
15
|
+
- 2.6.5
|
16
|
+
- 2.7.0
|
23
17
|
- rbx
|
24
18
|
# Travis's own rvm installer is failing on JRuby builds, TODO: reenable when fixed.
|
25
19
|
# - jruby-9.1.9.0
|
@@ -73,9 +67,6 @@ matrix:
|
|
73
67
|
allow_failures:
|
74
68
|
- rvm: ruby-head
|
75
69
|
- rvm: jruby-head
|
76
|
-
# Ruby 2.6.x is still being eveluated and may have test failures
|
77
|
-
- rvm: 2.6.0
|
78
|
-
- rvm: 2.6.3
|
79
70
|
# oraclejdk9 has a dependency issue that needs to be investigated
|
80
71
|
- jdk: oraclejdk9
|
81
72
|
|
@@ -124,17 +115,17 @@ matrix:
|
|
124
115
|
jdk: oraclejdk8
|
125
116
|
- rvm: 2.5.3
|
126
117
|
jdk: oraclejdk9
|
127
|
-
- rvm: 2.6.
|
118
|
+
- rvm: 2.6.5
|
128
119
|
jdk: openjdk8
|
129
|
-
- rvm: 2.6.
|
120
|
+
- rvm: 2.6.5
|
130
121
|
jdk: oraclejdk8
|
131
|
-
- rvm: 2.6.
|
122
|
+
- rvm: 2.6.5
|
132
123
|
jdk: oraclejdk9
|
133
|
-
- rvm: 2.
|
124
|
+
- rvm: 2.7.0
|
134
125
|
jdk: openjdk8
|
135
|
-
- rvm: 2.
|
126
|
+
- rvm: 2.7.0
|
136
127
|
jdk: oraclejdk8
|
137
|
-
- rvm: 2.
|
128
|
+
- rvm: 2.7.0
|
138
129
|
jdk: oraclejdk9
|
139
130
|
|
140
131
|
- rvm: ruby-head
|
@@ -184,11 +175,14 @@ matrix:
|
|
184
175
|
gemfile: gemfiles/rails52.gemfile
|
185
176
|
- rvm: 2.1.0
|
186
177
|
gemfile: gemfiles/rails60.gemfile
|
187
|
-
# MRI 2.2.2 supports Rails 3.2.x and higher
|
178
|
+
# MRI 2.2.2 supports Rails 3.2.x and higher, except Rails 5.2.4 and higher*
|
179
|
+
# * ActionDispatch 5.2.4 uses Ruby 3.x safe navigation operator.
|
188
180
|
- rvm: 2.2.2
|
189
181
|
gemfile: gemfiles/rails30.gemfile
|
190
182
|
- rvm: 2.2.2
|
191
183
|
gemfile: gemfiles/rails31.gemfile
|
184
|
+
- rvm: 2.2.2
|
185
|
+
gemfile: gemfiles/rails52.gemfile
|
192
186
|
# MRI 2.3.x supports Rails 4.0.x and higher
|
193
187
|
- rvm: 2.3.8
|
194
188
|
gemfile: gemfiles/rails30.gemfile
|
@@ -222,30 +216,39 @@ matrix:
|
|
222
216
|
gemfile: gemfiles/rails40.gemfile
|
223
217
|
- rvm: 2.5.3
|
224
218
|
gemfile: gemfiles/rails41.gemfile
|
225
|
-
- rvm: 2.6.
|
219
|
+
- rvm: 2.6.5
|
226
220
|
gemfile: gemfiles/rails30.gemfile
|
227
|
-
- rvm: 2.6.
|
221
|
+
- rvm: 2.6.5
|
228
222
|
gemfile: gemfiles/rails31.gemfile
|
229
|
-
- rvm: 2.6.
|
223
|
+
- rvm: 2.6.5
|
230
224
|
gemfile: gemfiles/rails32.gemfile
|
231
|
-
- rvm: 2.6.
|
225
|
+
- rvm: 2.6.5
|
232
226
|
gemfile: gemfiles/rails40.gemfile
|
233
|
-
- rvm: 2.6.
|
227
|
+
- rvm: 2.6.5
|
234
228
|
gemfile: gemfiles/rails41.gemfile
|
235
|
-
- rvm: 2.6.
|
229
|
+
- rvm: 2.6.5
|
236
230
|
gemfile: gemfiles/rails42.gemfile
|
237
|
-
|
231
|
+
# Rails 6.x tries to be compatible with Ruby 2.7, though
|
232
|
+
# it still throws a lot of warnings. No point testing earlier
|
233
|
+
# Rails with Ruby 2.7.
|
234
|
+
- rvm: 2.7.0
|
238
235
|
gemfile: gemfiles/rails30.gemfile
|
239
|
-
- rvm: 2.
|
236
|
+
- rvm: 2.7.0
|
240
237
|
gemfile: gemfiles/rails31.gemfile
|
241
|
-
- rvm: 2.
|
238
|
+
- rvm: 2.7.0
|
242
239
|
gemfile: gemfiles/rails32.gemfile
|
243
|
-
- rvm: 2.
|
240
|
+
- rvm: 2.7.0
|
244
241
|
gemfile: gemfiles/rails40.gemfile
|
245
|
-
- rvm: 2.
|
242
|
+
- rvm: 2.7.0
|
246
243
|
gemfile: gemfiles/rails41.gemfile
|
247
|
-
- rvm: 2.
|
244
|
+
- rvm: 2.7.0
|
248
245
|
gemfile: gemfiles/rails42.gemfile
|
246
|
+
- rvm: 2.7.0
|
247
|
+
gemfile: gemfiles/rails50.gemfile
|
248
|
+
- rvm: 2.7.0
|
249
|
+
gemfile: gemfiles/rails51.gemfile
|
250
|
+
- rvm: 2.7.0
|
251
|
+
gemfile: gemfiles/rails52.gemfile
|
249
252
|
# JRuby JDBC Adapter is only compatible with Rails >= 5.x
|
250
253
|
- rvm: jruby-9.1.9.0
|
251
254
|
gemfile: gemfiles/rails30.gemfile
|
data/Gemfile
CHANGED
@@ -46,6 +46,7 @@ end
|
|
46
46
|
|
47
47
|
if RUBY_VERSION.start_with?('1.9')
|
48
48
|
gem 'capistrano', '<= 3.4.1', :require => false
|
49
|
+
gem 'json', '1.8.6'
|
49
50
|
gem 'shoryuken', '>= 4.0.0', '<= 4.0.2'
|
50
51
|
gem 'sucker_punch', '~> 1.0'
|
51
52
|
elsif RUBY_VERSION.start_with?('2')
|
@@ -73,6 +74,7 @@ gem 'girl_friday', '>= 0.11.1'
|
|
73
74
|
gem 'redis'
|
74
75
|
gem 'resque', '< 2.0.0'
|
75
76
|
gem 'rubocop', :require => false
|
77
|
+
gem 'rubocop-performance', :require => false
|
76
78
|
gem 'sinatra'
|
77
79
|
gem 'webmock', :require => false
|
78
80
|
gemspec
|
data/data/rollbar.snippet.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){var n=o(1),t=o(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.
|
1
|
+
!function(r){var e={};function o(n){if(e[n])return e[n].exports;var t=e[n]={i:n,l:!1,exports:{}};return r[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.m=r,o.c=e,o.d=function(r,e,n){o.o(r,e)||Object.defineProperty(r,e,{enumerable:!0,get:n})},o.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},o.t=function(r,e){if(1&e&&(r=o(r)),8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var t in r)o.d(n,t,function(e){return r[e]}.bind(null,t));return n},o.n=function(r){var e=r&&r.__esModule?function(){return r.default}:function(){return r};return o.d(e,"a",e),e},o.o=function(r,e){return Object.prototype.hasOwnProperty.call(r,e)},o.p="",o(o.s=0)}([function(r,e,o){var n=o(1),t=o(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.12.3/rollbar.min.js",_rollbarConfig.async=void 0===_rollbarConfig.async||_rollbarConfig.async;var a=n.setupShim(window,_rollbarConfig),l=t(_rollbarConfig);window.rollbar=n.Rollbar,a.loadFull(window,document,!_rollbarConfig.async,_rollbarConfig,l)},function(r,e,o){var n=o(2);function t(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var a=0;function l(r,e){this.options=r,this._rollbarOldOnError=null;var o=a++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var i=o(3),s=function(r,e){return new l(r,e)},d=function(r){return new i(s,r)};function c(r){return t(function(){var e=Array.prototype.slice.call(arguments,0),o={shim:this,method:r,args:e,ts:new Date};window._rollbarShims[this.shimId()].messages.push(o)})}l.prototype.loadFull=function(r,e,o,n,a){var l=!1,i=e.createElement("script"),s=e.getElementsByTagName("script")[0],d=s.parentNode;i.crossOrigin="",i.src=n.rollbarJsUrl,o||(i.async=!0),i.onload=i.onreadystatechange=t(function(){if(!(l||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){i.onload=i.onreadystatechange=null;try{d.removeChild(i)}catch(r){}l=!0,function(){var e;if(void 0===r._rollbarDidLoad){e=new Error("rollbar.js did not load");for(var o,n,t,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(t=n.args||[],i=0;i<t.length;++i)if("function"==typeof(l=t[i])){l(e);break}}"function"==typeof a&&a(e)}()}}),d.insertBefore(i,s)},l.prototype.wrap=function(r,e,o){try{var n;if(n="function"==typeof e?e:function(){return e||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){o&&"function"==typeof o&&o.apply(this,arguments);try{return r.apply(this,arguments)}catch(o){var e=o;throw e&&("string"==typeof e&&(e=new String(e)),e._rollbarContext=n()||{},e._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=e),e}},r._rollbar_wrapped._isWrap=!0,r.hasOwnProperty))for(var t in r)r.hasOwnProperty(t)&&(r._rollbar_wrapped[t]=r[t]);return r._rollbar_wrapped}catch(e){return r}};for(var p="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),u=0;u<p.length;++u)l.prototype[p[u]]=c(p[u]);r.exports={setupShim:function(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var a=new d(e);return t(function(){e.captureUncaught&&(a._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,a,!0),e.wrapGlobalEventHandlers&&n.wrapGlobals(r,a,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,a,!0);var t=e.autoInstrument;return!1!==e.enabled&&(void 0===t||!0===t||"object"==typeof t&&t.network)&&r.addEventListener&&(r.addEventListener("load",a.captureLoad.bind(a)),r.addEventListener("DOMContentLoaded",a.captureDomContentLoaded.bind(a))),r[o]=a,a})()}},Rollbar:d}},function(r,e){function o(r,e,o){if(e.hasOwnProperty&&e.hasOwnProperty("addEventListener")){for(var n=e.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(e,o,t){n.call(this,e,r.wrap(o),t)};t._rollbarOldAdd=n,t.belongsToShim=o,e.addEventListener=t;for(var a=e.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,e,o){a.call(this,r,e&&e._rollbar_wrapped||e,o)};l._rollbarOldRemove=a,l.belongsToShim=o,e.removeEventListener=l}}r.exports={captureUncaughtExceptions:function(r,e,o){if(r){var n;if("function"==typeof e._rollbarOldOnError)n=e._rollbarOldOnError;else if(r.onerror){for(n=r.onerror;n._rollbarOldOnError;)n=n._rollbarOldOnError;e._rollbarOldOnError=n}e.handleAnonymousErrors();var t=function(){var o=Array.prototype.slice.call(arguments,0);!function(r,e,o,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null);var t=e.handleUncaughtException.apply(e,n);o&&o.apply(r,n),"anonymous"===t&&(e.anonymousErrorsPending+=1)}(r,e,n,o)};o&&(t._rollbarOldOnError=n),r.onerror=t}},captureUnhandledRejections:function(r,e,o){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var o,n,t;try{o=r.reason}catch(r){o=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!o&&t&&(o=t.reason,n=t.promise)}catch(r){}o||(o="[unhandledrejection] error getting `reason` from event"),e&&e.handleUnhandledRejection&&e.handleUnhandledRejection(o,n)};n.belongsToShim=o,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}},wrapGlobals:function(r,e,n){if(r){var t,a,l="EventTarget,Window,Node,ApplicationCache,AudioTrackList,ChannelMergerNode,CryptoOperation,EventSource,FileReader,HTMLUnknownElement,IDBDatabase,IDBRequest,IDBTransaction,KeyOperation,MediaController,MessagePort,ModalWindow,Notification,SVGElementInstance,Screen,TextTrack,TextTrackCue,TextTrackList,WebSocket,WebSocketWorker,Worker,XMLHttpRequest,XMLHttpRequestEventTarget,XMLHttpRequestUpload".split(",");for(t=0;t<l.length;++t)r[a=l[t]]&&r[a].prototype&&o(e,r[a].prototype,n)}}}},function(r,e){function o(r,e){this.impl=r(e,this),this.options=e,function(r){for(var e=function(r){return function(){var e=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,e)}},o="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleAnonymousErrors,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<o.length;n++)r[o[n]]=e(o[n])}(o.prototype)}o.prototype._swapAndProcessMessages=function(r,e){var o,n,t;for(this.impl=r(this.options);o=e.shift();)n=o.method,t=o.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],o.ts]):this[n].apply(this,t));return this},r.exports=o},function(r,e){r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){for(var o,n,t=(r=r||{}).globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;o=window._rollbarShims[i++];)n||(n=o.handler),o.handler._swapAndProcessMessages(l,o.messages);window[t]=n,window._rollbarInitialized=!0}}}}]);
|
data/gemfiles/rails42.gemfile
CHANGED
data/gemfiles/rails60.gemfile
CHANGED
@@ -15,7 +15,7 @@ is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_
|
|
15
15
|
gem 'appraisal'
|
16
16
|
gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
|
17
17
|
gem 'jruby-openssl', :platform => :jruby
|
18
|
-
gem 'rails', '6.0.
|
18
|
+
gem 'rails', '6.0.2.1'
|
19
19
|
gem 'sqlite3', '~> 1.4', :platform => [:ruby, :mswin, :mingw]
|
20
20
|
|
21
21
|
gem 'rspec-core', '~> 3.8.0'
|
@@ -17,6 +17,7 @@ module Rollbar
|
|
17
17
|
attr_accessor :disable_monkey_patch
|
18
18
|
attr_accessor :disable_rack_monkey_patch
|
19
19
|
attr_accessor :disable_core_monkey_patch
|
20
|
+
attr_accessor :enable_error_context
|
20
21
|
attr_accessor :dj_threshold
|
21
22
|
attr_accessor :enabled
|
22
23
|
attr_accessor :endpoint
|
@@ -57,6 +58,7 @@ module Rollbar
|
|
57
58
|
attr_reader :transform
|
58
59
|
attr_accessor :verify_ssl_peer
|
59
60
|
attr_accessor :use_async
|
61
|
+
attr_accessor :async_json_payload
|
60
62
|
attr_reader :use_eventmachine
|
61
63
|
attr_accessor :web_base
|
62
64
|
attr_accessor :write_to_file
|
@@ -66,8 +68,10 @@ module Rollbar
|
|
66
68
|
attr_accessor :raise_on_error
|
67
69
|
attr_accessor :transmit
|
68
70
|
attr_accessor :log_payload
|
71
|
+
attr_accessor :backtrace_cleaner
|
69
72
|
|
70
73
|
attr_reader :project_gem_paths
|
74
|
+
attr_accessor :configured_options
|
71
75
|
|
72
76
|
alias safely? safely
|
73
77
|
|
@@ -86,6 +90,7 @@ module Rollbar
|
|
86
90
|
@disable_monkey_patch = false
|
87
91
|
@disable_core_monkey_patch = false
|
88
92
|
@disable_rack_monkey_patch = false
|
93
|
+
@enable_error_context = true
|
89
94
|
@dj_threshold = 0
|
90
95
|
@enabled = nil # set to true when configure is called
|
91
96
|
@endpoint = DEFAULT_ENDPOINT
|
@@ -114,10 +119,10 @@ module Rollbar
|
|
114
119
|
@locals = {}
|
115
120
|
@scrub_fields = [:passwd, :password, :password_confirmation, :secret,
|
116
121
|
:confirm_password, :password_confirmation, :secret_token,
|
117
|
-
:api_key, :access_token, :session_id]
|
122
|
+
:api_key, :access_token, :accessToken, :session_id]
|
118
123
|
@scrub_user = true
|
119
124
|
@scrub_password = true
|
120
|
-
@randomize_scrub_length =
|
125
|
+
@randomize_scrub_length = false
|
121
126
|
@scrub_whitelist = []
|
122
127
|
@uncaught_exception_level = 'error'
|
123
128
|
@scrub_headers = ['Authorization']
|
@@ -125,6 +130,7 @@ module Rollbar
|
|
125
130
|
@safely = false
|
126
131
|
@transform = []
|
127
132
|
@use_async = false
|
133
|
+
@async_json_payload = false
|
128
134
|
@use_eventmachine = false
|
129
135
|
@verify_ssl_peer = true
|
130
136
|
@web_base = DEFAULT_WEB_BASE
|
@@ -138,10 +144,13 @@ module Rollbar
|
|
138
144
|
@log_payload = false
|
139
145
|
@collect_user_ip = true
|
140
146
|
@anonymize_user_ip = false
|
147
|
+
@backtrace_cleaner = nil
|
141
148
|
@hooks = {
|
142
149
|
:on_error_response => nil, # params: response
|
143
150
|
:on_report_internal_error => nil # params: exception
|
144
151
|
}
|
152
|
+
|
153
|
+
@configured_options = ConfiguredOptions.new(self)
|
145
154
|
end
|
146
155
|
|
147
156
|
def initialize_copy(orig)
|
@@ -153,6 +162,15 @@ module Rollbar
|
|
153
162
|
end
|
154
163
|
end
|
155
164
|
|
165
|
+
def wrapped_clone
|
166
|
+
original_clone.tap do |new_config|
|
167
|
+
new_config.configured_options = ConfiguredOptions.new(new_config)
|
168
|
+
new_config.configured_options.configured = configured_options.configured
|
169
|
+
end
|
170
|
+
end
|
171
|
+
alias original_clone clone
|
172
|
+
alias clone wrapped_clone
|
173
|
+
|
156
174
|
def merge(options)
|
157
175
|
new_configuration = clone
|
158
176
|
new_configuration.merge!(options)
|
@@ -220,9 +238,10 @@ module Rollbar
|
|
220
238
|
value.is_a?(Hash) ? use_sidekiq(value) : use_sidekiq
|
221
239
|
end
|
222
240
|
|
223
|
-
def use_thread
|
241
|
+
def use_thread(options = {})
|
224
242
|
require 'rollbar/delay/thread'
|
225
243
|
@use_async = true
|
244
|
+
Rollbar::Delay::Thread.options = options
|
226
245
|
@async_handler = Rollbar::Delay::Thread
|
227
246
|
end
|
228
247
|
|
@@ -249,7 +268,10 @@ module Rollbar
|
|
249
268
|
found = Gem::Specification.each.select { |spec| name === spec.name }
|
250
269
|
puts "[Rollbar] No gems found matching #{name.inspect}" if found.empty?
|
251
270
|
found
|
252
|
-
end
|
271
|
+
end
|
272
|
+
@project_gem_paths.flatten!
|
273
|
+
@project_gem_paths.uniq!
|
274
|
+
@project_gem_paths.map!(&:gem_dir)
|
253
275
|
end
|
254
276
|
|
255
277
|
def before_process=(*handler)
|
@@ -303,4 +325,26 @@ module Rollbar
|
|
303
325
|
hook(symbol).call(*args) if hook(symbol).is_a?(Proc)
|
304
326
|
end
|
305
327
|
end
|
328
|
+
|
329
|
+
class ConfiguredOptions
|
330
|
+
attr_accessor :configuration, :configured
|
331
|
+
|
332
|
+
def initialize(configuration)
|
333
|
+
@configuration = configuration
|
334
|
+
@configured = {}
|
335
|
+
end
|
336
|
+
|
337
|
+
def method_missing(method, *args, &block)
|
338
|
+
return super unless configuration.respond_to?(method)
|
339
|
+
|
340
|
+
method_string = method.to_s
|
341
|
+
configured[method_string.chomp('=').to_sym] = args.first if method_string.end_with?('=')
|
342
|
+
|
343
|
+
configuration.send(method, *args, &block)
|
344
|
+
end
|
345
|
+
|
346
|
+
def respond_to_missing?(method)
|
347
|
+
configuration.respond_to?(method) || super
|
348
|
+
end
|
349
|
+
end
|
306
350
|
end
|
@@ -12,13 +12,9 @@ module Rollbar
|
|
12
12
|
|
13
13
|
def queue
|
14
14
|
@queue ||= queue_class.new(nil, :size => 5) do |payload|
|
15
|
-
|
16
|
-
|
17
|
-
rescue
|
18
|
-
# According to https://github.com/mperham/girl_friday/wiki#error-handling
|
19
|
-
# we reraise the exception so it can be handled some way
|
20
|
-
raise
|
21
|
-
end
|
15
|
+
Rollbar.process_from_async_handler(payload)
|
16
|
+
|
17
|
+
# Do not rescue. GirlFriday will call the error handler.
|
22
18
|
end
|
23
19
|
end
|
24
20
|
end
|
data/lib/rollbar/delay/resque.rb
CHANGED
@@ -24,9 +24,8 @@ module Rollbar
|
|
24
24
|
|
25
25
|
def perform(payload)
|
26
26
|
Rollbar.process_from_async_handler(payload)
|
27
|
-
|
28
|
-
#
|
29
|
-
raise
|
27
|
+
|
28
|
+
# Do not rescue. Resque will call the error handler.
|
30
29
|
end
|
31
30
|
end
|
32
31
|
end
|
@@ -17,10 +17,8 @@ module Rollbar
|
|
17
17
|
|
18
18
|
def perform(*args)
|
19
19
|
Rollbar.process_from_async_handler(*args)
|
20
|
-
|
21
|
-
#
|
22
|
-
# and retry it
|
23
|
-
raise
|
20
|
+
|
21
|
+
# Do not rescue. Sidekiq will call the error handler.
|
24
22
|
end
|
25
23
|
end
|
26
24
|
end
|
@@ -33,7 +33,7 @@ module Rollbar
|
|
33
33
|
|
34
34
|
def perform(*args)
|
35
35
|
Rollbar.process_from_async_handler(*args)
|
36
|
-
|
36
|
+
|
37
37
|
# SuckerPunch can configure an exception handler with:
|
38
38
|
#
|
39
39
|
# SuckerPunch.exception_handler { # do something here }
|
@@ -41,9 +41,8 @@ module Rollbar
|
|
41
41
|
# This is just passed to Celluloid.exception_handler which will
|
42
42
|
# push the reiceved block to an array of handlers, by default empty, [].
|
43
43
|
#
|
44
|
-
|
45
|
-
#
|
46
|
-
raise
|
44
|
+
|
45
|
+
# Do not rescue. SuckerPunch will call the error handler.
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
data/lib/rollbar/delay/thread.rb
CHANGED
@@ -9,7 +9,10 @@ module Rollbar
|
|
9
9
|
Error = Class.new(StandardError)
|
10
10
|
TimeoutError = Class.new(Error)
|
11
11
|
|
12
|
+
DEFAULT_PRIORITY = 1
|
13
|
+
|
12
14
|
class << self
|
15
|
+
attr_writer :options
|
13
16
|
attr_reader :reaper
|
14
17
|
|
15
18
|
def call(payload)
|
@@ -20,6 +23,10 @@ module Rollbar
|
|
20
23
|
thread
|
21
24
|
end
|
22
25
|
|
26
|
+
def options
|
27
|
+
@options || {}
|
28
|
+
end
|
29
|
+
|
23
30
|
private
|
24
31
|
|
25
32
|
def threads
|
@@ -61,9 +68,16 @@ module Rollbar
|
|
61
68
|
end
|
62
69
|
end # class << self
|
63
70
|
|
71
|
+
def priority
|
72
|
+
self.class.options[:priority] || DEFAULT_PRIORITY
|
73
|
+
end
|
74
|
+
|
64
75
|
def call(payload)
|
76
|
+
priority = self.priority
|
77
|
+
|
65
78
|
::Thread.new do
|
66
79
|
begin
|
80
|
+
::Thread.current.priority = priority
|
67
81
|
Rollbar.process_from_async_handler(payload)
|
68
82
|
rescue StandardError
|
69
83
|
# Here we swallow the exception:
|
@@ -3,7 +3,6 @@ module Rollbar
|
|
3
3
|
class Encoder
|
4
4
|
ALL_ENCODINGS = [::Encoding::UTF_8, ::Encoding::ISO_8859_1, ::Encoding::ASCII_8BIT, ::Encoding::US_ASCII].freeze
|
5
5
|
ASCII_ENCODINGS = [::Encoding::US_ASCII, ::Encoding::ASCII_8BIT, ::Encoding::ISO_8859_1].freeze
|
6
|
-
ENCODING_OPTIONS = { :invalid => :replace, :undef => :replace, :replace => '' }.freeze
|
7
6
|
UTF8 = 'UTF-8'.freeze
|
8
7
|
BINARY = 'binary'.freeze
|
9
8
|
|
@@ -21,7 +20,13 @@ module Rollbar
|
|
21
20
|
encoded_value = if encoding == ::Encoding::UTF_8 && value.valid_encoding?
|
22
21
|
value
|
23
22
|
else
|
24
|
-
force_encoding(value).encode(
|
23
|
+
force_encoding(value).encode(
|
24
|
+
*encoding_args(value),
|
25
|
+
# Ruby 2.7 requires this to look like keyword args,
|
26
|
+
# and Ruby 1.9.3 doesn't understand keyword args, so
|
27
|
+
# don't use hash rockets here and both will be happy.
|
28
|
+
invalid: :replace, undef: :replace, replace: '' # rubocop:disable Style/HashSyntax
|
29
|
+
)
|
25
30
|
end
|
26
31
|
|
27
32
|
object.is_a?(Symbol) ? encoded_value.to_sym : encoded_value
|
@@ -54,7 +59,6 @@ module Rollbar
|
|
54
59
|
def encoding_args(value)
|
55
60
|
args = [UTF8]
|
56
61
|
args << BINARY if ASCII_ENCODINGS.include?(value.encoding)
|
57
|
-
args << ENCODING_OPTIONS
|
58
62
|
|
59
63
|
args
|
60
64
|
end
|
data/lib/rollbar/item.rb
CHANGED
@@ -84,7 +84,8 @@ module Rollbar
|
|
84
84
|
:server => server_data,
|
85
85
|
:notifier => {
|
86
86
|
:name => 'rollbar-gem',
|
87
|
-
:version => VERSION
|
87
|
+
:version => VERSION,
|
88
|
+
:configured_options => configured_options
|
88
89
|
},
|
89
90
|
:body => build_body
|
90
91
|
}
|
@@ -102,6 +103,22 @@ module Rollbar
|
|
102
103
|
data
|
103
104
|
end
|
104
105
|
|
106
|
+
def configured_options
|
107
|
+
if Gem.loaded_specs['activesupport'] && Gem.loaded_specs['activesupport'].version < Gem::Version.new('4.1')
|
108
|
+
# There are too many types that crash ActiveSupport JSON serialization, and not worth
|
109
|
+
# the risk just to send this diagnostic object. In versions < 4.1, ActiveSupport hooks
|
110
|
+
# Ruby's JSON.generate so deeply there's no workaround.
|
111
|
+
'not serialized in ActiveSupport < 4.1'
|
112
|
+
elsif configuration.use_async && !configuration.async_json_payload
|
113
|
+
# The setting allows serialization to be performed by each handler,
|
114
|
+
# and this usually means it is actually performed by ActiveSupport,
|
115
|
+
# which cannot safely serialize this key.
|
116
|
+
'not serialized when async_json_payload is not set'
|
117
|
+
else
|
118
|
+
scrub(configuration.configured_options.configured)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
105
122
|
def dump
|
106
123
|
# Ensure all keys are strings since we can receive the payload inline or
|
107
124
|
# from an async handler job, which can be serialized.
|
@@ -166,13 +183,19 @@ module Rollbar
|
|
166
183
|
end
|
167
184
|
|
168
185
|
def build_extra
|
186
|
+
merged_extra = Util.deep_merge(scrub(extra), scrub(error_context))
|
187
|
+
|
169
188
|
if custom_data_method? && !Rollbar::Util.method_in_stack(:custom_data, __FILE__)
|
170
|
-
Util.deep_merge(scrub(custom_data),
|
189
|
+
Util.deep_merge(scrub(custom_data), merged_extra)
|
171
190
|
else
|
172
|
-
|
191
|
+
merged_extra.empty? ? nil : merged_extra # avoid putting an empty {} in the payload.
|
173
192
|
end
|
174
193
|
end
|
175
194
|
|
195
|
+
def error_context
|
196
|
+
exception.respond_to?(:rollbar_context) && exception.rollbar_context
|
197
|
+
end
|
198
|
+
|
176
199
|
def scrub(data)
|
177
200
|
return data unless data.is_a? Hash
|
178
201
|
|
@@ -55,7 +55,7 @@ module Rollbar
|
|
55
55
|
current_exception = exception
|
56
56
|
|
57
57
|
while current_exception.respond_to?(:cause) && (cause = current_exception.cause) && cause.is_a?(Exception) && !visited.include?(cause)
|
58
|
-
traces
|
58
|
+
traces.unshift(trace_data(cause))
|
59
59
|
visited << cause
|
60
60
|
current_exception = cause
|
61
61
|
end
|
@@ -74,10 +74,20 @@ module Rollbar
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def map_frames(current_exception)
|
77
|
-
|
77
|
+
frames = cleaned_backtrace(current_exception).map do |frame|
|
78
78
|
Rollbar::Item::Frame.new(self, frame,
|
79
79
|
:configuration => configuration).to_h
|
80
|
-
end
|
80
|
+
end
|
81
|
+
frames.reverse!
|
82
|
+
end
|
83
|
+
|
84
|
+
def cleaned_backtrace(current_exception)
|
85
|
+
normalized_backtrace = exception_backtrace(current_exception)
|
86
|
+
if configuration.backtrace_cleaner
|
87
|
+
configuration.backtrace_cleaner.clean(normalized_backtrace)
|
88
|
+
else
|
89
|
+
normalized_backtrace
|
90
|
+
end
|
81
91
|
end
|
82
92
|
|
83
93
|
# Returns the backtrace to be sent to our API. There are 3 options:
|
data/lib/rollbar/item/frame.rb
CHANGED
data/lib/rollbar/item/locals.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'rollbar/notifier'
|
2
2
|
require 'rollbar/scrubbers/params'
|
3
|
+
require 'rollbar/util'
|
3
4
|
|
4
5
|
module Rollbar
|
5
6
|
class Item
|
@@ -39,8 +40,51 @@ module Rollbar
|
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
43
|
+
# Prepare objects to be handled by the payload serializer.
|
44
|
+
#
|
45
|
+
# Hashes and Arrays are traversed. Then all types execpt strings and
|
46
|
+
# immediates are exported using #inspect. Sending the object itself to the
|
47
|
+
# serializer can result in large recursive expansions, especially in Rails
|
48
|
+
# environments with ActiveRecord, ActiveSupport, etc. on the stack.
|
49
|
+
# Other export options could be #to_s, #to_h, and #as_json. Several of these
|
50
|
+
# will omit the class name, or are not implemented for many types.
|
51
|
+
#
|
52
|
+
# #inspect has the advantage that it is specifically intended for debugging
|
53
|
+
# output. If the user wants more or different information in the payload
|
54
|
+
# about a specific type, #inspect is the correct place to implement it.
|
55
|
+
# Likewise the default implementation should be oriented toward usefulness
|
56
|
+
# in debugging.
|
57
|
+
#
|
58
|
+
# Because #inspect outputs a string, it can be handled well by the string
|
59
|
+
# truncation strategy for large payloads.
|
60
|
+
#
|
42
61
|
def prepare_value(value)
|
43
|
-
value.
|
62
|
+
return simple_value?(value) ? value : value.inspect unless value.is_a?(Hash) || value.is_a?(Array)
|
63
|
+
|
64
|
+
cloned_value = ::Rollbar::Util.deep_copy(value)
|
65
|
+
::Rollbar::Util.iterate_and_update_with_block(cloned_value) do |v|
|
66
|
+
simple_value?(v) ? v : v.inspect
|
67
|
+
end
|
68
|
+
|
69
|
+
cloned_value
|
70
|
+
end
|
71
|
+
|
72
|
+
def simple_classes
|
73
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('2.4.0')
|
74
|
+
[String, Symbol, Integer, Float, TrueClass, FalseClass, NilClass]
|
75
|
+
else
|
76
|
+
[String, Symbol, Fixnum, Bignum, Float, TrueClass, FalseClass, NilClass] # rubocop:disable Lint/UnifiedInteger
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def simple_value?(value)
|
81
|
+
simple_classes.each do |klass|
|
82
|
+
# Use instance_of? so that subclasses and module containers will
|
83
|
+
# be treated like complex object types, not simple values.
|
84
|
+
return true if value.instance_of?(klass)
|
85
|
+
end
|
86
|
+
|
87
|
+
false
|
44
88
|
end
|
45
89
|
|
46
90
|
def scrub(hash)
|
@@ -83,7 +83,12 @@ module Rollbar
|
|
83
83
|
response = ::Rack::Response.new(response_string, app_result[0],
|
84
84
|
app_result[1])
|
85
85
|
|
86
|
-
response.finish
|
86
|
+
finished = response.finish
|
87
|
+
|
88
|
+
# Rack < 2.x Response#finish returns self in array[2]. Rack >= 2.x returns self.body.
|
89
|
+
# Always return with the response object here regardless of rack version.
|
90
|
+
finished[2] = response
|
91
|
+
finished
|
87
92
|
end
|
88
93
|
|
89
94
|
def build_body_with_js(env, body, head_open_end)
|
data/lib/rollbar/notifier.rb
CHANGED
@@ -42,21 +42,21 @@ module Rollbar
|
|
42
42
|
# Similar to configure below, but used only internally within the gem
|
43
43
|
# to configure it without initializing any of the third party hooks
|
44
44
|
def preconfigure
|
45
|
-
yield(configuration)
|
45
|
+
yield(configuration.configured_options)
|
46
46
|
end
|
47
47
|
|
48
48
|
# Configures the notifier instance
|
49
49
|
def configure
|
50
50
|
configuration.enabled = true if configuration.enabled.nil?
|
51
51
|
|
52
|
-
yield(configuration)
|
52
|
+
yield(configuration.configured_options)
|
53
53
|
end
|
54
54
|
|
55
55
|
def reconfigure
|
56
56
|
self.configuration = Configuration.new
|
57
57
|
configuration.enabled = true
|
58
58
|
|
59
|
-
yield(configuration)
|
59
|
+
yield(configuration.configured_options)
|
60
60
|
end
|
61
61
|
|
62
62
|
def unconfigure
|
@@ -211,7 +211,9 @@ module Rollbar
|
|
211
211
|
end
|
212
212
|
rescue StandardError => e
|
213
213
|
log_error("[Rollbar] Error processing the item: #{e.class}, #{e.message}. Item: #{item.payload.inspect}")
|
214
|
-
raise e
|
214
|
+
raise e unless via_failsafe?(item)
|
215
|
+
|
216
|
+
log_error('[Rollbar] Item has already failed. Not re-raising')
|
215
217
|
end
|
216
218
|
|
217
219
|
# We will reraise exceptions in this method so async queues
|
@@ -238,16 +240,19 @@ module Rollbar
|
|
238
240
|
# Using Rollbar.silenced we avoid the above behavior but Sidekiq
|
239
241
|
# will have a chance to retry the original job.
|
240
242
|
def process_from_async_handler(payload)
|
241
|
-
payload = Rollbar::JSON.load(payload) if payload.is_a?(String)
|
242
|
-
|
243
|
-
item = Item.build_with(payload,
|
244
|
-
:notifier => self,
|
245
|
-
:configuration => configuration,
|
246
|
-
:logger => logger)
|
247
|
-
|
248
243
|
Rollbar.silenced do
|
249
244
|
begin
|
250
|
-
|
245
|
+
if payload.is_a?(String)
|
246
|
+
# The final payload has already been built.
|
247
|
+
send_body(payload)
|
248
|
+
else
|
249
|
+
item = Item.build_with(payload,
|
250
|
+
:notifier => self,
|
251
|
+
:configuration => configuration,
|
252
|
+
:logger => logger)
|
253
|
+
|
254
|
+
process_item(item)
|
255
|
+
end
|
251
256
|
rescue StandardError => e
|
252
257
|
report_internal_error(e)
|
253
258
|
|
@@ -509,14 +514,18 @@ module Rollbar
|
|
509
514
|
|
510
515
|
## Delivery functions
|
511
516
|
|
512
|
-
def
|
513
|
-
|
514
|
-
return unless body
|
517
|
+
def send_using_eventmachine(body)
|
518
|
+
uri = URI.parse(configuration.endpoint)
|
515
519
|
|
516
|
-
headers = { 'X-Rollbar-Access-Token' =>
|
520
|
+
headers = { 'X-Rollbar-Access-Token' => configuration.access_token }
|
517
521
|
options = http_proxy_for_em(uri)
|
518
522
|
req = EventMachine::HttpRequest.new(uri.to_s, options).post(:body => body, :head => headers)
|
519
523
|
|
524
|
+
eventmachine_callback(req)
|
525
|
+
eventmachine_errback(req)
|
526
|
+
end
|
527
|
+
|
528
|
+
def eventmachine_callback(req)
|
520
529
|
req.callback do
|
521
530
|
if req.response_header.status == 200
|
522
531
|
log_info '[Rollbar] Success'
|
@@ -525,7 +534,9 @@ module Rollbar
|
|
525
534
|
log_info "[Rollbar] Response: #{req.response}"
|
526
535
|
end
|
527
536
|
end
|
537
|
+
end
|
528
538
|
|
539
|
+
def eventmachine_errback(req)
|
529
540
|
req.errback do
|
530
541
|
log_warning "[Rollbar] Call to API failed, status code: #{req.response_header.status}"
|
531
542
|
log_info "[Rollbar] Error's response: #{req.response}"
|
@@ -538,14 +549,20 @@ module Rollbar
|
|
538
549
|
body = item.dump
|
539
550
|
return unless body
|
540
551
|
|
541
|
-
uri = URI.parse(configuration.endpoint)
|
542
|
-
|
543
552
|
if configuration.use_eventmachine
|
544
|
-
|
553
|
+
send_using_eventmachine(body)
|
545
554
|
return
|
546
555
|
end
|
547
556
|
|
548
|
-
|
557
|
+
send_body(body)
|
558
|
+
end
|
559
|
+
|
560
|
+
def send_body(body)
|
561
|
+
log_info '[Rollbar] Sending json'
|
562
|
+
|
563
|
+
uri = URI.parse(configuration.endpoint)
|
564
|
+
|
565
|
+
handle_response(do_post(uri, body, configuration.access_token))
|
549
566
|
end
|
550
567
|
|
551
568
|
def do_post(uri, body, access_token)
|
@@ -737,8 +754,11 @@ module Rollbar
|
|
737
754
|
end
|
738
755
|
|
739
756
|
def process_async_item(item)
|
757
|
+
# Send async payloads as JSON string when async_json_payload is set.
|
758
|
+
payload = configuration.async_json_payload ? item.dump : item.payload
|
759
|
+
|
740
760
|
configuration.async_handler ||= default_async_handler
|
741
|
-
configuration.async_handler.call(
|
761
|
+
configuration.async_handler.call(payload)
|
742
762
|
rescue StandardError
|
743
763
|
if configuration.failover_handlers.empty?
|
744
764
|
log_error '[Rollbar] Async handler failed, and there are no failover handlers configured. See the docs for "failover_handlers"'
|
@@ -772,5 +792,9 @@ module Rollbar
|
|
772
792
|
uuid_url = Util.uuid_rollbar_url(data, configuration)
|
773
793
|
log_info "[Rollbar] Details: #{uuid_url} (only available if report was successful)"
|
774
794
|
end
|
795
|
+
|
796
|
+
def via_failsafe?(item)
|
797
|
+
item.payload.fetch('data', {}).fetch(:failsafe, false)
|
798
|
+
end
|
775
799
|
end
|
776
800
|
end
|
@@ -14,5 +14,9 @@ module Rollbar
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
|
18
|
+
ActiveSupport.on_load(:action_mailer) do
|
19
|
+
# Automatically add to ActionMailer::DeliveryJob
|
20
|
+
ActionMailer::DeliveryJob.send(:include, Rollbar::ActiveJob) if defined?(ActionMailer::DeliveryJob)
|
21
|
+
end
|
22
|
+
end
|
data/lib/rollbar/scrubbers.rb
CHANGED
@@ -6,7 +6,7 @@ module Rollbar
|
|
6
6
|
class StringsStrategy
|
7
7
|
include ::Rollbar::Truncation::Mixin
|
8
8
|
|
9
|
-
STRING_THRESHOLDS = [1024, 512, 256].freeze
|
9
|
+
STRING_THRESHOLDS = [1024, 512, 256, 128].freeze
|
10
10
|
|
11
11
|
def self.call(payload)
|
12
12
|
new.call(payload)
|
@@ -29,7 +29,9 @@ module Rollbar
|
|
29
29
|
|
30
30
|
def truncate_strings_proc(threshold)
|
31
31
|
proc do |value|
|
32
|
-
|
32
|
+
# Rollbar::Util.truncate will operate on characters, not bytes,
|
33
|
+
# so use value.length, not bytesize.
|
34
|
+
if value.is_a?(String) && value.length > threshold
|
33
35
|
Rollbar::Util.truncate(value, threshold)
|
34
36
|
else
|
35
37
|
value
|
data/lib/rollbar/util.rb
CHANGED
@@ -2,6 +2,10 @@ require 'rollbar/util/hash'
|
|
2
2
|
|
3
3
|
module Rollbar
|
4
4
|
module Util # :nodoc:
|
5
|
+
def self.iterate_and_update_with_block(obj, &block)
|
6
|
+
iterate_and_update(obj, block)
|
7
|
+
end
|
8
|
+
|
5
9
|
def self.iterate_and_update(obj, block, seen = {})
|
6
10
|
return if obj.frozen? || seen[obj.object_id]
|
7
11
|
|
data/lib/rollbar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollbar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.23.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rollbar, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Easy and powerful exception tracking for Ruby
|
14
14
|
email:
|
@@ -95,6 +95,7 @@ files:
|
|
95
95
|
- lib/rollbar/plugins/delayed_job.rb
|
96
96
|
- lib/rollbar/plugins/delayed_job/job_data.rb
|
97
97
|
- lib/rollbar/plugins/delayed_job/plugin.rb
|
98
|
+
- lib/rollbar/plugins/error_context.rb
|
98
99
|
- lib/rollbar/plugins/goalie.rb
|
99
100
|
- lib/rollbar/plugins/rack.rb
|
100
101
|
- lib/rollbar/plugins/rails.rb
|
@@ -157,8 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
157
158
|
- !ruby/object:Gem::Version
|
158
159
|
version: '0'
|
159
160
|
requirements: []
|
160
|
-
|
161
|
-
rubygems_version: 2.7.7
|
161
|
+
rubygems_version: 3.1.2
|
162
162
|
signing_key:
|
163
163
|
specification_version: 4
|
164
164
|
summary: Reports exceptions to Rollbar
|