rollbar 2.22.1 → 2.27.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/pull_request_template.md +25 -0
  3. data/.rubocop.yml +136 -0
  4. data/.travis.yml +33 -30
  5. data/Gemfile +2 -0
  6. data/README.md +1 -1
  7. data/data/rollbar.snippet.js +1 -1
  8. data/docs/configuration.md +8 -0
  9. data/gemfiles/rails42.gemfile +4 -0
  10. data/gemfiles/rails50.gemfile +6 -2
  11. data/gemfiles/rails51.gemfile +6 -2
  12. data/gemfiles/rails60.gemfile +1 -1
  13. data/lib/rails/rollbar_runner.rb +3 -1
  14. data/lib/rollbar/capistrano.rb +1 -1
  15. data/lib/rollbar/capistrano_tasks.rb +10 -1
  16. data/lib/rollbar/configuration.rb +28 -6
  17. data/lib/rollbar/delay/girl_friday.rb +3 -7
  18. data/lib/rollbar/delay/resque.rb +2 -3
  19. data/lib/rollbar/delay/sidekiq.rb +2 -4
  20. data/lib/rollbar/delay/sucker_punch.rb +3 -4
  21. data/lib/rollbar/delay/thread.rb +14 -0
  22. data/lib/rollbar/deploy.rb +2 -0
  23. data/lib/rollbar/encoding/encoder.rb +10 -3
  24. data/lib/rollbar/item/backtrace.rb +12 -2
  25. data/lib/rollbar/item/frame.rb +2 -0
  26. data/lib/rollbar/item/locals.rb +45 -1
  27. data/lib/rollbar/item.rb +22 -14
  28. data/lib/rollbar/json.rb +1 -0
  29. data/lib/rollbar/middleware/js.rb +13 -3
  30. data/lib/rollbar/notifier.rb +154 -61
  31. data/lib/rollbar/plugins/active_job.rb +6 -2
  32. data/lib/rollbar/plugins/delayed_job/plugin.rb +11 -1
  33. data/lib/rollbar/plugins/error_context.rb +11 -0
  34. data/lib/rollbar/rake_tasks.rb +1 -1
  35. data/lib/rollbar/request_data_extractor.rb +7 -1
  36. data/lib/rollbar/rollbar_test.rb +6 -117
  37. data/lib/rollbar/scrubbers/url.rb +10 -5
  38. data/lib/rollbar/scrubbers.rb +1 -5
  39. data/lib/rollbar/truncation/frames_strategy.rb +1 -1
  40. data/lib/rollbar/truncation/mixin.rb +1 -1
  41. data/lib/rollbar/truncation/strings_strategy.rb +4 -2
  42. data/lib/rollbar/util.rb +4 -0
  43. data/lib/rollbar/version.rb +1 -1
  44. data/rollbar.gemspec +1 -0
  45. data/spec/support/rollbar_api.rb +67 -0
  46. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c56a90107593b66c2be899fd4f36abe3ad657abcd0e2d822964efbc8e47efdbb
4
- data.tar.gz: cd95d87f45d3e65f3dc499c9be88c3c18b84ccd359eda34ed2ab88e941909754
3
+ metadata.gz: 93750693cd5d598ffbfffc97a6fa9d6849b883ff0c6e1fbd2d9f1bc12fe231ce
4
+ data.tar.gz: f6cb9387ee9f3d4555bdcc103d6cd5abc899392335a369ff7fe6201bceb8822d
5
5
  SHA512:
