rollbar 3.4.2 → 3.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8fccee4d8f496c152bca4e1bd0cd3c71831dedda32230fbd5815091d498bf60c
4
- data.tar.gz: 7a46b0396b809d8837a0891821f3b0dfd348daad1b6d39a2691afd519901e380
3
+ metadata.gz: 9833b30479b7f91305cdf3a4269e3f550d8a925aa50f13ccd374f9d6e3456dc6
4
+ data.tar.gz: fcc7e9410c968844460052171bf0cbf62006d86f2ab0a71d81fd2a8af60d5599
5
5
  SHA512:
6
- metadata.gz: dac247751b7b78289210aa82bc4508fe31483e758d47f345b9db01811553a745b6a508bbd93a11e10a5349dd8441c7b118d884b421ccb5985b99edd5f2814805
7
- data.tar.gz: aa7197048fa8a4eae1080fa6ac794cb8ab301862893488636012113f119b59023c38bf395d1f2d45abacfee3d7ff81e96f7be2896614a8f4835340f60594a456
6
+ metadata.gz: 8b1da82b43abeaef4e2b78937842ddca414279b6816e61ddd1861a32955c5a4436e625a8931da4151b3d77c645451f8aef18fd88c0e976928cf1939080e9c2a2
7
+ data.tar.gz: d034b0a6f4e8eea5fef9e714ffa7492087f6c61dc442710eecd479b16cfda5d3522bf863abdec17aa2b7f3beb7a7981741bf0376d427d1b63861dce343b5ceea
@@ -18,10 +18,12 @@ module Rollbar
18
18
  :custom_data_method,
19
19
  :default_logger,
20
20
  :delayed_job_enabled,
21
+ :disable_action_mailer_monkey_patch,
21
22
  :disable_core_monkey_patch,
22
23
  :disable_monkey_patch,
23
24
  :disable_rack_monkey_patch,
24
25
  :dj_threshold,
26
+ :dj_use_scoped_block,
25
27
  :enable_error_context,
26
28
  :enabled,
27
29
  :endpoint,
@@ -98,10 +100,12 @@ module Rollbar
98
100
  @logger_level = :info
99
101
  @delayed_job_enabled = true
100
102
  @disable_monkey_patch = false
103
+ @disable_action_mailer_monkey_patch = false
101
104
  @disable_core_monkey_patch = false
102
105
  @disable_rack_monkey_patch = false
103
106
  @enable_error_context = true
104
107
  @dj_threshold = 0
108
+ @dj_use_scoped_block = false
105
109
  @async_skip_report_handler = nil
106
110
  @enabled = nil # set to true when configure is called
107
111
  @endpoint = DEFAULT_ENDPOINT
data/lib/rollbar/json.rb CHANGED
@@ -5,8 +5,6 @@ module Rollbar
5
5
  module JSON # :nodoc:
6
6
  module_function
7
7
 
8
- attr_writer :options_module
9
-
10
8
  def dump(object)
11
9
  Rollbar.plugins.get('basic_socket').load_scoped!(true) do
12
10
  ::JSON.generate(object)
@@ -7,7 +7,7 @@ module Rollbar
7
7
  def render_exception_with_rollbar(env, exception, wrapper = nil)
8
8
  key = 'action_dispatch.show_detailed_exceptions'
9
9
 
10
- if exception.is_a?(ActionController::RoutingError) && env[key]
10
+ if exception.is_a?(ActionController::RoutingError) && env.params[key.to_s]
11
11
  scope = extract_scope_from(env)
12
12
 
13
13
  Rollbar.scoped(scope) do
@@ -1,35 +1,44 @@
1
- module Rollbar
2
- # Report any uncaught errors in a job to Rollbar and reraise
3
- module ActiveJob
4
- def self.included(base)
5
- base.send :rescue_from, Exception do |exception|
6
- args = if self.class.respond_to?(:log_arguments?) && !self.class.log_arguments?
7
- arguments.map(&Rollbar::Scrubbers.method(:scrub_value))
8
- else
9
- arguments
10
- end
1
+ Rollbar.plugins.define('active_job') do
2
+ dependency { !configuration.disable_monkey_patch }
3
+ dependency { !configuration.disable_action_mailer_monkey_patch }
11
4
 
12
- Rollbar.error(exception,
13
- :job => self.class.name,
14
- :job_id => job_id,
15
- :use_exception_level_filters => true,
16
- :arguments => args)
17
- raise exception
5
+ execute do
6
+ module Rollbar
7
+ # Report any uncaught errors in a job to Rollbar and reraise
8
+ module ActiveJob
9
+ def self.included(base)
10
+ base.send :rescue_from, Exception do |exception|
11
+ args = if self.class.respond_to?(:log_arguments?) && !self.class.log_arguments?
12
+ arguments.map(&Rollbar::Scrubbers.method(:scrub_value))
13
+ else
14
+ arguments
15
+ end
16
+
17
+ job_data = {
18
+ :job => self.class.name,
19
+ :use_exception_level_filters => true,
20
+ :arguments => args
21
+ }
22
+
23
+ # job_id isn't present when this is a mailer class.
24
+ job_data[:job_id] = job_id if defined?(job_id)
25
+
26
+ Rollbar.error(exception, job_data)
27
+ raise exception
28
+ end
29
+ end
18
30
  end
19
31
  end
20
- end
21
- end
22
32
 
23
- if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
24
- ActiveSupport.on_load(:action_mailer) do
25
- # Automatically add to ActionMailer::DeliveryJob
26
- if defined?(ActionMailer::DeliveryJob)
27
- ActionMailer::DeliveryJob.send(:include,
28
- Rollbar::ActiveJob)
29
- end
30
- # Rails >= 6.0
31
- if defined?(ActionMailer::MailDeliveryJob)
32
- ActionMailer::MailDeliveryJob.send(:include, Rollbar::ActiveJob)
33
+ if defined?(ActiveSupport) && ActiveSupport.respond_to?(:on_load)
34
+ ActiveSupport.on_load(:action_mailer) do
35
+ if defined?(ActionMailer::MailDeliveryJob) # Rails >= 6.0
36
+ ActionMailer::Base.send(:include, Rollbar::ActiveJob)
37
+ elsif defined?(ActionMailer::DeliveryJob) # Rails < 6.0
38
+ ActionMailer::DeliveryJob.send(:include,
39
+ Rollbar::ActiveJob)
40
+ end
41
+ end
33
42
  end
34
43
  end
35
44
  end
@@ -48,7 +48,12 @@ module Rollbar
48
48
  def self.invoke_job_callback
49
49
  proc do |job, *args, &block|
50
50
  begin
51
- block.call(job, *args)
51
+ if Rollbar.configuration.dj_use_scoped_block
52
+ data = Rollbar::Delayed.build_job_data(job)
53
+ Rollbar.scoped(:request => data) { block.call(job, *args) }
54
+ else
55
+ block.call(job, *args)
56
+ end
52
57
  rescue StandardError => e
53
58
  report(e, job)
54
59
 
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '3.4.2'.freeze
2
+ VERSION = '3.5.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: 3.4.2
4
+ version: 3.5.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: 2023-12-06 00:00:00.000000000 Z
11
+ date: 2024-01-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Track and debug errors in your Ruby applications with ease using Rollbar.
14
14
  With this gem, you can easily monitor and report on exceptions and other errors
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  - !ruby/object:Gem::Version
161
161
  version: '0'
162
162
  requirements: []
163
- rubygems_version: 3.4.10
163
+ rubygems_version: 3.1.4
164
164
  signing_key:
165
165
  specification_version: 4
166
166
  summary: Reports exceptions to Rollbar