rollbar 2.19.3 → 2.20.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5503cff74b3885c82665a6d7ce5c491be89ba4a66e5176547dbe2249ab1be90b
4
- data.tar.gz: 6cfe51c21ab4bc1ce799b1550f8d2096ed68ac608f41b35fbee170a91d208fd4
3
+ metadata.gz: e879b78b311e11b9d124caf5d30c8dc9e0d831409a80459430fd557320926cbf
4
+ data.tar.gz: 5baf629685d3393055192355cf4974321004ed0a3e57b13f045eafe6631e4804
5
5
  SHA512:
6
- metadata.gz: 63d85d9a87c65605f692ace193e8b1d2da282f73dfb834f38840929cb4d85354212ed0fd9b3d387c31ef8a60a7bf77ec273072b03ac4da645b7c07d118e270a3
7
- data.tar.gz: d7f0973b1f0e6b07fe7f51c08e16e82e35966c575d806c696d40c6b4671786d700d1e121fba63662ccdbddbbf014b3c4fe44af34c1462050c9a8b35cd36aea29
6
+ metadata.gz: 69e943c6de574b2589a3230fdf69159e0378066fb2ec9757e9716f4c839273ec97450d11058dfdd250b7e244e9d70f28bfb0799916b9765e797e5f5ecccbd022
7
+ data.tar.gz: 5213c8cd89294bd2ab4ac1e2ac9dacb43165449bed85d4dc7b8eae9d6f1b4beb1ac95e7526f5d2e11eb7633e2969c62330f577150732207e11004464384c8a2a
data/Gemfile CHANGED
@@ -2,6 +2,13 @@
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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby')
6
13
 
7
14
  gem 'activerecord-jdbcsqlite3-adapter', :platform => :jruby
@@ -47,6 +54,11 @@ elsif RUBY_VERSION.start_with?('2')
47
54
  gem 'sucker_punch', '~> 2.0' # rubocop:disable Bundler/DuplicatedGem
48
55
  end
49
56
 
57
+ unless is_jruby
58
+ # JRuby doesn't support fork, which is required for this test helper.
59
+ gem 'rspec-command'
60
+ end
61
+
50
62
  gem 'aws-sdk-sqs'
51
63
  gem 'database_cleaner'
52
64
  gem 'delayed_job', :require => false
@@ -54,7 +66,6 @@ gem 'generator_spec'
54
66
  gem 'girl_friday', '>= 0.11.1'
55
67
  gem 'redis'
56
68
  gem 'resque', '< 2.0.0'
57
- gem 'rspec-command'
58
69
  gem 'rubocop', :require => false
59
70
  gem 'sinatra'
60
71
  gem 'webmock', :require => false
@@ -1 +1 @@
1
- !function(r){function o(n){if(e[n])return e[n].exports;var t=e[n]={exports:{},id:n,loaded:!1};return r[n].call(t.exports,t,t.exports,o),t.loaded=!0,t.exports}var e={};return o.m=r,o.c=e,o.p="",o(0)}([function(r,o,e){"use strict";var n=e(1),t=e(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.5.4/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,o,e){"use strict";function n(r){return function(){try{return r.apply(this,arguments)}catch(r){try{console.error("[Rollbar]: Internal error",r)}catch(r){}}}}function t(r,o){this.options=r,this._rollbarOldOnError=null;var e=s++;this.shimId=function(){return e},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[e]={handler:o,messages:[]})}function a(r,o){if(r){var e=o.globalAlias||"Rollbar";if("object"==typeof r[e])return r[e];r._rollbarShims={},r._rollbarWrappedError=null;var t=new p(o);return n(function(){o.captureUncaught&&(t._rollbarOldOnError=r.onerror,i.captureUncaughtExceptions(r,t,!0),i.wrapGlobals(r,t,!0)),o.captureUnhandledRejections&&i.captureUnhandledRejections(r,t,!0);var n=o.autoInstrument;return o.enabled!==!1&&(void 0===n||n===!0||"object"==typeof n&&n.network)&&r.addEventListener&&(r.addEventListener("load",t.captureLoad.bind(t)),r.addEventListener("DOMContentLoaded",t.captureDomContentLoaded.bind(t))),r[e]=t,t})()}}function l(r){return n(function(){var o=this,e=Array.prototype.slice.call(arguments,0),n={shim:o,method:r,args:e,ts:new Date};window._rollbarShims[this.shimId()].messages.push(n)})}var i=e(2),s=0,d=e(3),c=function(r,o){return new t(r,o)},p=function(r){return new d(c,r)};t.prototype.loadFull=function(r,o,e,t,a){var l=function(){var o;if(void 0===r._rollbarDidLoad){o=new Error("rollbar.js did not load");for(var e,n,t,l,i=0;e=r._rollbarShims[i++];)for(e=e.messages||[];n=e.shift();)for(t=n.args||[],i=0;i<t.length;++i)if(l=t[i],"function"==typeof l){l(o);break}}"function"==typeof a&&a(o)},i=!1,s=o.createElement("script"),d=o.getElementsByTagName("script")[0],c=d.parentNode;s.crossOrigin="",s.src=t.rollbarJsUrl,e||(s.async=!0),s.onload=s.onreadystatechange=n(function(){if(!(i||this.readyState&&"loaded"!==this.readyState&&"complete"!==this.readyState)){s.onload=s.onreadystatechange=null;try{c.removeChild(s)}catch(r){}i=!0,l()}}),c.insertBefore(s,d)},t.prototype.wrap=function(r,o,e){try{var n;if(n="function"==typeof o?o:function(){return o||{}},"function"!=typeof r)return r;if(r._isWrap)return r;if(!r._rollbar_wrapped&&(r._rollbar_wrapped=function(){e&&"function"==typeof e&&e.apply(this,arguments);try{return r.apply(this,arguments)}catch(e){var o=e;throw o&&("string"==typeof o&&(o=new String(o)),o._rollbarContext=n()||{},o._rollbarContext._wrappedSource=r.toString(),window._rollbarWrappedError=o),o}},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(o){return r}};for(var u="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),f=0;f<u.length;++f)t.prototype[u[f]]=l(u[f]);r.exports={setupShim:a,Rollbar:p}},function(r,o){"use strict";function e(r,o,e){if(r){var t;if("function"==typeof o._rollbarOldOnError)t=o._rollbarOldOnError;else if(r.onerror){for(t=r.onerror;t._rollbarOldOnError;)t=t._rollbarOldOnError;o._rollbarOldOnError=t}var a=function(){var e=Array.prototype.slice.call(arguments,0);n(r,o,t,e)};e&&(a._rollbarOldOnError=t),r.onerror=a}}function n(r,o,e,n){r._rollbarWrappedError&&(n[4]||(n[4]=r._rollbarWrappedError),n[5]||(n[5]=r._rollbarWrappedError._rollbarContext),r._rollbarWrappedError=null),o.handleUncaughtException.apply(o,n),e&&e.apply(r,n)}function t(r,o,e){if(r){"function"==typeof r._rollbarURH&&r._rollbarURH.belongsToShim&&r.removeEventListener("unhandledrejection",r._rollbarURH);var n=function(r){var e,n,t;try{e=r.reason}catch(r){e=void 0}try{n=r.promise}catch(r){n="[unhandledrejection] error getting `promise` from event"}try{t=r.detail,!e&&t&&(e=t.reason,n=t.promise)}catch(r){}e||(e="[unhandledrejection] error getting `reason` from event"),o&&o.handleUnhandledRejection&&o.handleUnhandledRejection(e,n)};n.belongsToShim=e,r._rollbarURH=n,r.addEventListener("unhandledrejection",n)}}function a(r,o,e){if(r){var n,t,a="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(n=0;n<a.length;++n)t=a[n],r[t]&&r[t].prototype&&l(o,r[t].prototype,e)}}function l(r,o,e){if(o.hasOwnProperty&&o.hasOwnProperty("addEventListener")){for(var n=o.addEventListener;n._rollbarOldAdd&&n.belongsToShim;)n=n._rollbarOldAdd;var t=function(o,e,t){n.call(this,o,r.wrap(e),t)};t._rollbarOldAdd=n,t.belongsToShim=e,o.addEventListener=t;for(var a=o.removeEventListener;a._rollbarOldRemove&&a.belongsToShim;)a=a._rollbarOldRemove;var l=function(r,o,e){a.call(this,r,o&&o._rollbar_wrapped||o,e)};l._rollbarOldRemove=a,l.belongsToShim=e,o.removeEventListener=l}}r.exports={captureUncaughtExceptions:e,captureUnhandledRejections:t,wrapGlobals:a}},function(r,o){"use strict";function e(r,o){this.impl=r(o,this),this.options=o,n(e.prototype)}function n(r){for(var o=function(r){return function(){var o=Array.prototype.slice.call(arguments,0);if(this.impl[r])return this.impl[r].apply(this.impl,o)}},e="log,debug,info,warn,warning,error,critical,global,configure,handleUncaughtException,handleUnhandledRejection,_createItem,wrap,loadFull,shimId,captureEvent,captureDomContentLoaded,captureLoad".split(","),n=0;n<e.length;n++)r[e[n]]=o(e[n])}e.prototype._swapAndProcessMessages=function(r,o){this.impl=r(this.options);for(var e,n,t;e=o.shift();)n=e.method,t=e.args,this[n]&&"function"==typeof this[n]&&("captureDomContentLoaded"===n||"captureLoad"===n?this[n].apply(this,[t[0],e.ts]):this[n].apply(this,t));return this},r.exports=e},function(r,o){"use strict";r.exports=function(r){return function(o){if(!o&&!window._rollbarInitialized){r=r||{};for(var e,n,t=r.globalAlias||"Rollbar",a=window.rollbar,l=function(r){return new a(r)},i=0;e=window._rollbarShims[i++];)n||(n=e.handler),e.handler._swapAndProcessMessages(l,e.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){var n=o(1),t=o(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.7.1/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),d=function(r,e){return new l(r,e)},c=function(r){return new i(d,r)};function s(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"),d=e.getElementsByTagName("script")[0],c=d.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{c.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)}()}}),c.insertBefore(i,d)},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,handleUnhandledRejection,captureEvent,captureDomContentLoaded,captureLoad".split(","),u=0;u<p.length;++u)l.prototype[p[u]]=s(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 c(e);return t(function(){e.captureUncaught&&(a._rollbarOldOnError=r.onerror,n.captureUncaughtExceptions(r,a,!0),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:c}},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}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),e.handleUncaughtException.apply(e,n),o&&o.apply(r,n)}(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,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}}}}]);
@@ -242,6 +242,15 @@ Fields to scrub out of the parsed request data. Will scrub from `GET`, `POST`,
242
242
  url, and several other locations. Does not currently recurse into the full
243
243
  payload.
244
244
 
245
+ If set to `[:scrub_all]` it will scrub all fields. It will not scrub anything
246
+ that is in the scrub_whitelist configuration array even if :scrub_all is true.
247
+
248
+ ### scrub_whitelist
249
+
250
+ Set the list of fields to be whitelisted when `scrub_fields` is set to `[:scrub_all]`.
251
+
252
+ Supports regex entries for partial matching e.g. `[:foo, /\A.+_id\z/, :bar]`
253
+
245
254
  ### scrub_user
246
255
 
247
256
  **Default** `true`
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'sqlite3', '< 1.4.0', :platform => [:ruby, :mswin, :mingw]
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'appraisal'
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'appraisal'
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'appraisal'
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
  is_not_jruby = !is_jruby
7
14
 
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'appraisal'
@@ -53,10 +60,14 @@ gem 'database_cleaner'
53
60
  gem 'delayed_job', :require => false
54
61
  gem 'generator_spec'
55
62
  gem 'girl_friday', '>= 0.11.1'
56
- gem 'rspec-command'
57
63
  gem 'redis'
58
64
  gem 'resque'
59
65
 
66
+ unless is_jruby
67
+ # JRuby doesn't support fork, which is required for this test helper.
68
+ gem 'rspec-command'
69
+ end
70
+
60
71
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
61
72
  gem 'mime-types', '< 3.0'
62
73
  end
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'appraisal'
@@ -54,10 +61,14 @@ gem 'database_cleaner'
54
61
  gem 'delayed_job', :require => false
55
62
  gem 'generator_spec'
56
63
  gem 'girl_friday', '>= 0.11.1'
57
- gem 'rspec-command'
58
64
  gem 'redis'
59
65
  gem 'resque'
60
66
 
67
+ unless is_jruby
68
+ # JRuby doesn't support fork, which is required for this test helper.
69
+ gem 'rspec-command'
70
+ end
71
+
61
72
  if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.0')
62
73
  gem 'mime-types', '< 3.0'
63
74
  end
@@ -2,6 +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
+
5
12
  is_jruby = defined?(JRUBY_VERSION) || (defined?(RUBY_ENGINE) && 'jruby' == RUBY_ENGINE)
6
13
 
7
14
  gem 'appraisal'
@@ -47,11 +54,15 @@ gem 'codacy-coverage'
47
54
  gem 'delayed_job', :require => false
48
55
  gem 'generator_spec'
49
56
  gem 'girl_friday', '>= 0.11.1'
50
- gem 'rspec-command'
51
57
  gem 'redis'
52
58
  gem 'resque'
53
59
  gem 'simplecov'
54
60
 
61
+ unless is_jruby
62
+ # JRuby doesn't support fork, which is required for this test helper.
63
+ gem 'rspec-command'
64
+ end
65
+
55
66
  gem 'mime-types'
56
67
 
57
68
  gem 'webmock', :require => false
@@ -39,7 +39,7 @@ module Rails
39
39
  end
40
40
 
41
41
  def eval_runner
42
- if Rails.version >= '5.0.0'
42
+ if Rails.version >= '5.1.0'
43
43
  rails5_runner
44
44
  else
45
45
  legacy_runner
@@ -63,6 +63,9 @@ module Rollbar
63
63
  attr_reader :send_extra_frame_data
64
64
  attr_accessor :use_exception_level_filters_default
65
65
  attr_accessor :proxy
66
+ attr_accessor :raise_on_error
67
+ attr_accessor :transmit
68
+ attr_accessor :log_payload
66
69
 
67
70
  attr_reader :project_gem_paths
68
71
 
@@ -130,6 +133,9 @@ module Rollbar
130
133
  @project_gem_paths = []
131
134
  @use_exception_level_filters_default = false
132
135
  @proxy = nil
136
+ @raise_on_error = false
137
+ @transmit = true
138
+ @log_payload = false
133
139
  @collect_user_ip = true
134
140
  @anonymize_user_ip = false
135
141
  @hooks = {
@@ -270,7 +276,11 @@ module Rollbar
270
276
  end
271
277
 
272
278
  def logger_level=(level)
273
- @logger_level = level.to_sym
279
+ @logger_level = if level
280
+ level.to_sym
281
+ else
282
+ level
283
+ end
274
284
  end
275
285
 
276
286
  def logger
data/lib/rollbar/item.rb CHANGED
@@ -106,25 +106,37 @@ module Rollbar
106
106
  # Ensure all keys are strings since we can receive the payload inline or
107
107
  # from an async handler job, which can be serialized.
108
108
  stringified_payload = Util::Hash.deep_stringify_keys(payload)
109
- result = Truncation.truncate(stringified_payload)
109
+ attempts = []
110
+ result = Truncation.truncate(stringified_payload, attempts)
110
111
 
111
112
  return result unless Truncation.truncate?(result)
112
113
 
113
- handle_too_large_payload(stringified_payload, result)
114
+ handle_too_large_payload(stringified_payload, result, attempts)
114
115
 
115
116
  nil
116
117
  end
117
118
 
118
- def handle_too_large_payload(stringified_payload, final_payload)
119
- original_size = Rollbar::JSON.dump(stringified_payload).bytesize
120
- final_size = final_payload.bytesize
119
+ def handle_too_large_payload(stringified_payload, final_payload, attempts)
121
120
  uuid = stringified_payload['data']['uuid']
122
121
  host = stringified_payload['data'].fetch('server', {})['host']
123
122
 
124
- notifier.send_failsafe("Could not send payload due to it being too large after truncating attempts. Original size: #{original_size} Final size: #{final_size}", nil, uuid, host)
123
+ notifier.send_failsafe(
124
+ too_large_payload_string(stringified_payload, final_payload, attempts),
125
+ nil,
126
+ uuid,
127
+ host
128
+ )
125
129
  logger.error("[Rollbar] Payload too large to be sent for UUID #{uuid}: #{Rollbar::JSON.dump(payload)}")
126
130
  end
127
131
 
132
+ def too_large_payload_string(stringified_payload, final_payload, attempts)
133
+ original_size = Rollbar::JSON.dump(stringified_payload).bytesize
134
+ final_size = final_payload.bytesize
135
+
136
+ 'Could not send payload due to it being too large after truncating attempts. ' \
137
+ "Original size: #{original_size} Attempts: #{attempts.join(', ')} Final size: #{final_size}"
138
+ end
139
+
128
140
  def ignored?
129
141
  data = payload['data']
130
142
 
@@ -36,7 +36,11 @@ module Rollbar
36
36
  def acceptable_levels
37
37
  @acceptable_levels ||= begin
38
38
  levels = [:debug, :info, :warn, :error]
39
- levels[levels.find_index(Rollbar.configuration.logger_level)..-1]
39
+ if Rollbar.configuration.logger_level
40
+ levels[levels.find_index(Rollbar.configuration.logger_level)..-1]
41
+ else
42
+ []
43
+ end
40
44
  end
41
45
  end
42
46
  end
@@ -147,13 +147,19 @@ module Rollbar
147
147
  level = lookup_exception_level(level, exception,
148
148
  use_exception_level_filters)
149
149
 
150
- begin
151
- report(level, message, exception, extra, context)
152
- rescue StandardError, SystemStackError => e
153
- report_internal_error(e)
150
+ ret = report_with_rescue(level, message, exception, extra, context)
154
151
 
155
- 'error'
156
- end
152
+ raise(exception) if configuration.raise_on_error && exception
153
+
154
+ ret
155
+ end
156
+
157
+ def report_with_rescue(level, message, exception, extra, context)
158
+ report(level, message, exception, extra, context)
159
+ rescue StandardError, SystemStackError => e
160
+ report_internal_error(e)
161
+
162
+ 'error'
157
163
  end
158
164
 
159
165
  # See log() above
@@ -429,15 +435,24 @@ module Rollbar
429
435
 
430
436
  return 'ignored' if item.ignored?
431
437
 
432
- schedule_item(item)
438
+ schedule_item(item) if configuration.transmit
439
+
440
+ log_and_return_item_data(item)
441
+ end
433
442
 
443
+ def log_and_return_item_data(item)
434
444
  data = item['data']
435
445
  log_instance_link(data)
436
446
  Rollbar.last_report = data
447
+ log_data(data) if configuration.log_payload
437
448
 
438
449
  data
439
450
  end
440
451
 
452
+ def log_data(data)
453
+ log_info "[Rollbar] Data: #{data}"
454
+ end
455
+
441
456
  # Reports an internal error in the Rollbar library. This will be reported within the configured
442
457
  # Rollbar project. We'll first attempt to provide a report including the exception traceback.
443
458
  # If that fails, we'll fall back to a more static failsafe response.
@@ -208,8 +208,10 @@ module Rollbar
208
208
  end
209
209
 
210
210
  def json_request?(rack_req)
211
- !!(rack_req.env['CONTENT_TYPE'] =~ %r{application/json} ||
212
- rack_req.env['ACCEPT'] =~ /\bjson\b/)
211
+ json_regex = /\bjson\b/
212
+
213
+ !!(rack_req.env['CONTENT_TYPE'] =~ json_regex ||
214
+ rack_req.env['HTTP_ACCEPT'] =~ json_regex)
213
215
  end
214
216
 
215
217
  def rollbar_route_params(env)
@@ -52,10 +52,10 @@ module Rollbar
52
52
  end
53
53
 
54
54
  def build_whitelist_regex(whitelist)
55
- fields = whitelist.find_all { |f| f.is_a?(String) || f.is_a?(Symbol) }
55
+ fields = whitelist.find_all { |f| f.is_a?(String) || f.is_a?(Symbol) || f.is_a?(Regexp) }
56
56
  return unless fields.any?
57
57
 
58
- Regexp.new(fields.map { |val| /\A#{Regexp.escape(val.to_s)}\z/ }.join('|'))
58
+ Regexp.new(fields.map { |val| val.is_a?(Regexp) ? val : /\A#{Regexp.escape(val.to_s)}\z/ }.join('|'))
59
59
  end
60
60
 
61
61
  def scrub(params, options)
@@ -15,11 +15,12 @@ module Rollbar
15
15
  StringsStrategy,
16
16
  MinBodyStrategy].freeze
17
17
 
18
- def self.truncate(payload)
18
+ def self.truncate(payload, attempts = [])
19
19
  result = nil
20
20
 
21
21
  STRATEGIES.each do |strategy|
22
22
  result = strategy.call(payload)
23
+ attempts << result.bytesize
23
24
  break unless truncate?(result)
24
25
  end
25
26
 
@@ -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, 64].freeze
10
10
 
11
11
  def self.call(payload)
12
12
  new.call(payload)
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '2.19.3'.freeze
2
+ VERSION = '2.20.0'.freeze
3
3
  end
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.19.3
4
+ version: 2.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rollbar, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json
@@ -169,7 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  - !ruby/object:Gem::Version
170
170
  version: '0'
171
171
  requirements: []
172
- rubygems_version: 3.0.1
172
+ rubyforge_project:
173
+ rubygems_version: 2.7.7
173
174
  signing_key:
174
175
  specification_version: 4
175
176
  summary: Reports exceptions to Rollbar