6
- metadata.gz: c6fe31a226014d67e1225234e408030b1e9bab112973e3a312607e26c71c98e6c64d56d7ea2163e0d1cfdd5af3755c384e15c6e11c3166f9478b384f4c0a512f
7
- data.tar.gz: 12c63a9346dc60827b7b5765b6e63ce9d5c814fdb90c0e685952e4751669bb0f0770344830d625070cac6d656958f6bbd2862522cd7d51d1e0cae039bfd0efb5
6
+ metadata.gz: 4028d695ef765ebcc47db502b239153933fd9bab5161aaf6765d8a264c62ab4c60d40fd2bc93985f8eb4eff1838cb749fee6df80ed6baac1af05ecda01b2911c
7
+ data.tar.gz: b9638cb6df1a5647d53cd115fbe708058713d4ea97647c552a82f33b38cb86f11fd4c0b62e9ed83f7f0aa7a732b80fcdaca0d0e04d771f7d89252729aacd8700
@@ -0,0 +1,25 @@
1
+ ## Description of the change
2
+
3
+ > Description here
4
+ ## Type of change
5
+ - [ ] Bug fix (non-breaking change that fixes an issue)
6
+ - [ ] New feature (non-breaking change that adds functionality)
7
+ - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
8
+
9
+ ## Related issues
10
+
11
+ > Fix [#1]()
12
+ ## Checklists
13
+
14
+ ### Development
15
+
16
+ - [ ] Lint rules pass locally
17
+ - [ ] The code changed/added as part of this pull request has been covered with tests
18
+ - [ ] All tests related to the changed code pass in development
19
+
20
+ ### Code review
21
+
22
+ - [ ] This pull request has a descriptive title and information useful to a reviewer. There may be a screenshot or screencast attached
23
+ - [ ] "Ready for review" label attached to the PR and reviewers mentioned in a comment
24
+ - [ ] Changes have been reviewed by at least one other engineer
25
+ - [ ] Issue from task tracker has a link to this pull request
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,137 @@ 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
+ Style/SafeNavigation:
73
+ # Not available in Ruby < 2.3.
74
+ Enabled: false
75
+
76
+ #
77
+ # Performance cops are opt in, and `Enabled: true` is always required.
78
+ # Full list is here: https://github.com/rubocop-hq/rubocop-performance/tree/master/lib/rubocop/cop/performance
79
+ # For travis builds, Codacy will see and use these directives.
80
+ #
81
+ Performance/Caller:
82
+ Enabled: true
83
+ Exclude:
84
+ - spec/**/*
85
+
86
+ Performance/CaseWhenSplat:
87
+ Enabled: true
88
+ Exclude:
89
+ - spec/**/*
90
+
91
+ Performance/Casecmp:
92
+ Enabled: true
93
+ Exclude:
94
+ - spec/**/*
95
+
96
+ Performance/ChainArrayAllocation:
97
+ Enabled: true
98
+ Exclude:
99
+ - spec/**/*
100
+
101
+ Performance/CompareWithBlock:
102
+ Enabled: true
103
+ Exclude:
104
+ - spec/**/*
105
+
106
+ Performance/Count:
107
+ Enabled: true
108
+ Exclude:
109
+ - spec/**/*
110
+
111
+ Performance/Detect:
112
+ Enabled: true
113
+ Exclude:
114
+ - spec/**/*
115
+
116
+ Performance/DoubleStartEndWith:
117
+ Enabled: true
118
+ Exclude:
119
+ - spec/**/*
120
+
121
+ Performance/EndWith:
122
+ Enabled: true
123
+ Exclude:
124
+ - spec/**/*
125
+
126
+ Performance/FixedSize:
127
+ Enabled: true
128
+ Exclude:
129
+ - spec/**/*
130
+
131
+ Performance/FlatMap:
132
+ Enabled: true
133
+ Exclude:
134
+ - spec/**/*
135
+
136
+ Performance/InefficientHashSearch:
137
+ Enabled: true
138
+ Exclude:
139
+ - spec/**/*
140
+
141
+ Performance/OpenStruct:
142
+ Enabled: true
143
+ Exclude:
144
+ - spec/**/*
145
+
146
+ Performance/RangeInclude:
147
+ Enabled: true
148
+ Exclude:
149
+ - spec/**/*
150
+
151
+ Performance/RedundantBlockCall:
152
+ Enabled: true
153
+ Exclude:
154
+ - spec/**/*
155
+
156
+ Performance/RedundantMatch:
157
+ Enabled: true
158
+ Exclude:
159
+ - spec/**/*
160
+
161
+ Performance/RedundantMerge:
162
+ Enabled: true
163
+ Exclude:
164
+ - spec/**/*
165
+
166
+ Performance/RegexpMatch:
167
+ Enabled: true
168
+ Exclude:
169
+ - spec/**/*
170
+
171
+ Performance/ReverseEach:
172
+ Enabled: true
173
+ Exclude:
174
+ - spec/**/*
175
+
176
+ Performance/Size:
177
+ Enabled: true
178
+ Exclude:
179
+ - spec/**/*
180
+
181
+ Performance/StartWith:
182
+ Enabled: true
183
+ Exclude:
184
+ - spec/**/*
185
+
186
+ Performance/StringReplacement:
187
+ Enabled: true
188
+ Exclude:
189
+ - spec/**/*
190
+
191
+ Performance/TimesMap:
192
+ Enabled: true
193
+ Exclude:
194
+ - spec/**/*
195
+
196
+ Performance/UnfreezeString:
197
+ Enabled: true
198
+ Exclude:
199
+ - spec/**/*
200
+
201
+ Performance/UriDefaultParser:
202
+ Enabled: true
203
+ Exclude:
204
+ - 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.0
22
- - 2.6.3
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.0
118
+ - rvm: 2.6.5
128
119
  jdk: openjdk8
129
- - rvm: 2.6.0
120
+ - rvm: 2.6.5
130
121
  jdk: oraclejdk8
131
- - rvm: 2.6.0
122
+ - rvm: 2.6.5
132
123
  jdk: oraclejdk9
133
- - rvm: 2.6.3
124
+ - rvm: 2.7.0
134
125
  jdk: openjdk8
135
- - rvm: 2.6.3
126
+ - rvm: 2.7.0
136
127
  jdk: oraclejdk8
137
- - rvm: 2.6.3
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.0
219
+ - rvm: 2.6.5
226
220
  gemfile: gemfiles/rails30.gemfile
227
- - rvm: 2.6.0
221
+ - rvm: 2.6.5
228
222
  gemfile: gemfiles/rails31.gemfile
229
- - rvm: 2.6.0
223
+ - rvm: 2.6.5
230
224
  gemfile: gemfiles/rails32.gemfile
231
- - rvm: 2.6.0
225
+ - rvm: 2.6.5
232
226
  gemfile: gemfiles/rails40.gemfile
233
- - rvm: 2.6.0
227
+ - rvm: 2.6.5
234
228
  gemfile: gemfiles/rails41.gemfile
235
- - rvm: 2.6.0
229
+ - rvm: 2.6.5
236
230
  gemfile: gemfiles/rails42.gemfile
237
- - rvm: 2.6.3
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.6.3
236
+ - rvm: 2.7.0
240
237
  gemfile: gemfiles/rails31.gemfile
241
- - rvm: 2.6.3
238
+ - rvm: 2.7.0
242
239
  gemfile: gemfiles/rails32.gemfile
243
- - rvm: 2.6.3
240
+ - rvm: 2.7.0
244
241
  gemfile: gemfiles/rails40.gemfile
245
- - rvm: 2.6.3
242
+ - rvm: 2.7.0
246
243
  gemfile: gemfiles/rails41.gemfile
247
- - rvm: 2.6.3
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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # Rollbar-gem
2
- [![Build Status](https://api.travis-ci.org/rollbar/rollbar-gem.svg?branch=master)](https://travis-ci.org/rollbar/rollbar-gem/branches)
2
+ [![Build Status](https://travis-ci.org/rollbar/rollbar-gem.svg?branch=master)](https://travis-ci.org/rollbar/rollbar-gem/branches)
3
3
  [![Gem Version](https://badge.fury.io/rb/rollbar.svg)](http://badge.fury.io/rb/rollbar)
4
4
  [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=rollbar&package-manager=bundler&version-scheme=semver&target-version=latest)](https://dependabot.com/compatibility-score.html?dependency-name=rollbar&package-manager=bundler&version-scheme=semver&new-version=latest)
5
5
 
@@ -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.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}}}}]);
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){"use strict";var n=o(1),t=o(5);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdn.rollbar.com/rollbarjs/refs/tags/v2.19.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){"use strict";var n=o(2),t=o(3);function a(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}var l=0;function i(r,e){this.options=r,this._rollbarOldOnError=null;var o=l++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}var s=o(4),d=function(r,e){return new i(r,e)},c=function(r){return new s(d,r)};function u(r){return a((function(){var e=this,o=Array.prototype.slice.call(arguments,0),n={shim:e,method:r,args:o,ts:new Date};window._rollbarShims[this.shimId()].messages.push(n)}))}i.prototype.loadFull=function(r,e,o,n,t){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=a((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,a,l,i=0;o=r._rollbarShims[i++];)for(o=o.messages||[];n=o.shift();)for(a=n.args||[],i=0;i<a.length;++i)if("function"==typeof(l=a[i])){l(e);break}}"function"==typeof t&&t(e)}()}})),d.insertBefore(i,s)},i.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(","),f=0;f<p.length;++f)i.prototype[p[f]]=u(p[f]);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 l=new c(e);return a((function(){e.captureUncaught&&(l._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,l,!0),e.wrapGlobalEventHandlers&&t(r,l,!0)),e.captureUnhandledRejections&&n.captureUnhandledRejections(r,l,!0);var a=e.autoInstrument;return!1!==e.enabled&&(void 0===a||!0===a||"object"==typeof a&&a.network)&&r.addEventListener&&(r.addEventListener("load",l.captureLoad.bind(l)),r.addEventListener("DOMContentLoaded",l.captureDomContentLoaded.bind(l))),r[o]=l,l}))()}},Rollbar:c}},function(r,e,o){"use strict";function n(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.exports={captureUncaughtExceptions:function(r,e,o){if(r){var t;if("function"==typeof e._rollbarOldOnError)t=e._rollbarOldOnError;else if(r.onerror){for(t=r.onerror;t._rollbarOldOnError;)t=t._rollbarOldOnError;e._rollbarOldOnError=t}e.handleAnonymousErrors();var a=function(){var o=Array.prototype.slice.call(arguments,0);n(r,e,t,o)};o&&(a._rollbarOldOnError=t),r.onerror=a}},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)}}}},function(r,e,o){"use strict";function n(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=function(r,e,o){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&&n(e,r[a].prototype,o)}}},function(r,e,o){"use strict";function n(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])}(n.prototype)}n.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=n},function(r,e,o){"use strict";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}}}}]);
@@ -108,6 +108,13 @@ Rollbar notifier.
108
108
 
