rollbar 2.16.4 → 2.17.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 +4 -4
- data/README.md +4 -2
- data/data/rollbar.snippet.js +1 -1
- data/docs/configuration.md +6 -0
- data/lib/rollbar/configuration.rb +10 -1
- data/lib/rollbar/delay/shoryuken.rb +15 -9
- data/lib/rollbar/logger_proxy.rb +10 -1
- data/lib/rollbar/middleware/js.rb +2 -2
- data/lib/rollbar/notifier.rb +1 -1
- data/lib/rollbar/plugins/sidekiq/plugin.rb +5 -2
- data/lib/rollbar/version.rb +1 -1
- data/spec/rollbar/delay/shoryuken_spec.rb +44 -0
- data/spec/rollbar/logger_proxy_spec.rb +19 -0
- data/spec/rollbar/middleware/js_spec.rb +4 -4
- data/spec/rollbar/notifier_spec.rb +15 -4
- data/spec/rollbar/plugins/sidekiq_spec.rb +7 -9
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80c4468fc2e5243d35fc86e2f4787012d996ef58
|
|
4
|
+
data.tar.gz: 3469d5b5650578975879fa8962f499d7a1aea52c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 20890794849d8a1db3b4cf0947cf84e9c824d60e81ae4c65ebeca3cf6705357bf90b98d21185d8aa038d378f420799131884529a9eb525ca3630c4c1ecae7d3b
|
|
7
|
+
data.tar.gz: 62b215e34d6b9d30123bd79069e59fd284bf19ba870db97a78d88e9c91414b67daf32c9ebb9e910305b3baa9428954815c17c998504e7a12c4ba47e0bd8b0750
|
data/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
# Rollbar-gem
|
|
1
|
+
# Rollbar-gem
|
|
2
2
|
[](https://travis-ci.org/rollbar/rollbar-gem/branches)
|
|
3
|
+
[](http://badge.fury.io/rb/rollbar)
|
|
4
|
+
[](https://dependabot.com/compatibility-score.html?dependency-name=rollbar&package-manager=bundler&version-scheme=semver&new-version=latest)
|
|
3
5
|
|
|
4
6
|
[Rollbar](https://rollbar.com) is a real-time exception reporting service for Ruby and other languages. The Rollbar service will alert you of problems with your code and help you understand them in a ways never possible before. We love it and we hope you will too.
|
|
5
7
|
|
|
@@ -13,7 +15,7 @@ Rollbar-gem is the SDK for Ruby apps and includes support for apps using Rails,
|
|
|
13
15
|
## Usage and Reference
|
|
14
16
|
|
|
15
17
|
For complete usage instructions and configuration reference, see our [Ruby SDK docs](https://docs.rollbar.com/docs/ruby).
|
|
16
|
-
|
|
18
|
+
|
|
17
19
|
## Release History & Changelog
|
|
18
20
|
|
|
19
21
|
See our [Releases](https://github.com/rollbar/rollbar-gem/releases) page for a list of all releases, including changes.
|
data/data/rollbar.snippet.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(r){function e(n){if(o[n])return o[n].exports;var t=o[n]={exports:{},id:n,loaded:!1};return r[n].call(t.exports,t,t.exports,e),t.loaded=!0,t.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";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){function e(n){if(o[n])return o[n].exports;var t=o[n]={exports:{},id:n,loaded:!1};return r[n].call(t.exports,t,t.exports,e),t.loaded=!0,t.exports}var o={};return e.m=r,e.c=o,e.p="",e(0)}([function(r,e,o){"use strict";var n=o(1),t=o(4);_rollbarConfig=_rollbarConfig||{},_rollbarConfig.rollbarJsUrl=_rollbarConfig.rollbarJsUrl||"https://cdnjs.cloudflare.com/ajax/libs/rollbar.js/2.4.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,e,o){"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,e){this.options=r,this._rollbarOldOnError=null;var o=s++;this.shimId=function(){return o},"undefined"!=typeof window&&window._rollbarShims&&(window._rollbarShims[o]={handler:e,messages:[]})}function a(r,e){if(r){var o=e.globalAlias||"Rollbar";if("object"==typeof r[o])return r[o];r._rollbarShims={},r._rollbarWrappedError=null;var t=new p(e);return n(function(){e.captureUncaught&&(t._rollbarOldOnError=r.onerror,i.captureUncaughtExceptions(r,t,!0),i.wrapGlobals(r,t,!0)),e.captureUnhandledRejections&&i.captureUnhandledRejections(r,t,!0);var n=e.autoInstrument;return e.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[o]=t,t})()}}function l(r){return n(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)})}var i=o(2),s=0,d=o(3),c=function(r,e){return new t(r,e)},p=function(r){return new d(c,r)};t.prototype.loadFull=function(r,e,o,t,a){var l=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(l=t[i],"function"==typeof l){l(e);break}}"function"==typeof a&&a(e)},i=!1,s=e.createElement("script"),d=e.getElementsByTagName("script")[0],c=d.parentNode;s.crossOrigin="",s.src=t.rollbarJsUrl,o||(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,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 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,e){"use strict";function o(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}var a=function(){var o=Array.prototype.slice.call(arguments,0);n(r,e,t,o)};o&&(a._rollbarOldOnError=t),r.onerror=a}}function n(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)}function t(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){t="[unhandledrejection] error getting `detail` from event"}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 a(r,e,o){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(e,r[t].prototype,o)}}function l(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:o,captureUnhandledRejections:t,wrapGlobals:a}},function(r,e){"use strict";function o(r,e){this.impl=r(e,this),this.options=e,n(o.prototype)}function n(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._swapAndProcessMessages=function(r,e){this.impl=r(this.options);for(var o,n,t;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){"use strict";r.exports=function(r){return function(e){if(!e&&!window._rollbarInitialized){r=r||{};for(var o,n,t=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
|
@@ -64,6 +64,12 @@ end
|
|
|
64
64
|
What logger to use for printing debugging and informational messages during
|
|
65
65
|
operation.
|
|
66
66
|
|
|
67
|
+
### logger_level
|
|
68
|
+
|
|
69
|
+
**Default** `:info`
|
|
70
|
+
|
|
71
|
+
Regardless of what Logger you're using, Rollbar will not proxy logs to it if its less than this particular level.
|
|
72
|
+
|
|
67
73
|
### disable_monkey_patch
|
|
68
74
|
|
|
69
75
|
**Default** `false`
|
|
@@ -12,6 +12,7 @@ module Rollbar
|
|
|
12
12
|
attr_accessor :custom_data_method
|
|
13
13
|
attr_accessor :delayed_job_enabled
|
|
14
14
|
attr_accessor :default_logger
|
|
15
|
+
attr_reader :logger_level
|
|
15
16
|
attr_accessor :disable_monkey_patch
|
|
16
17
|
attr_accessor :disable_rack_monkey_patch
|
|
17
18
|
attr_accessor :disable_core_monkey_patch
|
|
@@ -74,6 +75,7 @@ module Rollbar
|
|
|
74
75
|
@code_version = nil
|
|
75
76
|
@custom_data_method = nil
|
|
76
77
|
@default_logger = lambda { ::Logger.new(STDERR) }
|
|
78
|
+
@logger_level = :info
|
|
77
79
|
@delayed_job_enabled = true
|
|
78
80
|
@disable_monkey_patch = false
|
|
79
81
|
@disable_core_monkey_patch = false
|
|
@@ -179,8 +181,11 @@ module Rollbar
|
|
|
179
181
|
@async_handler = Rollbar::Delay::Resque
|
|
180
182
|
end
|
|
181
183
|
|
|
182
|
-
def use_shoryuken
|
|
184
|
+
def use_shoryuken(options = {})
|
|
183
185
|
require 'rollbar/delay/shoryuken' if defined?(Shoryuken)
|
|
186
|
+
|
|
187
|
+
Rollbar::Delay::Shoryuken.queue = options[:queue] if options[:queue]
|
|
188
|
+
|
|
184
189
|
@use_async = true
|
|
185
190
|
@async_handler = Rollbar::Delay::Shoryuken
|
|
186
191
|
end
|
|
@@ -247,6 +252,10 @@ module Rollbar
|
|
|
247
252
|
send(option)
|
|
248
253
|
end
|
|
249
254
|
|
|
255
|
+
def logger_level=(level)
|
|
256
|
+
@logger_level = level.to_sym
|
|
257
|
+
end
|
|
258
|
+
|
|
250
259
|
def logger
|
|
251
260
|
@logger ||= default_logger.call
|
|
252
261
|
end
|
|
@@ -8,22 +8,28 @@ module Rollbar
|
|
|
8
8
|
class Shoryuken
|
|
9
9
|
include ::Shoryuken::Worker
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
class << self
|
|
12
|
+
attr_accessor :queue
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
self.queue = "rollbar_#{Rollbar.configuration.environment}"
|
|
16
|
+
|
|
17
|
+
def self.call(payload)
|
|
18
|
+
new.call(payload, :queue => queue)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def call(payload, options = {})
|
|
22
|
+
self.class.perform_async(payload, options)
|
|
13
23
|
end
|
|
14
24
|
|
|
15
25
|
# not allowing bulk, to not double-report rollbars if one of them failed in bunch.
|
|
16
|
-
shoryuken_options :
|
|
26
|
+
shoryuken_options :auto_delete => true,
|
|
27
|
+
:body_parser => :json,
|
|
28
|
+
:retry_intervals => [60, 180, 360, 120_0, 360_0, 186_00]
|
|
17
29
|
|
|
18
|
-
## responsible for performing job. - payload is a json parsed body of the message.
|
|
19
30
|
def perform(_sqs_message, payload)
|
|
20
31
|
Rollbar.process_from_async_handler(payload)
|
|
21
32
|
end
|
|
22
|
-
|
|
23
|
-
## to push the job !
|
|
24
|
-
def call(payload)
|
|
25
|
-
self.class.perform_async(payload)
|
|
26
|
-
end
|
|
27
33
|
end
|
|
28
34
|
end
|
|
29
35
|
end
|
data/lib/rollbar/logger_proxy.rb
CHANGED
|
@@ -23,12 +23,21 @@ module Rollbar
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def log(level, message)
|
|
26
|
-
return unless Rollbar.configuration.enabled
|
|
26
|
+
return unless Rollbar.configuration.enabled && acceptable_levels.include?(level.to_sym)
|
|
27
27
|
|
|
28
28
|
@object.send(level, message)
|
|
29
29
|
rescue
|
|
30
30
|
puts "[Rollbar] Error logging #{level}:"
|
|
31
31
|
puts "[Rollbar] #{message}"
|
|
32
32
|
end
|
|
33
|
+
|
|
34
|
+
protected
|
|
35
|
+
|
|
36
|
+
def acceptable_levels
|
|
37
|
+
@acceptable_levels ||= begin
|
|
38
|
+
levels = [:debug, :info, :warn, :error]
|
|
39
|
+
levels[levels.find_index(Rollbar.configuration.logger_level)..-1]
|
|
40
|
+
end
|
|
41
|
+
end
|
|
33
42
|
end
|
|
34
43
|
end
|
|
@@ -157,8 +157,8 @@ module Rollbar
|
|
|
157
157
|
def append_nonce?
|
|
158
158
|
defined?(::SecureHeaders) && ::SecureHeaders.respond_to?(:content_security_policy_script_nonce) &&
|
|
159
159
|
defined?(::SecureHeaders::Configuration) &&
|
|
160
|
-
!::SecureHeaders::Configuration.
|
|
161
|
-
!::SecureHeaders::Configuration.
|
|
160
|
+
!::SecureHeaders::Configuration.default.csp.opt_out? &&
|
|
161
|
+
!::SecureHeaders::Configuration.default.current_csp[:script_src].to_a.include?("'unsafe-inline'")
|
|
162
162
|
end
|
|
163
163
|
end
|
|
164
164
|
end
|
data/lib/rollbar/notifier.rb
CHANGED
|
@@ -339,7 +339,7 @@ module Rollbar
|
|
|
339
339
|
message = arg
|
|
340
340
|
elsif arg.is_a?(Exception)
|
|
341
341
|
exception = arg
|
|
342
|
-
elsif RUBY_PLATFORM == 'java' && arg.is_a?(java.lang.
|
|
342
|
+
elsif RUBY_PLATFORM == 'java' && arg.is_a?(java.lang.Throwable)
|
|
343
343
|
exception = arg
|
|
344
344
|
elsif arg.is_a?(Hash)
|
|
345
345
|
extra = arg
|
|
@@ -39,8 +39,11 @@ module Rollbar
|
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
def self.skip_report?(job_hash, e)
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
return false if job_hash.nil?
|
|
43
|
+
# when rollbar middleware catches, sidekiq's retry_job processor hasn't set
|
|
44
|
+
# the retry_count for the current job yet, so adding 1 gives the actual retry count
|
|
45
|
+
actual_retry_count = job_hash.fetch('retry_count', -1) + 1
|
|
46
|
+
job_hash['retry'] && actual_retry_count < ::Rollbar.configuration.sidekiq_threshold
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
def call(worker, msg, queue)
|
data/lib/rollbar/version.rb
CHANGED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'rollbar/delay/shoryuken'
|
|
5
|
+
rescue LoadError
|
|
6
|
+
module Rollbar
|
|
7
|
+
module Delay
|
|
8
|
+
class Shoryuken; end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe Rollbar::Delay::Shoryuken, :if => RUBY_VERSION != '1.8.7' && RUBY_VERSION != '1.9.2' do
|
|
14
|
+
describe '.call' do
|
|
15
|
+
let(:payload) do
|
|
16
|
+
{ :key => 'value' }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
let(:loaded_hash) do
|
|
20
|
+
Rollbar::JSON.load(Rollbar::JSON.dump(payload))
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it 'process the payload' do
|
|
24
|
+
Shoryuken.worker_executor = Shoryuken::Worker::InlineExecutor
|
|
25
|
+
expect(Rollbar).to receive(:process_from_async_handler).with(loaded_hash)
|
|
26
|
+
described_class.call(payload)
|
|
27
|
+
Shoryuken.worker_executor = Shoryuken::Worker::DefaultExecutor
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
context 'with non-default queue name' do
|
|
31
|
+
let(:sqs_queue) { double('non_default_queue') }
|
|
32
|
+
|
|
33
|
+
before do
|
|
34
|
+
Rollbar.configure { |config| config.use_shoryuken(:queue => 'non_default_queue') }
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'uses specified queue' do
|
|
38
|
+
expect(Shoryuken::Client).to receive(:queues).with('non_default_queue').and_return(sqs_queue)
|
|
39
|
+
expect(sqs_queue).to receive(:send_message)
|
|
40
|
+
described_class.call(payload)
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
@@ -8,6 +8,7 @@ describe Rollbar::LoggerProxy do
|
|
|
8
8
|
|
|
9
9
|
before do
|
|
10
10
|
allow(Rollbar.configuration).to receive(:enabled).and_return(true)
|
|
11
|
+
allow(Rollbar.configuration).to receive(:logger_level).and_return(:debug)
|
|
11
12
|
end
|
|
12
13
|
|
|
13
14
|
shared_examples 'delegate to logger' do
|
|
@@ -46,5 +47,23 @@ describe Rollbar::LoggerProxy do
|
|
|
46
47
|
expect { subject.log('info', message) }.not_to raise_error
|
|
47
48
|
end
|
|
48
49
|
end
|
|
50
|
+
|
|
51
|
+
context 'if logger_level is :info' do
|
|
52
|
+
before do
|
|
53
|
+
allow(Rollbar.configuration).to receive(:logger_level).and_return(:info)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'doesnt call the logger (debug)' do
|
|
57
|
+
expect(logger).to_not receive(:debug)
|
|
58
|
+
|
|
59
|
+
subject.log('debug', 'foo')
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
it 'calls the logger (error)' do
|
|
63
|
+
expect(logger).to receive(:error)
|
|
64
|
+
|
|
65
|
+
subject.log('error', 'foo')
|
|
66
|
+
end
|
|
67
|
+
end
|
|
49
68
|
end
|
|
50
69
|
end
|
|
@@ -177,7 +177,7 @@ END
|
|
|
177
177
|
Object.const_set('SecureHeaders', Module.new)
|
|
178
178
|
SecureHeaders.const_set('VERSION', '3.0.0')
|
|
179
179
|
SecureHeaders.const_set('Configuration', Module.new {
|
|
180
|
-
def self.
|
|
180
|
+
def self.default
|
|
181
181
|
end
|
|
182
182
|
})
|
|
183
183
|
allow(SecureHeaders).to receive(:content_security_policy_script_nonce) { 'lorem-ipsum-nonce' }
|
|
@@ -189,7 +189,7 @@ END
|
|
|
189
189
|
|
|
190
190
|
it 'renders the snippet and config in the response with nonce in script tag when SecureHeaders installed' do
|
|
191
191
|
secure_headers_config = double(:configuration, :current_csp => {}, :csp => double(:opt_out? => false))
|
|
192
|
-
allow(SecureHeaders::Configuration).to receive(:
|
|
192
|
+
allow(SecureHeaders::Configuration).to receive(:default).and_return(secure_headers_config)
|
|
193
193
|
res_status, res_headers, response = subject.call(env)
|
|
194
194
|
|
|
195
195
|
new_body = response.body.join
|
|
@@ -205,7 +205,7 @@ END
|
|
|
205
205
|
:script_src => %w('unsafe-inline')
|
|
206
206
|
},
|
|
207
207
|
:csp => double(:opt_out? => false))
|
|
208
|
-
allow(SecureHeaders::Configuration).to receive(:
|
|
208
|
+
allow(SecureHeaders::Configuration).to receive(:default).and_return(secure_headers_config)
|
|
209
209
|
|
|
210
210
|
res_status, res_headers, response = subject.call(env)
|
|
211
211
|
new_body = response.body.join
|
|
@@ -219,7 +219,7 @@ END
|
|
|
219
219
|
|
|
220
220
|
it 'renders the snippet in the response without nonce if SecureHeaders CSP is OptOut' do
|
|
221
221
|
secure_headers_config = double(:configuration, :csp => double(:opt_out? => true))
|
|
222
|
-
allow(SecureHeaders::Configuration).to receive(:
|
|
222
|
+
allow(SecureHeaders::Configuration).to receive(:default).and_return(secure_headers_config)
|
|
223
223
|
|
|
224
224
|
res_status, res_headers, response = subject.call(env)
|
|
225
225
|
new_body = response.body.join
|
|
@@ -42,11 +42,22 @@ describe Rollbar::Notifier do
|
|
|
42
42
|
end
|
|
43
43
|
|
|
44
44
|
if RUBY_PLATFORM == 'java'
|
|
45
|
-
describe
|
|
46
|
-
|
|
45
|
+
describe '#extract_arguments' do
|
|
46
|
+
# See https://docs.oracle.com/javase/8/docs/api/java/lang/Throwable.html
|
|
47
|
+
# for more background
|
|
48
|
+
it 'extracts java.lang.Exception' do
|
|
47
49
|
begin
|
|
48
|
-
raise java.lang.Exception.new(
|
|
49
|
-
rescue
|
|
50
|
+
raise java.lang.Exception.new('Hello')
|
|
51
|
+
rescue => e
|
|
52
|
+
message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
|
|
53
|
+
expect(exception).to eq(e)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it 'extracts java.lang.Error' do
|
|
58
|
+
begin
|
|
59
|
+
raise java.lang.AssertionError.new('Hello')
|
|
60
|
+
rescue java.lang.Error => e
|
|
50
61
|
message, exception, extra = Rollbar::Notifier.new.send(:extract_arguments, [e])
|
|
51
62
|
expect(exception).to eq(e)
|
|
52
63
|
end
|
|
@@ -107,7 +107,7 @@ describe Rollbar::Sidekiq, :reconfigure_notifier => false do
|
|
|
107
107
|
|
|
108
108
|
context 'with a sidekiq_threshold set' do
|
|
109
109
|
before do
|
|
110
|
-
Rollbar.configuration.sidekiq_threshold =
|
|
110
|
+
Rollbar.configuration.sidekiq_threshold = 3
|
|
111
111
|
end
|
|
112
112
|
|
|
113
113
|
it 'does not send error to rollbar under the threshold' do
|
|
@@ -140,16 +140,14 @@ describe Rollbar::Sidekiq, :reconfigure_notifier => false do
|
|
|
140
140
|
)
|
|
141
141
|
end
|
|
142
142
|
|
|
143
|
-
it
|
|
143
|
+
it "does not blow up and doesn't send the error to rollbar if retry is true but there is no retry count" do
|
|
144
144
|
allow(Rollbar).to receive(:scope).and_return(rollbar)
|
|
145
|
-
expect(rollbar).to receive(:error)
|
|
145
|
+
expect(rollbar).to receive(:error).never
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
)
|
|
152
|
-
end.to_not raise_error
|
|
147
|
+
described_class.handle_exception(
|
|
148
|
+
{ :job => { 'retry' => true } },
|
|
149
|
+
exception
|
|
150
|
+
)
|
|
153
151
|
end
|
|
154
152
|
end
|
|
155
153
|
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.
|
|
4
|
+
version: 2.17.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: 2018-
|
|
11
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: multi_json
|
|
@@ -215,6 +215,7 @@ files:
|
|
|
215
215
|
- spec/rollbar/delay/delayed_job_spec.rb
|
|
216
216
|
- spec/rollbar/delay/girl_friday_spec.rb
|
|
217
217
|
- spec/rollbar/delay/resque_spec.rb
|
|
218
|
+
- spec/rollbar/delay/shoryuken_spec.rb
|
|
218
219
|
- spec/rollbar/delay/thread_spec.rb
|
|
219
220
|
- spec/rollbar/encoding/encoder_spec.rb
|
|
220
221
|
- spec/rollbar/item/backtrace_spec.rb
|
|
@@ -366,6 +367,7 @@ test_files:
|
|
|
366
367
|
- spec/rollbar/delay/delayed_job_spec.rb
|
|
367
368
|
- spec/rollbar/delay/girl_friday_spec.rb
|
|
368
369
|
- spec/rollbar/delay/resque_spec.rb
|
|
370
|
+
- spec/rollbar/delay/shoryuken_spec.rb
|
|
369
371
|
- spec/rollbar/delay/thread_spec.rb
|
|
370
372
|
- spec/rollbar/encoding/encoder_spec.rb
|
|
371
373
|
- spec/rollbar/item/backtrace_spec.rb
|