bugsnag 4.2.1 → 5.0.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 +22 -0
- data/README.md +3 -9
- data/VERSION +1 -1
- data/lib/bugsnag/capistrano2.rb +1 -1
- data/lib/bugsnag/configuration.rb +0 -1
- data/lib/bugsnag/mailman.rb +5 -3
- data/lib/bugsnag/meta_data.rb +1 -0
- data/lib/bugsnag/middleware/sidekiq.rb +4 -1
- data/lib/bugsnag/notification.rb +7 -4
- data/lib/bugsnag/rack.rb +7 -1
- data/lib/bugsnag/rails.rb +5 -1
- data/lib/bugsnag/railtie.rb +2 -4
- data/lib/bugsnag/resque.rb +4 -1
- data/lib/bugsnag/sidekiq.rb +9 -19
- data/lib/bugsnag/tasks/bugsnag.cap +1 -1
- data/spec/notification_spec.rb +27 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5403d5abb730249b3c5b9a55199be90907d0b09b
|
4
|
+
data.tar.gz: f7279565d7c9ff5f7de4573c70116dc5411fda66
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a73f4524eb83ab779faa0ed7374440b07585ef70b59a8331405b64a7c42e40b699044144ccd209ba323f3f740e56b875d4f78c9b19aa5609bc2436d679afeee1
|
7
|
+
data.tar.gz: 404a4ef28199ae30b4a10cb9591699d218bc698f19316c9f78b8045da52b7a07339aeb8baa25be0b4d7063713819dccf40a6a73897da1a15de8e85cb2bbc4c31
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
Changelog
|
2
2
|
=========
|
3
3
|
|
4
|
+
## 5.0.0 (23 August 2016)
|
5
|
+
|
6
|
+
### Enhancements
|
7
|
+
|
8
|
+
* Remove RoutingError from default ignore classes
|
9
|
+
| [#308](https://github.com/bugsnag/bugsnag-ruby/issues/308)
|
10
|
+
* Prefer BUGSNAG_RELEASE_STAGE over RAILS_ENV for release_stage
|
11
|
+
| [#298](https://github.com/bugsnag/bugsnag-ruby/issues/298)
|
12
|
+
* Apply grouping hash if method `bugsnag_grouping_hash` is available on the object
|
13
|
+
| [#318](https://github.com/bugsnag/bugsnag-ruby/issues/318)
|
14
|
+
| [#311](https://github.com/bugsnag/bugsnag-ruby/issues/311)
|
15
|
+
* Sidekiq improvements
|
16
|
+
| [#317](https://github.com/bugsnag/bugsnag-ruby/issues/317)
|
17
|
+
| [#282](https://github.com/bugsnag/bugsnag-ruby/issues/282)
|
18
|
+
| [#309](https://github.com/bugsnag/bugsnag-ruby/issues/309)
|
19
|
+
| [#306](https://github.com/bugsnag/bugsnag-ruby/issues/306)
|
20
|
+
|
21
|
+
### Fixes
|
22
|
+
|
23
|
+
* Exception backtrace could be empty
|
24
|
+
| [#307](https://github.com/bugsnag/bugsnag-ruby/issues/307)
|
25
|
+
|
4
26
|
## 4.2.1 (23 Jun 2016)
|
5
27
|
|
6
28
|
### Fixes
|
data/README.md
CHANGED
@@ -2,10 +2,7 @@
|
|
2
2
|
[![build status](https://travis-ci.org/bugsnag/bugsnag-ruby.svg?branch=master)](https://travis-ci.org/bugsnag/bugsnag-ruby)
|
3
3
|
|
4
4
|
|
5
|
-
The Bugsnag exception reporter for Ruby gives you instant notification of exceptions
|
6
|
-
thrown from your **[Rails](https://bugsnag.com/platforms/rails)**, **Sinatra**, **Rack** or **plain Ruby** app.
|
7
|
-
Any uncaught exceptions will trigger a notification to be sent to your
|
8
|
-
Bugsnag project.
|
5
|
+
The Bugsnag exception reporter for Ruby gives you instant notification of exceptions thrown from your **[Rails](https://bugsnag.com/platforms/rails)**, **Sinatra**, **Rack** or **plain Ruby** app. Any uncaught exceptions will trigger a notification to be sent to your Bugsnag project.
|
9
6
|
|
10
7
|
## Features
|
11
8
|
|
@@ -40,11 +37,8 @@ Bugsnag project.
|
|
40
37
|
|
41
38
|
## Contributing
|
42
39
|
|
43
|
-
All contributors are welcome! For information on how to build, test
|
44
|
-
and release `bugsnag-ruby`, see our
|
45
|
-
[contributing guide](https://github.com/bugsnag/bugsnag-ruby/blob/master/CONTRIBUTING.md). Feel free to comment on [existing issues](https://github.com/bugsnag/bugsnag-ruby/issues) for clarification or starting points.
|
40
|
+
All contributors are welcome! For information on how to build, test and release `bugsnag-ruby`, see our [contributing guide](https://github.com/bugsnag/bugsnag-ruby/blob/master/CONTRIBUTING.md). Feel free to comment on [existing issues](https://github.com/bugsnag/bugsnag-ruby/issues) for clarification or starting points.
|
46
41
|
|
47
42
|
## License
|
48
43
|
|
49
|
-
The Bugsnag ruby notifier is free software released under the MIT License.
|
50
|
-
See [LICENSE.txt](LICENSE.txt) for details.
|
44
|
+
The Bugsnag ruby notifier is free software released under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5.0.0
|
data/lib/bugsnag/capistrano2.rb
CHANGED
@@ -11,7 +11,7 @@ module Bugsnag
|
|
11
11
|
begin
|
12
12
|
Bugsnag::Deploy.notify({
|
13
13
|
:api_key => fetch(:bugsnag_api_key, ENV["BUGSNAG_API_KEY"]),
|
14
|
-
:release_stage =>
|
14
|
+
:release_stage => ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env, "production"),
|
15
15
|
:revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
|
16
16
|
:repository => fetch(:repository, ENV["BUGSNAG_REPOSITORY"]),
|
17
17
|
:branch => fetch(:branch, ENV["BUGSNAG_BRANCH"],
|
@@ -50,7 +50,6 @@ module Bugsnag
|
|
50
50
|
"AbstractController::ActionNotFound",
|
51
51
|
"ActionController::InvalidAuthenticityToken",
|
52
52
|
"ActionController::ParameterMissing",
|
53
|
-
"ActionController::RoutingError",
|
54
53
|
"ActionController::UnknownAction",
|
55
54
|
"ActionController::UnknownFormat",
|
56
55
|
"ActionController::UnknownHttpMethod",
|
data/lib/bugsnag/mailman.rb
CHANGED
@@ -2,6 +2,11 @@ require 'mailman'
|
|
2
2
|
|
3
3
|
module Bugsnag
|
4
4
|
class Mailman
|
5
|
+
def initialize
|
6
|
+
Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Mailman)
|
7
|
+
Bugsnag.configuration.app_type = "mailman"
|
8
|
+
end
|
9
|
+
|
5
10
|
def call(mail)
|
6
11
|
begin
|
7
12
|
|
@@ -23,6 +28,3 @@ end
|
|
23
28
|
if Mailman.config.respond_to?(:middleware)
|
24
29
|
Mailman.config.middleware.add ::Bugsnag::Mailman
|
25
30
|
end
|
26
|
-
|
27
|
-
Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Mailman)
|
28
|
-
Bugsnag.configuration.app_type = "mailman"
|
data/lib/bugsnag/meta_data.rb
CHANGED
@@ -6,7 +6,10 @@ module Bugsnag::Middleware
|
|
6
6
|
|
7
7
|
def call(notification)
|
8
8
|
sidekiq = notification.request_data[:sidekiq]
|
9
|
-
|
9
|
+
if sidekiq
|
10
|
+
notification.add_tab(:sidekiq, sidekiq)
|
11
|
+
notification.context ||= "#{sidekiq[:msg]['wrapper'] || sidekiq[:msg]['class']}@#{sidekiq[:msg]['queue']}"
|
12
|
+
end
|
10
13
|
@bugsnag.call(notification)
|
11
14
|
end
|
12
15
|
end
|
data/lib/bugsnag/notification.rb
CHANGED
@@ -198,6 +198,9 @@ module Bugsnag
|
|
198
198
|
if exception.bugsnag_context.is_a?(String)
|
199
199
|
self.context = exception.bugsnag_context
|
200
200
|
end
|
201
|
+
if exception.bugsnag_grouping_hash.is_a?(String)
|
202
|
+
self.grouping_hash = exception.bugsnag_grouping_hash
|
203
|
+
end
|
201
204
|
end
|
202
205
|
end
|
203
206
|
|
@@ -343,7 +346,7 @@ module Bugsnag
|
|
343
346
|
{
|
344
347
|
:errorClass => error_class(exception),
|
345
348
|
:message => exception.message,
|
346
|
-
:stacktrace => stacktrace(exception)
|
349
|
+
:stacktrace => stacktrace(exception.backtrace)
|
347
350
|
}
|
348
351
|
end
|
349
352
|
end
|
@@ -354,9 +357,9 @@ module Bugsnag
|
|
354
357
|
(exception.is_a? Class) ? exception.name : exception.class.name
|
355
358
|
end
|
356
359
|
|
357
|
-
def stacktrace(
|
358
|
-
|
359
|
-
|
360
|
+
def stacktrace(backtrace)
|
361
|
+
backtrace = caller if !backtrace || backtrace.empty?
|
362
|
+
backtrace.map do |trace|
|
360
363
|
if trace.match(BACKTRACE_LINE_REGEX)
|
361
364
|
file, line_str, method = [$1, $2, $3]
|
362
365
|
elsif trace.match(JAVA_BACKTRACE_REGEX)
|
data/lib/bugsnag/rack.rb
CHANGED
@@ -6,7 +6,7 @@ module Bugsnag
|
|
6
6
|
# Configure bugsnag rack defaults
|
7
7
|
Bugsnag.configure do |config|
|
8
8
|
# Try to set the release_stage automatically if it hasn't already been set
|
9
|
-
config.release_stage ||=
|
9
|
+
config.release_stage ||= release_stage
|
10
10
|
|
11
11
|
# Try to set the project_root if it hasn't already been set, or show a warning if we can't
|
12
12
|
unless config.project_root && !config.project_root.to_s.empty?
|
@@ -49,5 +49,11 @@ module Bugsnag
|
|
49
49
|
# Clear per-request data after processing the each request
|
50
50
|
Bugsnag.clear_request_data
|
51
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def release_stage
|
56
|
+
ENV["BUGSNAG_RELEASE_STAGE"] || ENV["RACK_ENV"]
|
57
|
+
end
|
52
58
|
end
|
53
59
|
end
|
data/lib/bugsnag/rails.rb
CHANGED
@@ -23,7 +23,7 @@ module Bugsnag
|
|
23
23
|
|
24
24
|
Bugsnag.configure do |config|
|
25
25
|
config.logger ||= rails_logger
|
26
|
-
config.release_stage =
|
26
|
+
config.release_stage = release_stage if release_stage
|
27
27
|
config.project_root = rails_root if rails_root
|
28
28
|
|
29
29
|
config.middleware.insert_before(Bugsnag::Middleware::Callbacks,Bugsnag::Middleware::Rails2Request)
|
@@ -45,6 +45,10 @@ module Bugsnag
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
def self.release_stage
|
49
|
+
ENV["BUGSNAG_RELEASE_STAGE"] || rails_env
|
50
|
+
end
|
51
|
+
|
48
52
|
def self.rails_env
|
49
53
|
if defined?(::Rails.env)
|
50
54
|
::Rails.env
|
data/lib/bugsnag/railtie.rb
CHANGED
@@ -7,8 +7,6 @@ require "bugsnag/middleware/rack_request"
|
|
7
7
|
|
8
8
|
module Bugsnag
|
9
9
|
class Railtie < Rails::Railtie
|
10
|
-
cattr_accessor :running_as_dependency
|
11
|
-
|
12
10
|
rake_tasks do
|
13
11
|
require "bugsnag/rake"
|
14
12
|
load "bugsnag/tasks/bugsnag.rake"
|
@@ -29,7 +27,7 @@ module Bugsnag
|
|
29
27
|
# Configure bugsnag rails defaults
|
30
28
|
Bugsnag.configure do |config|
|
31
29
|
config.logger = ::Rails.logger
|
32
|
-
config.release_stage = ::Rails.env.to_s
|
30
|
+
config.release_stage = ENV["BUGSNAG_RELEASE_STAGE"] || ::Rails.env.to_s
|
33
31
|
config.project_root = ::Rails.root.to_s
|
34
32
|
config.middleware.insert_before Bugsnag::Middleware::Callbacks, Bugsnag::Middleware::Rails3Request
|
35
33
|
end
|
@@ -51,7 +49,7 @@ module Bugsnag
|
|
51
49
|
ActiveRecord::Base.send(:include, Bugsnag::Rails::ActiveRecordRescue)
|
52
50
|
end
|
53
51
|
|
54
|
-
Bugsnag.configuration.app_type = "rails"
|
52
|
+
Bugsnag.configuration.app_type = "rails"
|
55
53
|
end
|
56
54
|
|
57
55
|
# Configure params_filters after initialization, so that rails initializers
|
data/lib/bugsnag/resque.rb
CHANGED
@@ -37,4 +37,7 @@ Resque::Failure::Bugsnag = Bugsnag::Resque
|
|
37
37
|
# Auto-load the failure backend
|
38
38
|
Bugsnag::Resque.add_failure_backend
|
39
39
|
|
40
|
-
|
40
|
+
Resque.before_first_fork do
|
41
|
+
Bugsnag.configuration.app_type = "resque"
|
42
|
+
Bugsnag.configuration.delivery_method = :synchronous
|
43
|
+
end
|
data/lib/bugsnag/sidekiq.rb
CHANGED
@@ -2,9 +2,14 @@ require 'sidekiq'
|
|
2
2
|
|
3
3
|
module Bugsnag
|
4
4
|
class Sidekiq
|
5
|
+
def initialize
|
6
|
+
Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Sidekiq)
|
7
|
+
Bugsnag.configuration.app_type = "sidekiq"
|
8
|
+
Bugsnag.configuration.delivery_method = :synchronous
|
9
|
+
end
|
10
|
+
|
5
11
|
def call(worker, msg, queue)
|
6
12
|
begin
|
7
|
-
|
8
13
|
# store msg/queue in thread local state to be read by Bugsnag::Middleware::Sidekiq
|
9
14
|
Bugsnag.set_request_data :sidekiq, { :msg => msg, :queue => queue }
|
10
15
|
|
@@ -20,23 +25,8 @@ module Bugsnag
|
|
20
25
|
end
|
21
26
|
end
|
22
27
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
chain.add ::Bugsnag::Sidekiq
|
27
|
-
end
|
28
|
+
::Sidekiq.configure_server do |config|
|
29
|
+
config.server_middleware do |chain|
|
30
|
+
chain.add ::Bugsnag::Sidekiq
|
28
31
|
end
|
29
|
-
else
|
30
|
-
::Sidekiq.configure_server do |config|
|
31
|
-
config.error_handlers << lambda do |ex, ctx|
|
32
|
-
Bugsnag.auto_notify(ex, :sidekiq => ctx, :context => "#{ctx['class']}@#{ctx['queue']}")
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Sidekiq)
|
38
|
-
Bugsnag.configuration.app_type = "sidekiq"
|
39
|
-
|
40
|
-
if defined?(::Sidekiq::CLI) && defined?(Bugsnag::Railtie)
|
41
|
-
Bugsnag::Railtie.running_as_dependency = true
|
42
32
|
end
|
@@ -28,7 +28,7 @@ namespace :bugsnag do
|
|
28
28
|
begin
|
29
29
|
Bugsnag::Deploy.notify({
|
30
30
|
:api_key => fetch(:bugsnag_api_key, ENV["BUGSNAG_API_KEY"]),
|
31
|
-
:release_stage => fetch(:bugsnag_env) || fetch(:rails_env) || fetch(:stage) ||
|
31
|
+
:release_stage => fetch(:bugsnag_env) || ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env) || fetch(:stage) || "production",
|
32
32
|
:revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
|
33
33
|
:repository => fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"]),
|
34
34
|
:branch => fetch(:branch, ENV["BUGSNAG_BRANCH"]),
|
data/spec/notification_spec.rb
CHANGED
@@ -223,6 +223,18 @@ describe Bugsnag::Notification do
|
|
223
223
|
}
|
224
224
|
end
|
225
225
|
|
226
|
+
it "accepts grouping_hash from an exception that mixes in Bugsnag::MetaData" do
|
227
|
+
exception = BugsnagTestExceptionWithMetaData.new("It crashed")
|
228
|
+
exception.bugsnag_grouping_hash = "exception_hash"
|
229
|
+
|
230
|
+
Bugsnag.notify(exception)
|
231
|
+
|
232
|
+
expect(Bugsnag).to have_sent_notification{ |payload|
|
233
|
+
event = get_event_from_payload(payload)
|
234
|
+
expect(event["groupingHash"]).to eq("exception_hash")
|
235
|
+
}
|
236
|
+
end
|
237
|
+
|
226
238
|
it "accept contexts from an exception that mixes in Bugsnag::MetaData, but override using the overrides" do
|
227
239
|
|
228
240
|
exception = BugsnagTestExceptionWithMetaData.new("It crashed")
|
@@ -857,6 +869,21 @@ describe Bugsnag::Notification do
|
|
857
869
|
}
|
858
870
|
end
|
859
871
|
|
872
|
+
it 'should handle exceptions with empty backtrace' do
|
873
|
+
begin
|
874
|
+
err = RuntimeError.new
|
875
|
+
err.set_backtrace([])
|
876
|
+
raise err
|
877
|
+
rescue
|
878
|
+
Bugsnag.notify $!
|
879
|
+
end
|
880
|
+
|
881
|
+
expect(Bugsnag).to have_sent_notification { |payload|
|
882
|
+
exception = get_exception_from_payload(payload)
|
883
|
+
expect(exception['stacktrace'].size).to be > 0
|
884
|
+
}
|
885
|
+
end
|
886
|
+
|
860
887
|
if defined?(JRUBY_VERSION)
|
861
888
|
|
862
889
|
it "should work with java.lang.Throwables" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubyforge_project:
|
191
|
-
rubygems_version: 2.
|
191
|
+
rubygems_version: 2.2.2
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: Ruby notifier for bugsnag.com
|