109
109
  The number of job failures before reporting the failure to Rollbar.
110
110
 
111
+ ### async_skip_report_handler
112
+
113
+ **Default** `nil`
114
+ **Example** `-> (job) { job.cron? }`
115
+
116
+ A handler, should respond to `#call`, receives the job and returns a boolean. If true, reporting errors will be skipped. If provided, dj_threshold isn't checked.
117
+
111
118
  ### enabled
112
119
 
113
120
  **Default** `true`
@@ -129,6 +136,7 @@ An array of backup handlers if the async handlers fails. Each should respond to
129
136
 
130
137
  For use with `write_to_file`. Indicates location of the rollbar log file being
131
138
  tracked by [rollbar-agent](https://github.com/rollbar/rollbar-agent).
139
+ Enable `files_with_pid_name_enabled` if you want to have different files for each process(only works if extension `rollbar`)
132
140
 
133
141
  ### framework
134
142
 
@@ -27,6 +27,10 @@ platforms :rbx do
27
27
  gem 'rubysl', '~> 2.0' unless RUBY_VERSION.start_with?('1')
28
28
  end
29
29
 
30
+ if RUBY_VERSION < '2.0.0'
31
+ gem 'json', '1.8.6'
32
+ end
33
+
30
34
  if RUBY_VERSION < '2.2.2'
31
35
  gem 'sidekiq', '~> 2.13.0'
32
36
  else
@@ -44,8 +44,12 @@ elsif RUBY_VERSION.start_with?('2')
44
44
  gem 'simplecov'
45
45
  end
46
46
 
47
- # We need last sinatra that uses rack 2.x
48
- gem 'sinatra', :git => 'https://github.com/sinatra/sinatra'
47
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
48
+ gem 'rack', '2.1.2'
49
+ end
50
+
51
+ # We need last sinatra that uses rack 2.1.x
52
+ gem 'sinatra', :git => 'https://github.com/sinatra/sinatra', :tag => 'v2.0.8'
49
53
  gem 'database_cleaner'
50
54
  gem 'delayed_job', :require => false
51
55
  gem 'generator_spec'
@@ -44,8 +44,12 @@ elsif RUBY_VERSION.start_with?('2')
44
44
  gem 'simplecov'
45
45
  end
46
46
 
47
- # We need last sinatra that uses rack 2.x
48
- gem 'sinatra', :git => 'https://github.com/sinatra/sinatra'
47
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3')
48
+ gem 'rack', '2.1.2'
49
+ end
50
+
51
+ # We need last sinatra that uses rack 2.1.x
52
+ gem 'sinatra', :git => 'https://github.com/sinatra/sinatra', :tag => 'v2.0.8'
49
53
 
50
54
  gem 'database_cleaner'
51
55
  gem 'delayed_job', :require => false
@@ -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.0.rc1'
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'
@@ -39,7 +39,7 @@ module Rails
39
39
  end
40
40
 
41
41
  def eval_runner
42
- if Rails.version >= '5.1.0'
42
+ if Gem::Version.new(Rails.version) >= Gem::Version.new('5.1.0')
43
43
  rails5_runner
44
44
  else
45
45
  legacy_runner
@@ -55,6 +55,8 @@ module Rails
55
55
  end
56
56
 
57
57
  def rails5_runner
58
+ require 'rails/command'
59
+
58
60
  Rails::Command.invoke 'runner', ARGV
59
61
  end
60
62
 
@@ -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
  },
