honeybadger 4.7.3 → 4.11.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 818d4ae873c692edd42ec3e8ab30e118726634ea7681d85c5bce558f558372e1
4
- data.tar.gz: 16a590d564bd41eb7f6b498e31f46f295d68ab20ef062783cdbdc627a367e712
3
+ metadata.gz: 1542f59cbe55ad29fba4ea1ccc9acf4cc6fb36fa14bf6485f127846442682bdc
4
+ data.tar.gz: 84f3fe4e7ed2b07548107f247585a3ecc38f411f8f8ac8ec23bd271fa80c942e
5
5
  SHA512:
6
- metadata.gz: 2fbbaa748ba04699498d632b785c7eec3a38eebf48fc2bbeaa77092db1397091fb5fd1e7c1b896836ec9f9f5c64decd33a1e858a3ccf4a99f71d11526d27e476
7
- data.tar.gz: 9b8063dd6c781f09c81b9d468216b504676015fd9b80a38c73e0f74d790896fead725dab28cb510558ac67c1548bf7161b67142e1d86c84ef1159ca472b1829b
6
+ metadata.gz: 074db0c6d16b50320a7ee86c4c63b229ecc97ce4841c6e5ba7791b637481150a236a6900fa55ff97075843b87b773c92f8469aaad46559e73624f46c0b5caf70
7
+ data.tar.gz: 9a7968da09fa17c8e6c60768baeaea4173387b494913e5d90cca8984d39b0565886f387e9f113e7d321a8bc33f09a82419d6170fdf6dfa2f2fc74bfd3e79d35d
data/CHANGELOG.md CHANGED
@@ -5,6 +5,34 @@ adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
6
  ## [Unreleased]
7
7
 
8
+ ## [4.11.0] - 2022-02-15
9
+ ### Fixed
10
+ - Allow special characters in tags. Also support space-delimited tags:
11
+ "one two three" and "one, two, three" are equivalent
12
+
13
+ ## [4.10.0] - 2022-01-19
14
+ ### Added
15
+ - Add more items to the default config file
16
+
17
+ ### Fixed
18
+ - Fix a Ruby 3.1 bug that breaks regexp classes in honeybadger.yml (#418)
19
+
20
+ ## [4.9.0] - 2021-06-28
21
+ ### Fixed
22
+ - Replaced fixed number for retries in Sidekiq Plugin with Sidekiq::JobRetry constant
23
+ - Properly set environment in deployment tracking (#404, @stmllr)
24
+
25
+ ### Added
26
+ - Added 'ActionDispatch::Http::MimeNegotiation::InvalidType' (Rails 6.1) to
27
+ default ignore list. (#402, @jrochkind)
28
+
29
+ ## [4.8.0] - 2021-03-16
30
+ ### Fixed
31
+ - Suppress any error output from the `git rev-parse` command. ([#394](https://github.com/honeybadger-io/honeybadger-ruby/pull/394))
32
+
33
+ ### Added
34
+ - Support deployment tracking in code (#397, @danleyden)
35
+
8
36
  ## [4.7.3] - 2021-02-10
9
37
  ### Fixed
10
38
  - Don't enable Lambda plugin in non-Lambda execution environments
@@ -36,7 +64,7 @@ adheres to [Semantic Versioning](http://semver.org/).
36
64
  ### Fixed
37
65
  - Fixed issue where Sidekiq.attempt_threshold was triggering 2 attempts ahead
38
66
  of the setting
39
- - Dup notify opts before mutating (#345)
67
+ - Dupe notify opts before mutating (#345)
40
68
 
41
69
  ### Changed
42
70
  - 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
 
@@ -53,11 +53,11 @@ module Honeybadger
53
53
 
54
54
  # @api private
55
55
  # The String character used to split tag strings.
56
- TAG_SEPERATOR = ','.freeze
56
+ TAG_SEPERATOR = /,|\s/.freeze
57
57
 
58
58
  # @api private
59
59
  # The Regexp used to strip invalid characters from individual tags.
60
- TAG_SANITIZER = /[^\w]/.freeze
60
+ TAG_SANITIZER = /\s/.freeze
61
61
 
62
62
  # @api private
63
63
  class Cause
@@ -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(...)
@@ -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.3'.freeze
3
+ VERSION = '4.11.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.3
4
+ version: 4.11.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: 2021-02-10 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Make managing application errors a more pleasant experience.
14
14
  email: