honeybadger 4.7.2 → 4.10.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: ae86ea681a8b1e58775976adc5fe1300cfa043865c9a72344b5ae2dfcde2565a
4
- data.tar.gz: 98a92af83ec77fff0fba12fd551ca81417ed04d0cfdba225a262f1db2786ad82
3
+ metadata.gz: 322f40e4f8b6fc9f0b9318a15e35c9fa1226dde665a22a89c52f0b28da58b7d4
4
+ data.tar.gz: 29b93815603f2e06c5c5c4fef6cb9113a6bf0ec77d5377f5f41c5272523105a6
5
5
  SHA512:
6
- metadata.gz: bad75cfca393708ec07292b6e34257afdaad23753e7fe26b96e8c9d1ca5d46099f9da13b93b53d49d5a77569913e0048a883cc6bf73b04686d85060805e8d681
7
- data.tar.gz: 79e8f88c82d3e8da1eb968b4f9df0ba88da145a034cd6c82cd7e3bf84649d9d5d3c7e3586ce12e391b3f097c9a955231654a825726ac9a697050ffdbca2df64d
6
+ metadata.gz: 725684978008ad0a72b8ffe519fa12f81205f0e9ad97bc2a15d5f44f9a3bb55e8923508103425b5569ee535c5a4f6f0e35f51c54303c6404d2b94365639e8659
7
+ data.tar.gz: cd59816ca1d77a29c599d89bfc897aeb798d37fc566ee3cabad19b3f1233d3cae637fc209bf983a7248349e1d2a4a0d8623da2d14debbe1445f24c1ab41fb960
data/CHANGELOG.md CHANGED
@@ -5,6 +5,33 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.10.0] - 2022-01-19
9
+ ### Added
10
+ - Add more items to the default config file
11
+
12
+ ### Fixed
13
+ - Fix a Ruby 3.1 bug that breaks regexp classes in honeybadger.yml (#418)
14
+
15
+ ## [4.9.0] - 2021-06-28
16
+ ### Fixed
17
+ - Replaced fixed number for retries in Sidekiq Plugin with Sidekiq::JobRetry constant
18
+ - Properly set environment in deployment tracking (#404, @stmllr)
19
+
20
+ ### Added
21
+ - Added 'ActionDispatch::Http::MimeNegotiation::InvalidType' (Rails 6.1) to
22
+ default ignore list. (#402, @jrochkind)
23
+
24
+ ## [4.8.0] - 2021-03-16
25
+ ### Fixed
26
+ - Suppress any error output from the `git rev-parse` command. ([#394](https://github.com/honeybadger-io/honeybadger-ruby/pull/394))
27
+
28
+ ### Added
29
+ - Support deployment tracking in code (#397, @danleyden)
30
+
31
+ ## [4.7.3] - 2021-02-10
32
+ ### Fixed
33
+ - Don't enable Lambda plugin in non-Lambda execution environments
34
+
8
35
  ## [4.7.2] - 2020-08-17
9
36
  ### Fixed
10
37
  - Remove usage of `ActiveRecord::Base.connection` (thanks @jcoyne for testing)
@@ -32,7 +59,7 @@ adheres to [Semantic Versioning](http://semver.org/).
32
59
  ### Fixed
33
60
  - Fixed issue where Sidekiq.attempt_threshold was triggering 2 attempts ahead
34
61
  of the setting
35
- - Dup notify opts before mutating (#345)
62
+ - Dupe notify opts before mutating (#345)
36
63
 
37
64
  ### Changed
38
65
  - Breadcrumbs on by default
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  ![Ruby](https://github.com/honeybadger-io/honeybadger-ruby/workflows/Ruby/badge.svg)
4
4
  ![JRuby](https://github.com/honeybadger-io/honeybadger-ruby/workflows/JRuby/badge.svg)
5
5
  [![Gem Version](https://badge.fury.io/rb/honeybadger.svg)](http://badge.fury.io/rb/honeybadger)
6
- [![SemVer](https://api.dependabot.com/badges/compatibility_score?dependency-name=honeybadger&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=honeybadger&package-manager=bundler&version-scheme=semver)
7
6
 
8
7
  This is the notifier gem for integrating apps with the :zap: [Honeybadger Exception Notifier for Ruby and Rails](http://honeybadger.io).
9
8
 
@@ -190,6 +190,29 @@ module Honeybadger
190
190
  response.success?
191
191
  end
192
192
 
193
+ # Track a new deployment
194
+ #
195
+ # @example
196
+ # Honeybadger.track_deployment(revision: 'be2ceb6')
197
+ #
198
+ # @param [String] :environment The environment name. Defaults to the current configured environment.
199
+ # @param [String] :revision The VCS revision being deployed. Defaults to the currently configured revision.
200
+ # @param [String] :local_username The name of the user who performed the deploy.
201
+ # @param [String] :repository The base URL of the VCS repository. It should be HTTPS-style.
202
+ #
203
+ # @return [Boolean] true if the deployment was successfully tracked and false
204
+ # otherwise.
205
+ def track_deployment(environment: nil, revision: nil, local_username: nil, repository: nil)
206
+ opts = {
207
+ environment: environment || config[:env],
208
+ revision: revision || config[:revision],
209
+ local_username: local_username,
210
+ repository: repository
211
+ }
212
+ response = backend.track_deployment(opts)
213
+ response.success?
214
+ end
215
+
193
216
  # Save global context for the current request.
194
217
  #
195
218
  # @example
@@ -99,6 +99,15 @@ module Honeybadger
99
99
  raise NotImplementedError, 'must define #check_in on subclass.'
100
100
  end
101
101
 
102
+ # Track a deployment
103
+ # @example
104
+ # backend.track_deployment({ revision: 'be2ceb6' })
105
+ #
106
+ # @param [#to_json] payload The JSON payload containing all deployment data.
107
+ def track_deployment(payload)
108
+ notify(:deploys, payload)
109
+ end
110
+
102
111
  private
103
112
 
104
113
  attr_reader :config
@@ -43,10 +43,36 @@ module Honeybadger
43
43
  exit(1)
44
44
  end
45
45
 
46
+ default_env = defined?(::Rails.application) ? "Rails.env" : "ENV['RUBY_ENV'] || ENV['RACK_ENV']"
47
+ default_root = defined?(::Rails.application) ? "Rails.root.to_s" : "Dir.pwd"
46
48
  File.open(path, 'w+') do |file|
47
49
  file.write(<<-CONFIG)
48
50
  ---
51
+ # For more options, see https://docs.honeybadger.io/lib/ruby/gem-reference/configuration
52
+
49
53
  api_key: '#{api_key}'
54
+
55
+ # The environment your app is running in.
56
+ env: "<%= #{default_env} %>"
57
+
58
+ # The absolute path to your project folder.
59
+ root: "<%= #{default_root} %>"
60
+
61
+ # Honeybadger won't report errors in these environments.
62
+ development_environments:
63
+ - test
64
+ - development
65
+ - cucumber
66
+
67
+ # By default, Honeybadger won't report errors in the development_environments.
68
+ # You can override this by explicitly setting report_data to true or false.
69
+ # report_data: true
70
+
71
+ # The current Git revision of your project. Defaults to the last commit hash.
72
+ # revision: null
73
+
74
+ # Enable verbose debug logging (useful for troubleshooting).
75
+ debug: false
50
76
  CONFIG
51
77
  end
52
78
  end
@@ -23,6 +23,7 @@ module Honeybadger
23
23
  'ActionController::ParameterMissing',
24
24
  'ActiveRecord::RecordNotFound',
25
25
  'ActionController::UnknownAction',
26
+ 'ActionDispatch::Http::MimeNegotiation::InvalidType',
26
27
  'Rack::QueryParser::ParameterTypeError',
27
28
  'Rack::QueryParser::InvalidParameterError',
28
29
  'CGI::Session::CookieStore::TamperedWithCookie',
@@ -26,7 +26,11 @@ module Honeybadger
26
26
 
27
27
  def self.load_yaml(path)
28
28
  begin
29
- yaml = YAML.load(ERB.new(path.read).result)
29
+ # This uses `YAML.unsafe_load` to support loading arbitrary Ruby
30
+ # classes, such as !ruby/regexp. This was the default behavior prior
31
+ # to Psych 4. https://bugs.ruby-lang.org/issues/17866
32
+ method = YAML.respond_to?(:unsafe_load) ? :unsafe_load : :load
33
+ yaml = YAML.send(method, ERB.new(path.read).result)
30
34
  rescue => e
31
35
  config_error = ConfigError.new(e.to_s)
32
36
 
@@ -5,7 +5,7 @@ module Honeybadger
5
5
  module Plugins
6
6
  module Sidekiq
7
7
  class Middleware
8
- def call(worker, msg, queue)
8
+ def call(_worker, _msg, _queue)
9
9
  Honeybadger.clear!
10
10
  yield
11
11
  end
@@ -23,7 +23,7 @@ module Honeybadger
23
23
 
24
24
  if defined?(::Sidekiq::VERSION) && ::Sidekiq::VERSION > '3'
25
25
  ::Sidekiq.configure_server do |sidekiq|
26
- sidekiq.error_handlers << lambda {|ex, params|
26
+ sidekiq.error_handlers << lambda { |ex, params|
27
27
  job = params[:job] || params
28
28
  job_retry = job['retry'.freeze]
29
29
 
@@ -37,13 +37,15 @@ module Honeybadger
37
37
  attempt = retry_count ? retry_count + 1 : 0
38
38
 
39
39
  # Ensure we account for modified max_retries setting
40
- retry_limit = job_retry == true ? (sidekiq.options[:max_retries] || 25) : job_retry.to_i
40
+ default_max_retry_attempts = defined?(::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS) ? ::Sidekiq::JobRetry::DEFAULT_MAX_RETRY_ATTEMPTS : 25
41
+ retry_limit = job_retry == true ? (sidekiq.options[:max_retries] || default_max_retry_attempts) : job_retry.to_i
42
+
41
43
  limit = [retry_limit, threshold].min
42
44
 
43
45
  return if attempt < limit
44
46
  end
45
47
 
46
- opts = {parameters: params}
48
+ opts = { parameters: params }
47
49
  if config[:'sidekiq.use_component']
48
50
  opts[:component] = job['wrapped'.freeze] || job['class'.freeze]
49
51
  opts[:action] = 'perform' if opts[:component]
@@ -37,6 +37,7 @@ module Honeybadger
37
37
  def_delegator :'Honeybadger::Agent.instance', :add_breadcrumb
38
38
  def_delegator :'Honeybadger::Agent.instance', :breadcrumbs
39
39
  def_delegator :'Honeybadger::Agent.instance', :clear!
40
+ def_delegator :'Honeybadger::Agent.instance', :track_deployment
40
41
 
41
42
  # @!macro [attach] def_delegator
42
43
  # @!method $2(...)
@@ -14,7 +14,7 @@ module Honeybadger
14
14
 
15
15
  class << self
16
16
  def lambda_execution?
17
- !!ENV["AWS_EXECUTION_ENV"]
17
+ !!ENV["AWS_LAMBDA_FUNCTION_NAME"]
18
18
  end
19
19
 
20
20
  def normalized_data
@@ -26,7 +26,7 @@ module Honeybadger
26
26
 
27
27
  def from_git
28
28
  return nil unless File.directory?('.git')
29
- `git rev-parse HEAD`.strip rescue nil
29
+ `git rev-parse HEAD 2> #{File::NULL}`.strip rescue nil
30
30
  end
31
31
  end
32
32
  end
@@ -1,4 +1,4 @@
1
1
  module Honeybadger
2
2
  # The current String Honeybadger version.
3
- VERSION = '4.7.2'.freeze
3
+ VERSION = '4.10.0'.freeze
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: honeybadger
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.2
4
+ version: 4.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Honeybadger Industries LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-17 00:00:00.000000000 Z
11
+ date: 2022-01-19 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email:
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubygems_version: 3.1.2
156
+ rubygems_version: 3.3.3
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Error reports you can be happy about.