@@ -17,13 +17,14 @@ 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
22
+ attr_accessor :async_skip_report_handler
21
23
  attr_accessor :enabled
22
24
  attr_accessor :endpoint
23
25
  attr_accessor :environment
24
26
  attr_accessor :exception_level_filters
25
27
  attr_accessor :failover_handlers
26
- attr_accessor :filepath
27
28
  attr_accessor :framework
28
29
  attr_accessor :ignored_person_ids
29
30
  attr_accessor :host
@@ -57,15 +58,23 @@ 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
- attr_accessor :write_to_file
63
64
  attr_reader :send_extra_frame_data
64
65
  attr_accessor :use_exception_level_filters_default
65
66
  attr_accessor :proxy
66
67
  attr_accessor :raise_on_error
67
68
  attr_accessor :transmit
68
69
  attr_accessor :log_payload
70
+ attr_accessor :backtrace_cleaner
71
+
72
+ attr_accessor :write_to_file
73
+ attr_accessor :filepath
74
+ attr_accessor :files_with_pid_name_enabled
75
+ attr_accessor :files_processed_enabled
76
+ attr_accessor :files_processed_duration # seconds
77
+ attr_accessor :files_processed_size # bytes
69
78
 
70
79
  attr_reader :project_gem_paths
71
80
  attr_accessor :configured_options
@@ -87,7 +96,9 @@ module Rollbar
87
96
  @disable_monkey_patch = false
88
97
  @disable_core_monkey_patch = false
89
98
  @disable_rack_monkey_patch = false
99
+ @enable_error_context = true
90
100
  @dj_threshold = 0
101
+ @async_skip_report_handler = nil
91
102
  @enabled = nil # set to true when configure is called
92
103
  @endpoint = DEFAULT_ENDPOINT
93
104
  @environment = nil
@@ -118,7 +129,7 @@ module Rollbar
118
129
  :api_key, :access_token, :accessToken, :session_id]
119
130
  @scrub_user = true
120
131
  @scrub_password = true
121
- @randomize_scrub_length = true
132
+ @randomize_scrub_length = false
122
133
  @scrub_whitelist = []
123
134
  @uncaught_exception_level = 'error'
124
135
  @scrub_headers = ['Authorization']
@@ -126,10 +137,10 @@ module Rollbar
126
137
  @safely = false
127
138
  @transform = []
128
139
  @use_async = false
140
+ @async_json_payload = false
129
141
  @use_eventmachine = false
130
142
  @verify_ssl_peer = true
131
143
  @web_base = DEFAULT_WEB_BASE
132
- @write_to_file = false
133
144
  @send_extra_frame_data = :none
