bugsnag 6.20.0 → 6.24.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +110 -0
- data/VERSION +1 -1
- data/lib/bugsnag/breadcrumb_type.rb +14 -0
- data/lib/bugsnag/breadcrumbs/breadcrumb.rb +34 -1
- data/lib/bugsnag/breadcrumbs/breadcrumbs.rb +1 -0
- data/lib/bugsnag/breadcrumbs/on_breadcrumb_callback_list.rb +50 -0
- data/lib/bugsnag/cleaner.rb +31 -18
- data/lib/bugsnag/configuration.rb +243 -25
- data/lib/bugsnag/delivery/synchronous.rb +2 -2
- data/lib/bugsnag/delivery/thread_queue.rb +2 -2
- data/lib/bugsnag/endpoint_configuration.rb +11 -0
- data/lib/bugsnag/endpoint_validator.rb +80 -0
- data/lib/bugsnag/error.rb +25 -0
- data/lib/bugsnag/event.rb +7 -0
- data/lib/bugsnag/integrations/rack.rb +3 -3
- data/lib/bugsnag/integrations/rails/active_job.rb +102 -0
- data/lib/bugsnag/integrations/railtie.rb +43 -36
- data/lib/bugsnag/integrations/resque.rb +13 -3
- data/lib/bugsnag/middleware/active_job.rb +18 -0
- data/lib/bugsnag/middleware/delayed_job.rb +21 -2
- data/lib/bugsnag/middleware/exception_meta_data.rb +2 -0
- data/lib/bugsnag/middleware/rack_request.rb +84 -19
- data/lib/bugsnag/middleware/rails3_request.rb +2 -2
- data/lib/bugsnag/middleware/rake.rb +1 -1
- data/lib/bugsnag/middleware/session_data.rb +3 -1
- data/lib/bugsnag/middleware/sidekiq.rb +1 -1
- data/lib/bugsnag/middleware_stack.rb +6 -6
- data/lib/bugsnag/report.rb +166 -6
- data/lib/bugsnag/session_tracker.rb +52 -12
- data/lib/bugsnag/stacktrace.rb +10 -1
- data/lib/bugsnag/tasks/bugsnag.rake +1 -1
- data/lib/bugsnag/utility/duplicator.rb +124 -0
- data/lib/bugsnag/utility/metadata_delegate.rb +102 -0
- data/lib/bugsnag.rb +139 -7
- metadata +12 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee1b5d5046b6ba8e68cf45b4ccac412c02051c774bcf8e205c97b4254d058468
|
4
|
+
data.tar.gz: 787717ba06a5bba3266c0030e8de943bf02fe4c6a9c6d979ec4bf543aa7d82bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e53bfdf8c6c23f2a9e4412fbca888884936c3c26ff5f1262f80aa5081a8edb3ba51a6e0a64065c41490efc20c1fe32d8795ec841f09f733062d3691c0c007e2e
|
7
|
+
data.tar.gz: 3fe002c3a094014f0fbb56a1863ed309b50b4e733cd651df0136ad8af2f72c6759d122baf7f6bbb34607baf18631395000bd9fd7312eec432b7dce14482d9cef
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,116 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## v6.24.0 (6 October 2021)
|
5
|
+
|
6
|
+
### Enhancements
|
7
|
+
|
8
|
+
* Allow overriding an event's unhandled flag
|
9
|
+
| [#698](https://github.com/bugsnag/bugsnag-ruby/pull/698)
|
10
|
+
* Add the ability to store metadata globally
|
11
|
+
| [#699](https://github.com/bugsnag/bugsnag-ruby/pull/699)
|
12
|
+
* Add `cookies`, `body` and `httpVersion` to the automatically captured request data for Rack apps
|
13
|
+
| [#700](https://github.com/bugsnag/bugsnag-ruby/pull/700)
|
14
|
+
* Add `Configuration#endpoints` for reading the notify and sessions endpoints and `Configuration#endpoints=` for setting them
|
15
|
+
| [#701](https://github.com/bugsnag/bugsnag-ruby/pull/701)
|
16
|
+
* Add `Configuration#redacted_keys`. This is like `meta_data_filters` but matches strings with case-insensitive equality, rather than matching based on inclusion
|
17
|
+
| [#703](https://github.com/bugsnag/bugsnag-ruby/pull/703)
|
18
|
+
* Allow pausing and resuming sessions, giving more control over the stability score
|
19
|
+
| [#704](https://github.com/bugsnag/bugsnag-ruby/pull/704)
|
20
|
+
* Add `Configuration#vendor_paths` to replace `Configuration#vendor_path`
|
21
|
+
| [#705](https://github.com/bugsnag/bugsnag-ruby/pull/705)
|
22
|
+
|
23
|
+
### Deprecated
|
24
|
+
|
25
|
+
* In the next major release, `params` will only contain query string parameters. Currently it also contains the request body for form data requests, but this is deprecated in favour of the new `body` property
|
26
|
+
* The `Configuration#set_endpoints` method is now deprecated in favour of `Configuration#endpoints=`
|
27
|
+
* The `Configuration#meta_data_filters` option is now deprecated in favour of `Configuration#redacted_keys`
|
28
|
+
* The `Configuration#vendor_path` option is now deprecated in favour of `Configuration#vendor_paths`
|
29
|
+
|
30
|
+
## v6.23.0 (21 September 2021)
|
31
|
+
|
32
|
+
### Enhancements
|
33
|
+
|
34
|
+
* Sessions will now be delivered every 10 seconds, instead of every 30 seconds
|
35
|
+
| [#680](https://github.com/bugsnag/bugsnag-ruby/pull/680)
|
36
|
+
* Log errors that prevent delivery at `ERROR` level
|
37
|
+
| [#681](https://github.com/bugsnag/bugsnag-ruby/pull/681)
|
38
|
+
* Add `on_breadcrumb` callbacks to replace `before_breadcrumb_callbacks`
|
39
|
+
| [#686](https://github.com/bugsnag/bugsnag-ruby/pull/686)
|
40
|
+
* Add `context` attribute to configuration, which will be used as the default context for events. Using this option will disable automatic context setting
|
41
|
+
| [#687](https://github.com/bugsnag/bugsnag-ruby/pull/687)
|
42
|
+
| [#688](https://github.com/bugsnag/bugsnag-ruby/pull/688)
|
43
|
+
* Add `Bugsnag#breadcrumbs` getter to fetch the current list of breadcrumbs
|
44
|
+
| [#689](https://github.com/bugsnag/bugsnag-ruby/pull/689)
|
45
|
+
* Add `time` (an ISO8601 string in UTC) to `device` metadata
|
46
|
+
| [#690](https://github.com/bugsnag/bugsnag-ruby/pull/690)
|
47
|
+
* Add `errors` to `Report`/`Event` containing an array of `Error` objects. The `Error` object contains `error_class`, `error_message`, `stacktrace` and `type` (always "ruby")
|
48
|
+
| [#691](https://github.com/bugsnag/bugsnag-ruby/pull/691)
|
49
|
+
* Add `original_error` to `Report`/`Event` containing the original Exception instance
|
50
|
+
| [#692](https://github.com/bugsnag/bugsnag-ruby/pull/692)
|
51
|
+
* Add `request` to `Report`/`Event` containing HTTP request metadata
|
52
|
+
| [#693](https://github.com/bugsnag/bugsnag-ruby/pull/693)
|
53
|
+
* Add `add_metadata` and `clear_metadata` to `Report`/`Event`
|
54
|
+
| [#694](https://github.com/bugsnag/bugsnag-ruby/pull/694)
|
55
|
+
* Add `set_user` to `Report`/`Event`
|
56
|
+
| [#695](https://github.com/bugsnag/bugsnag-ruby/pull/695)
|
57
|
+
|
58
|
+
### Fixes
|
59
|
+
|
60
|
+
* Avoid starting session delivery thread when the current release stage is not enabled
|
61
|
+
| [#677](https://github.com/bugsnag/bugsnag-ruby/pull/677)
|
62
|
+
|
63
|
+
### Deprecated
|
64
|
+
|
65
|
+
* `before_breadcrumb_callbacks` have been deprecated in favour of `on_breadcrumb` callbacks and will be removed in the next major release
|
66
|
+
* For consistency with Bugsnag notifiers for other languages, a number of methods have been deprecated in this release. The old options will be removed in the next major version | [#676](https://github.com/bugsnag/bugsnag-ruby/pull/676)
|
67
|
+
* The `notify_release_stages` configuration option has been deprecated in favour of `enabled_release_stages`
|
68
|
+
* The `auto_capture_sessions` and `track_sessions` configuration options have been deprecated in favour of `auto_track_sessions`
|
69
|
+
* The `enabled_automatic_breadcrumb_types` configuration option has been deprecated in favour of `enabled_breadcrumb_types`
|
70
|
+
* The `Report` class has been deprecated in favour of the `Event` class
|
71
|
+
* The `Report#meta_data` attribute has been deprecated in favour of `Event#metadata`
|
72
|
+
* The `Breadcrumb#meta_data` attribute has been deprecated in favour of `Breadcrumb#metadata`
|
73
|
+
* The `Breadcrumb#name` attribute has been deprecated in favour of `Breadcrumb#message`
|
74
|
+
* The breadcrumb type constants in the `Bugsnag::Breadcrumbs` module has been deprecated in favour of the constants available in the `Bugsnag::BreadcrumbType` module
|
75
|
+
For example, `Bugsnag::Breadcrumbs::ERROR_BREADCRUMB_TYPE` is now available as `Bugsnag::BreadcrumbType::ERROR`
|
76
|
+
* `Report#exceptions` has been deprecated in favour of the new `errors` property
|
77
|
+
* `Report#raw_exceptions` has been deprecated in favour of the new `original_error` property
|
78
|
+
* Accessing request data via `Report#metadata` has been deprecated in favour of using the new `request` property. Request data will be moved out of metadata in the next major version
|
79
|
+
* The `Report#add_tab` and `Report#remove_tab` methods have been deprecated in favour of the new `add_metadata` and `clear_metadata` methods
|
80
|
+
|
81
|
+
## v6.22.1 (11 August 2021)
|
82
|
+
|
83
|
+
### Fixes
|
84
|
+
|
85
|
+
* Fix possible `LocalJumpError` introduced in v6.22.0
|
86
|
+
| [#675](https://github.com/bugsnag/bugsnag-ruby/pull/675)
|
87
|
+
|
88
|
+
## v6.22.0 (10 August 2021)
|
89
|
+
|
90
|
+
### Enhancements
|
91
|
+
|
92
|
+
* Add support for tracking exceptions and capturing metadata in Active Job, when not using an existing integration
|
93
|
+
| [#670](https://github.com/bugsnag/bugsnag-ruby/pull/670)
|
94
|
+
|
95
|
+
* Improve the report context when using Delayed Job or Resque as the Active Job queue adapter
|
96
|
+
| [#671](https://github.com/bugsnag/bugsnag-ruby/pull/671)
|
97
|
+
|
98
|
+
## v6.21.0 (23 June 2021)
|
99
|
+
|
100
|
+
### Enhancements
|
101
|
+
|
102
|
+
* Allow a `Method` or any object responding to `#call` to be used as an `on_error` callback or middleware
|
103
|
+
| [#662](https://github.com/bugsnag/bugsnag-ruby/pull/662)
|
104
|
+
| [odlp](https://github.com/odlp)
|
105
|
+
|
106
|
+
### Fixes
|
107
|
+
|
108
|
+
* Deliver when an error is raised in the block argument to `notify`
|
109
|
+
| [#660](https://github.com/bugsnag/bugsnag-ruby/pull/660)
|
110
|
+
| [aki77](https://github.com/aki77)
|
111
|
+
* Fix potential `NoMethodError` in `Bugsnag::Railtie` when using `require: false` in a Gemfile
|
112
|
+
| [#666](https://github.com/bugsnag/bugsnag-ruby/pull/666)
|
113
|
+
|
4
114
|
## v6.20.0 (29 March 2021)
|
5
115
|
|
6
116
|
### Enhancements
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
6.
|
1
|
+
6.24.0
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "bugsnag/breadcrumbs/breadcrumbs"
|
2
|
+
|
3
|
+
module Bugsnag
|
4
|
+
module BreadcrumbType
|
5
|
+
ERROR = Bugsnag::Breadcrumbs::ERROR_BREADCRUMB_TYPE
|
6
|
+
LOG = Bugsnag::Breadcrumbs::LOG_BREADCRUMB_TYPE
|
7
|
+
MANUAL = Bugsnag::Breadcrumbs::MANUAL_BREADCRUMB_TYPE
|
8
|
+
NAVIGATION = Bugsnag::Breadcrumbs::NAVIGATION_BREADCRUMB_TYPE
|
9
|
+
PROCESS = Bugsnag::Breadcrumbs::PROCESS_BREADCRUMB_TYPE
|
10
|
+
REQUEST = Bugsnag::Breadcrumbs::REQUEST_BREADCRUMB_TYPE
|
11
|
+
STATE = Bugsnag::Breadcrumbs::STATE_BREADCRUMB_TYPE
|
12
|
+
USER = Bugsnag::Breadcrumbs::USER_BREADCRUMB_TYPE
|
13
|
+
end
|
14
|
+
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module Bugsnag::Breadcrumbs
|
2
2
|
class Breadcrumb
|
3
|
+
# @deprecated Use {#message} instead
|
3
4
|
# @return [String] the breadcrumb name
|
4
5
|
attr_accessor :name
|
5
6
|
|
6
7
|
# @return [String] the breadcrumb type
|
7
8
|
attr_accessor :type
|
8
9
|
|
10
|
+
# @deprecated Use {#metadata} instead
|
9
11
|
# @return [Hash, nil] metadata hash containing strings, numbers, or booleans, or nil
|
10
12
|
attr_accessor :meta_data
|
11
13
|
|
@@ -23,7 +25,7 @@ module Bugsnag::Breadcrumbs
|
|
23
25
|
# @api private
|
24
26
|
#
|
25
27
|
# @param name [String] the breadcrumb name
|
26
|
-
# @param type [String] the breadcrumb type from Bugsnag::
|
28
|
+
# @param type [String] the breadcrumb type from Bugsnag::BreadcrumbType
|
27
29
|
# @param meta_data [Hash, nil] a hash containing strings, numbers, or booleans, or nil
|
28
30
|
# @param auto [Symbol] set to `:auto` if the breadcrumb is automatically generated
|
29
31
|
def initialize(name, type, meta_data, auto)
|
@@ -72,5 +74,36 @@ module Bugsnag::Breadcrumbs
|
|
72
74
|
:timestamp => @timestamp.iso8601(3)
|
73
75
|
}
|
74
76
|
end
|
77
|
+
|
78
|
+
# TODO: "message" and "metadata" can be simple attr_accessors when they
|
79
|
+
# replace "name" and "meta_data"
|
80
|
+
# NOTE: these are not aliases as YARD doesn't allow documenting the non-alias
|
81
|
+
# as deprecated without also marking the alias as deprecated
|
82
|
+
|
83
|
+
# The breadcrumb message
|
84
|
+
# @!attribute message
|
85
|
+
# @return [String]
|
86
|
+
def message
|
87
|
+
@name
|
88
|
+
end
|
89
|
+
|
90
|
+
# @param message [String]
|
91
|
+
# @return [void]
|
92
|
+
def message=(message)
|
93
|
+
@name = message
|
94
|
+
end
|
95
|
+
|
96
|
+
# A Hash containing arbitrary metadata associated with this breadcrumb
|
97
|
+
# @!attribute metadata
|
98
|
+
# @return [Hash, nil]
|
99
|
+
def metadata
|
100
|
+
@meta_data
|
101
|
+
end
|
102
|
+
|
103
|
+
# @param metadata [Hash, nil]
|
104
|
+
# @return [void]
|
105
|
+
def metadata=(metadata)
|
106
|
+
@meta_data = metadata
|
107
|
+
end
|
75
108
|
end
|
76
109
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "set"
|
2
|
+
|
3
|
+
module Bugsnag::Breadcrumbs
|
4
|
+
class OnBreadcrumbCallbackList
|
5
|
+
def initialize(configuration)
|
6
|
+
@callbacks = Set.new
|
7
|
+
@mutex = Mutex.new
|
8
|
+
@configuration = configuration
|
9
|
+
end
|
10
|
+
|
11
|
+
##
|
12
|
+
# @param callback [Proc, Method, #call]
|
13
|
+
# @return [void]
|
14
|
+
def add(callback)
|
15
|
+
@mutex.synchronize do
|
16
|
+
@callbacks.add(callback)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
##
|
21
|
+
# @param callback [Proc, Method, #call]
|
22
|
+
# @return [void]
|
23
|
+
def remove(callback)
|
24
|
+
@mutex.synchronize do
|
25
|
+
@callbacks.delete(callback)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
##
|
30
|
+
# @param breadcrumb [Breadcrumb]
|
31
|
+
# @return [void]
|
32
|
+
def call(breadcrumb)
|
33
|
+
@callbacks.each do |callback|
|
34
|
+
begin
|
35
|
+
should_continue = callback.call(breadcrumb)
|
36
|
+
rescue StandardError => e
|
37
|
+
@configuration.warn("Error occurred in on_breadcrumb callback: '#{e}'")
|
38
|
+
@configuration.warn("on_breadcrumb callback stacktrace: #{e.backtrace.inspect}")
|
39
|
+
end
|
40
|
+
|
41
|
+
# only stop if should_continue is explicity 'false' to allow callbacks
|
42
|
+
# to return 'nil'
|
43
|
+
if should_continue == false
|
44
|
+
breadcrumb.ignore!
|
45
|
+
break
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
data/lib/bugsnag/cleaner.rb
CHANGED
@@ -25,7 +25,7 @@ module Bugsnag
|
|
25
25
|
# @param url [String]
|
26
26
|
# @return [String]
|
27
27
|
def clean_url(url)
|
28
|
-
return url if @configuration.meta_data_filters.empty?
|
28
|
+
return url if @configuration.meta_data_filters.empty? && @configuration.redacted_keys.empty?
|
29
29
|
|
30
30
|
uri = URI(url)
|
31
31
|
return url unless uri.query
|
@@ -43,6 +43,33 @@ module Bugsnag
|
|
43
43
|
uri.to_s
|
44
44
|
end
|
45
45
|
|
46
|
+
##
|
47
|
+
# @param key [String, #to_s]
|
48
|
+
# @return [Boolean]
|
49
|
+
def filters_match?(key)
|
50
|
+
str = key.to_s
|
51
|
+
|
52
|
+
matched = @configuration.meta_data_filters.any? do |filter|
|
53
|
+
case filter
|
54
|
+
when Regexp
|
55
|
+
str.match(filter)
|
56
|
+
else
|
57
|
+
str.include?(filter.to_s)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
return true if matched
|
62
|
+
|
63
|
+
@configuration.redacted_keys.any? do |redaction_pattern|
|
64
|
+
case redaction_pattern
|
65
|
+
when Regexp
|
66
|
+
str.match(redaction_pattern)
|
67
|
+
when String
|
68
|
+
str.downcase == redaction_pattern.downcase
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
46
73
|
private
|
47
74
|
|
48
75
|
##
|
@@ -54,9 +81,11 @@ module Bugsnag
|
|
54
81
|
#
|
55
82
|
# @return [Boolean]
|
56
83
|
def deep_filters?
|
57
|
-
|
84
|
+
is_deep_filter = proc do |filter|
|
58
85
|
filter.is_a?(Regexp) && filter.to_s.include?("\\.".freeze)
|
59
86
|
end
|
87
|
+
|
88
|
+
@configuration.meta_data_filters.any?(&is_deep_filter) || @configuration.redacted_keys.any?(&is_deep_filter)
|
60
89
|
end
|
61
90
|
|
62
91
|
def clean_string(str)
|
@@ -137,22 +166,6 @@ module Bugsnag
|
|
137
166
|
value
|
138
167
|
end
|
139
168
|
|
140
|
-
##
|
141
|
-
# @param key [String, #to_s]
|
142
|
-
# @return [Boolean]
|
143
|
-
def filters_match?(key)
|
144
|
-
str = key.to_s
|
145
|
-
|
146
|
-
@configuration.meta_data_filters.any? do |filter|
|
147
|
-
case filter
|
148
|
-
when Regexp
|
149
|
-
str.match(filter)
|
150
|
-
else
|
151
|
-
str.include?(filter.to_s)
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
169
|
##
|
157
170
|
# If someone has a Rails filter like /^stuff\.secret/, it won't match
|
158
171
|
# "request.params.stuff.secret", so we try it both with and without the
|