rollbar 2.19.1 → 2.19.2

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
  SHA1:
3
- metadata.gz: b1d54624ee13b6f4c7a4968c1c9067e516c66df6
4
- data.tar.gz: 38c693e582396f395edf19b2de6632f0a2d6e2a1
3
+ metadata.gz: 903833e1801aaeef919e56c575720bd7c4ae6498
4
+ data.tar.gz: 2c7ee9fe31c1163a36da244d74390f9465515348
5
5
  SHA512:
6
- metadata.gz: 0edbc15fcb61dabaccdd2cfd6ba523e467df93a65c140324b54cd4374ba58d89346f83a5c176b8447eed1039f112b7c429434fe4f0722cf70b17b1392431dbe3
7
- data.tar.gz: ffd8f7ff56381063666b9889656790c310b00dc5de74d2c10e9be12a47183da27efe66a90a87747fa12f78bceab90e581442a5cfadbb84acb0c58f2c497d7940
6
+ metadata.gz: 56d9ca0996cee011a87113a6a9271067286492c8c36537da01b93049784b072256982ba77efeb88938e2464f3e9771e6af1da5926e2dba02cf8cb07de4fe4628
7
+ data.tar.gz: a4c0e26eb7def5137bc2737d0a837cab42677f24cc7983055ecd8586754222834e6095ee5a859c55443cdfb43c0c33e4ab6f98dfdb31adc20064d6fb25bf6b3f
@@ -10,21 +10,21 @@ namespace :rollbar do
10
10
  desc 'Send deployment started notification to Rollbar.'
11
11
  task :deploy_started do
12
12
  on primary fetch(:rollbar_role) do
13
- ::Rollbar::CapistranoTasks.deploy_started(self, self, dry_run?)
13
+ ::Rollbar::CapistranoTasks.deploy_started(self, self, false)
14
14
  end
15
15
  end
16
16
 
17
17
  desc 'Send deployment succeeded notification to Rollbar.'
18
18
  task :deploy_succeeded do
19
19
  on primary fetch(:rollbar_role) do
20
- ::Rollbar::CapistranoTasks.deploy_succeeded(self, self, dry_run?)
20
+ ::Rollbar::CapistranoTasks.deploy_succeeded(self, self, false)
21
21
  end
22
22
  end
23
23
 
24
24
  desc 'Send deployment failed notification to Rollbar.'
25
25
  task :deploy_failed do
26
26
  on primary fetch(:rollbar_role) do
27
- ::Rollbar::CapistranoTasks.deploy_failed(self, self, dry_run?)
27
+ ::Rollbar::CapistranoTasks.deploy_failed(self, self, false)
28
28
  end
29
29
  end
30
30
 
@@ -10,12 +10,12 @@ module Rollbar
10
10
  deploy_task(logger, :desc => 'Notifying Rollbar of deployment start') do
11
11
  result = report_deploy_started(capistrano, dry_run)
12
12
 
13
- info_request_response(logger, result)
13
+ debug_request_response(logger, result)
14
14
 
15
15
  capistrano.set(:rollbar_deploy_id, 123) if dry_run
16
16
 
17
17
  skip_in_dry_run(logger, dry_run) do
18
- if (deploy_id = result[:data][:deploy_id])
18
+ if (deploy_id = result[:data] && result[:data][:deploy_id])
19
19
  capistrano.set :rollbar_deploy_id, deploy_id
20
20
  else
21
21
  logger.error 'Unable to report deploy to Rollbar'
@@ -49,7 +49,7 @@ module Rollbar
49
49
  depend_on_deploy_id(capistrano, logger) do
50
50
  result = yield
51
51
 
52
- info_request_response(logger, result)
52
+ debug_request_response(logger, result)
53
53
 
54
54
  skip_in_dry_run(logger, dry_run) do
55
55
  if result[:response].is_a?(Net::HTTPSuccess)
@@ -122,9 +122,10 @@ module Rollbar
122
122
  end
123
123
  end
124
124
 
125
- def info_request_response(logger, result)
126
- logger.info result[:request_info]
127
- logger.info result[:response_info] if result[:response_info]
125
+ def debug_request_response(logger, result)
126
+ # NOTE: in Capistrano debug messages go to log/capistrano.log but not to stdout even if log_level == :debug
127
+ logger.debug result[:request_info]
128
+ logger.debug result[:response_info] if result[:response_info]
128
129
  end
129
130
  end
130
131
  end
@@ -8,6 +8,7 @@ module Rollbar
8
8
  attr_accessor :async_handler
9
9
  attr_accessor :branch
10
10
  attr_reader :before_process