134
145
  @project_gem_paths = []
135
146
  @use_exception_level_filters_default = false
@@ -139,11 +150,18 @@ module Rollbar
139
150
  @log_payload = false
140
151
  @collect_user_ip = true
141
152
  @anonymize_user_ip = false
153
+ @backtrace_cleaner = nil
142
154
  @hooks = {
143
155
  :on_error_response => nil, # params: response
144
156
  :on_report_internal_error => nil # params: exception
145
157
  }
146
158
 
159
+ @write_to_file = false
160
+ @files_with_pid_name_enabled = false
161
+ @files_processed_enabled = false
162
+ @files_processed_duration = 60
163
+ @files_processed_size = 5 * 1000 * 1000
164
+
147
165
  @configured_options = ConfiguredOptions.new(self)
148
166
  end
149
167
 
@@ -232,9 +250,10 @@ module Rollbar
232
250
  value.is_a?(Hash) ? use_sidekiq(value) : use_sidekiq
233
251
  end
234
252
 
235
- def use_thread
253
+ def use_thread(options = {})
236
254
  require 'rollbar/delay/thread'
237
255
  @use_async = true
256
+ Rollbar::Delay::Thread.options = options
238
257
  @async_handler = Rollbar::Delay::Thread
239
258
  end
240
259
 
@@ -261,7 +280,10 @@ module Rollbar
261
280
  found = Gem::Specification.each.select { |spec| name === spec.name }
262
281
  puts "[Rollbar] No gems found matching #{name.inspect}" if found.empty?
263
282
  found
264
- end.flatten.uniq.map(&:gem_dir)
283
+ end
284
+ @project_gem_paths.flatten!
285
+ @project_gem_paths.uniq!
286
+ @project_gem_paths.map!(&:gem_dir)
265
287
  end
266
288
 
267
289
  def before_process=(*handler)
@@ -12,13 +12,9 @@ module Rollbar
12
12
 
13
13
  def queue
14
14
  @queue ||= queue_class.new(nil, :size => 5) do |payload|
15
- begin
16
- Rollbar.process_from_async_handler(payload)
17
- rescue StandardError
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
@@ -24,9 +24,8 @@ module Rollbar
24
24
 
25
25
  def perform(payload)
26
26
  Rollbar.process_from_async_handler(payload)
27
- rescue StandardError
28
- # Raise the exception so Resque can track the errored job
29
- raise
27
+
28
+ # Do not rescue. Resque will call the error handler.
30
29
  end
31
30
  end
32
31
  end