rollbar 2.19.4 → 2.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/rollbar.snippet.js +1 -1
- data/docs/configuration.md +9 -0
- data/lib/rollbar/configuration.rb +11 -1
- data/lib/rollbar/logger_proxy.rb +5 -1
- data/lib/rollbar/notifier.rb +22 -7
- data/lib/rollbar/request_data_extractor.rb +4 -2
- data/lib/rollbar/scrubbers/params.rb +2 -2
- data/lib/rollbar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e879b78b311e11b9d124caf5d30c8dc9e0d831409a80459430fd557320926cbf
|
4
|
+
data.tar.gz: 5baf629685d3393055192355cf4974321004ed0a3e57b13f045eafe6631e4804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69e943c6de574b2589a3230fdf69159e0378066fb2ec9757e9716f4c839273ec97450d11058dfdd250b7e244e9d70f28bfb0799916b9765e797e5f5ecccbd022
|
7
|
+
data.tar.gz: 5213c8cd89294bd2ab4ac1e2ac9dacb43165449bed85d4dc7b8eae9d6f1b4beb1ac95e7526f5d2e11eb7633e2969c62330f577150732207e11004464384c8a2a
|
data/data/rollbar.snippet.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
!function(r){function o(n){if(e[n])return e[n].exports;var t=e[n]={
|
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}}}}]);
|
data/docs/configuration.md
CHANGED
@@ -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`
|
@@ -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
|
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/logger_proxy.rb
CHANGED
@@ -36,7 +36,11 @@ module Rollbar
|
|
36
36
|
def acceptable_levels
|
37
37
|
@acceptable_levels ||= begin
|
38
38
|
levels = [:debug, :info, :warn, :error]
|
39
|
-
|
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
|
data/lib/rollbar/notifier.rb
CHANGED
@@ -147,13 +147,19 @@ module Rollbar
|
|
147
147
|
level = lookup_exception_level(level, exception,
|
148
148
|
use_exception_level_filters)
|
149
149
|
|
150
|
-
|
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
|
-
|
156
|
-
|
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
|
-
|
212
|
-
|
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)
|
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.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-05-
|
11
|
+
date: 2019-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|