honeybadger 4.7.0 → 4.9.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/CHANGELOG.md +30 -0
- data/lib/honeybadger/agent.rb +25 -0
- data/lib/honeybadger/backend/base.rb +9 -0
- data/lib/honeybadger/breadcrumbs/active_support.rb +5 -3
- data/lib/honeybadger/cli/helpers.rb +1 -1
- data/lib/honeybadger/cli/main.rb +1 -1
- data/lib/honeybadger/cli/test.rb +1 -1
- data/lib/honeybadger/config/defaults.rb +6 -0
- data/lib/honeybadger/plugins/sidekiq.rb +6 -4
- data/lib/honeybadger/singleton.rb +1 -0
- data/lib/honeybadger/util/lambda.rb +1 -1
- data/lib/honeybadger/util/revision.rb +1 -1
- data/lib/honeybadger/util/sql.rb +10 -1
- data/lib/honeybadger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4c153814c322b2ffbd8064199f37a30814ab57fd768803f379da3d42f4b2a85
|
4
|
+
data.tar.gz: 88586b69b9ca68cd26cf619a39aef833bb18e360c1c140f275e8dd78b3470fce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ef4ba277d6953369569fa01f3008ff772d80e4bb6aadddbfa27ab55e29791ef49ebd8a9e4643133e7f6eccb0536a55f8937263e49b69c0e376dbdb5ba09cff7
|
7
|
+
data.tar.gz: 9703e65ff2847ef0f91c701a70b9f4aaae04d9bbdd13d28ec1021673d0b7bd110cc7e45de028c162441d4a1b165c5bdb5c587da0698fd7b08a398308cab9bcf6
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,36 @@ adheres to [Semantic Versioning](http://semver.org/).
|
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
7
|
|
8
|
+
## [4.9.0] - 2021-06-28
|
9
|
+
- Added 'ActionDispatch::Http::MimeNegotiation::InvalidType' (Rails 6.1) to
|
10
|
+
default ignore list. (#402, @jrochkind)
|
11
|
+
- Replaced fixed number for retries in Sidekiq Plugin with Sidekiq::JobRetry constant
|
12
|
+
- Properly set environment in deployment tracking (#404, @stmllr)
|
13
|
+
|
14
|
+
## [4.8.0] - 2021-03-16
|
15
|
+
### Fixed
|
16
|
+
- Suppress any error output from the `git rev-parse` command. ([#394](https://github.com/honeybadger-io/honeybadger-ruby/pull/394))
|
17
|
+
|
18
|
+
### Added
|
19
|
+
- Support deployment tracking in code (#397, @danleyden)
|
20
|
+
|
21
|
+
## [4.7.3] - 2021-02-10
|
22
|
+
### Fixed
|
23
|
+
- Don't enable Lambda plugin in non-Lambda execution environments
|
24
|
+
|
25
|
+
## [4.7.2] - 2020-08-17
|
26
|
+
### Fixed
|
27
|
+
- Remove usage of `ActiveRecord::Base.connection` (thanks @jcoyne for testing)
|
28
|
+
- Check for UTF-8 in ActiveRecord breadcrumb exclusion filter
|
29
|
+
|
30
|
+
## [4.7.1] - 2020-08-11
|
31
|
+
### Fixed
|
32
|
+
- ActiveRecord SQL Breadcrumb event pulls adapter from supplied connection,
|
33
|
+
allowing for multiple databases.
|
34
|
+
- Fix Rails deprecation of `ActionDispatch::ParamsParser::ParseError`
|
35
|
+
- Deal with invalid UTF-8 byte sequences during SQL obfuscation
|
36
|
+
- Fix Ruby 2.7 deprecation notice in sql.rb
|
37
|
+
|
8
38
|
## [4.7.0] - 2020-06-02
|
9
39
|
### Fixed
|
10
40
|
- Alias `Notice#controller=` as `Notice#component=`
|
data/lib/honeybadger/agent.rb
CHANGED
@@ -70,6 +70,8 @@ module Honeybadger
|
|
70
70
|
if local_context
|
71
71
|
@context ||= ContextManager.new
|
72
72
|
@breadcrumbs = Breadcrumbs::Collector.new(config)
|
73
|
+
else
|
74
|
+
@breadcrumbs = nil
|
73
75
|
end
|
74
76
|
|
75
77
|
init_worker
|
@@ -188,6 +190,29 @@ module Honeybadger
|
|
188
190
|
response.success?
|
189
191
|
end
|
190
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
|
+
|
191
216
|
# Save global context for the current request.
|
192
217
|
#
|
193
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
|
@@ -15,17 +15,19 @@ module Honeybadger
|
|
15
15
|
["Active Record", name].compact.join(" - ")
|
16
16
|
end,
|
17
17
|
category: "query",
|
18
|
-
select_keys: [:sql, :name, :connection_id, :cached],
|
18
|
+
select_keys: [:sql, :name, :connection, :connection_id, :cached],
|
19
19
|
transform: lambda do |data|
|
20
20
|
if data[:sql]
|
21
|
-
|
21
|
+
connection = data.delete(:connection)
|
22
|
+
adapter = (connection && connection.adapter_name.downcase) || active_record_connection_db_config[:adapter]
|
22
23
|
data[:sql] = Util::SQL.obfuscate(data[:sql], adapter)
|
23
24
|
end
|
24
25
|
data
|
25
26
|
end,
|
26
27
|
exclude_when: lambda do |data|
|
27
28
|
# Ignore schema, begin, and commit transaction queries
|
28
|
-
data[:name] == "SCHEMA" ||
|
29
|
+
data[:name] == "SCHEMA" ||
|
30
|
+
(data[:sql] && (Util::SQL.force_utf_8(data[:sql].dup) =~ /^(begin|commit)( transaction)?$/i))
|
29
31
|
end
|
30
32
|
},
|
31
33
|
|
@@ -15,7 +15,7 @@ To fix this issue, please try the following:
|
|
15
15
|
|
16
16
|
- Make sure the gem is configured properly.
|
17
17
|
- Retry executing this command a few times.
|
18
|
-
- Make sure you can connect to #{host} (`
|
18
|
+
- Make sure you can connect to #{host} (`curl https://#{host}/v1/notices`).
|
19
19
|
- Email support@honeybadger.io for help. Include as much debug info as you
|
20
20
|
can for a faster resolution!
|
21
21
|
|
data/lib/honeybadger/cli/main.rb
CHANGED
@@ -196,7 +196,7 @@ WELCOME
|
|
196
196
|
# What can I do?
|
197
197
|
|
198
198
|
- Retry the command.
|
199
|
-
- Make sure you can connect to api.honeybadger.io (`
|
199
|
+
- Make sure you can connect to api.honeybadger.io (`curl https://api.honeybadger.io/v1/notices`).
|
200
200
|
- If you continue to see this message, email us at support@honeybadger.io
|
201
201
|
(don't forget to attach this output!)
|
202
202
|
|
data/lib/honeybadger/cli/test.rb
CHANGED
@@ -175,7 +175,7 @@ To fix this issue, please try the following:
|
|
175
175
|
|
176
176
|
- Make sure the gem is configured properly.
|
177
177
|
- Retry executing this command a few times.
|
178
|
-
- Make sure you can connect to #{host} (`
|
178
|
+
- Make sure you can connect to #{host} (`curl https://#{host}/v1/notices`).
|
179
179
|
- Email support@honeybadger.io for help. Include as much debug info as you
|
180
180
|
can for a faster resolution!
|
181
181
|
|
@@ -13,11 +13,17 @@ module Honeybadger
|
|
13
13
|
'ActionController::UnknownFormat',
|
14
14
|
'ActionController::InvalidAuthenticityToken',
|
15
15
|
'ActionController::InvalidCrossOriginRequest',
|
16
|
+
# ActionDispatch::ParamsParser::ParseError was removed in Rails 6.0
|
17
|
+
# and may be removed here once support for Rails 5.2 is dropped.
|
18
|
+
# https://github.com/rails/rails/commit/e16c765ac6dcff068ff2e5554d69ff345c003de1
|
19
|
+
# https://github.com/honeybadger-io/honeybadger-ruby/pull/358
|
16
20
|
'ActionDispatch::ParamsParser::ParseError',
|
21
|
+
'ActionDispatch::Http::Parameters::ParseError',
|
17
22
|
'ActionController::BadRequest',
|
18
23
|
'ActionController::ParameterMissing',
|
19
24
|
'ActiveRecord::RecordNotFound',
|
20
25
|
'ActionController::UnknownAction',
|
26
|
+
'ActionDispatch::Http::MimeNegotiation::InvalidType',
|
21
27
|
'Rack::QueryParser::ParameterTypeError',
|
22
28
|
'Rack::QueryParser::InvalidParameterError',
|
23
29
|
'CGI::Session::CookieStore::TamperedWithCookie',
|
@@ -5,7 +5,7 @@ module Honeybadger
|
|
5
5
|
module Plugins
|
6
6
|
module Sidekiq
|
7
7
|
class Middleware
|
8
|
-
def call(
|
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
|
-
|
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(...)
|
data/lib/honeybadger/util/sql.rb
CHANGED
@@ -11,7 +11,7 @@ module Honeybadger
|
|
11
11
|
DoubleQuoters = /(postgres|sqlite|postgis)/.freeze
|
12
12
|
|
13
13
|
def self.obfuscate(sql, adapter)
|
14
|
-
sql.dup.tap do |s|
|
14
|
+
force_utf_8(sql.dup).tap do |s|
|
15
15
|
s.gsub!(EscapedQuotes, EmptyReplacement)
|
16
16
|
s.gsub!(SQuotedData, Replacement)
|
17
17
|
s.gsub!(DQuotedData, Replacement) if adapter =~ DoubleQuoters
|
@@ -20,6 +20,15 @@ module Honeybadger
|
|
20
20
|
s.squeeze!(' ')
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
def self.force_utf_8(string)
|
25
|
+
string.encode(
|
26
|
+
Encoding.find('UTF-8'),
|
27
|
+
invalid: :replace,
|
28
|
+
undef: :replace,
|
29
|
+
replace: ''
|
30
|
+
)
|
31
|
+
end
|
23
32
|
end
|
24
33
|
end
|
25
34
|
end
|
data/lib/honeybadger/version.rb
CHANGED
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.
|
4
|
+
version: 4.9.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:
|
11
|
+
date: 2021-06-28 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.
|
156
|
+
rubygems_version: 3.1.4
|
157
157
|
signing_key:
|
158
158
|
specification_version: 4
|
159
159
|
summary: Error reports you can be happy about.
|