11
+ attr_accessor :capture_uncaught
11
12
  attr_accessor :code_version
12
13
  attr_accessor :custom_data_method
13
14
  attr_accessor :delayed_job_enabled
@@ -72,6 +73,7 @@ module Rollbar
72
73
  def initialize
73
74
  @async_handler = nil
74
75
  @before_process = []
76
+ @capture_uncaught = nil
75
77
  @code_version = nil
76
78
  @custom_data_method = nil
77
79
  @default_logger = lambda { ::Logger.new(STDERR) }
@@ -6,6 +6,8 @@ module Rollbar
6
6
  ENDPOINT = 'https://api.rollbar.com/api/1/deploy/'.freeze
7
7
 
8
8
  def self.report(opts = {}, access_token:, environment:, revision:)
9
+ return {} unless access_token && !access_token.empty?
10
+
9
11
  opts[:status] ||= :started
10
12
 
11
13
  uri = URI.parse(::Rollbar::Deploy::ENDPOINT)
@@ -21,6 +23,8 @@ module Rollbar
21
23
  end
22
24
 
23
25
  def self.update(opts = {}, deploy_id:, access_token:, status:)
26
+ return {} unless access_token && !access_token.empty?
27
+
24
28
  uri = URI.parse(
25
29
  ::Rollbar::Deploy::ENDPOINT +
26
30
  deploy_id.to_s +
@@ -1,10 +1,11 @@
1
1
  module Rollbar
2
- module ExceptionReporter
2
+ module ExceptionReporter # :nodoc:
3
3
  def report_exception_to_rollbar(env, exception)
4
- exception_message = exception.respond_to?(:message) ? exception.message : 'No Exception Message'
5
- Rollbar.log_debug "[Rollbar] Reporting exception: #{exception_message}"
4
+ return unless capture_uncaught?
5
+
6
+ log_exception_message(exception)
6
7
 
7
- exception_data = Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception, :use_exception_level_filters => true)
8
+ exception_data = exception_data(exception)
8
9
 
9
10
  if exception_data.is_a?(Hash)
10
11
  env['rollbar.exception_uuid'] = exception_data[:uuid]
@@ -14,8 +15,21 @@ module Rollbar
14
15
  elsif exception_data == 'ignored'
15
16
  Rollbar.log_debug '[Rollbar] Exception not reported because it was ignored'
16
17
  end
17
- rescue => e
18
+ rescue StandardError => e
18
19
  Rollbar.log_warning "[Rollbar] Exception while reporting exception to Rollbar: #{e.message}"
19
20
  end
21
+
22
+ def capture_uncaught?
23
+ Rollbar.configuration.capture_uncaught != false
24
+ end
25
+
26
+ def log_exception_message(exception)
27
+ exception_message = exception.respond_to?(:message) ? exception.message : 'No Exception Message'
28
+ Rollbar.log_debug "[Rollbar] Reporting exception: #{exception_message}"
29
+ end
30
+
31
+ def exception_data(exception)
32
+ Rollbar.log(Rollbar.configuration.uncaught_exception_level, exception, :use_exception_level_filters => true)
33
+ end
20
34
  end
21
35
  end
@@ -12,6 +12,7 @@ require 'rollbar/util'
12
12
  require 'rollbar/encoding'
13
13
  require 'rollbar/truncation'
14
14
  require 'rollbar/json'
15
+ require 'rollbar/scrubbers/params'
15
16
 
16
17
  module Rollbar
17
18
  # This class represents the payload to be sent to the API.
@@ -126,7 +126,7 @@ module Rollbar
126
126
  # Rollbar.log(e, 'This is a description of the exception')
127
127
  #
128
128
  def log(level, *args)
129
- return 'disabled' unless configuration.enabled
129
+ return 'disabled' unless enabled?
130
130
 
131
131
  message, exception, extra, context = extract_arguments(args)
132
132
  use_exception_level_filters = use_exception_level_filters?(extra)
@@ -185,6 +185,11 @@ module Rollbar
185
185
  log('critical', *args)
186
186
  end
187
187
 
188
+ def enabled?
189
+ # Require access_token so we don't try to send events when unconfigured.
190
+ configuration.enabled && configuration.access_token && !configuration.access_token.empty?
191
+ end
192
+
188
193
  def process_item(item)
189
194
  if configuration.write_to_file
190
195
  if configuration.use_async
@@ -1,3 +1,3 @@
1
1
  module Rollbar
2
- VERSION = '2.19.1'
2
+ VERSION = '2.19.2'
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.1
4
+ version: 2.19.2
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-02-24 00:00:00.000000000 Z
11
+ date: 2019-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json