bugsnag 5.5.0 → 6.0.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.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +33 -11
  3. data/CHANGELOG.md +23 -0
  4. data/Gemfile +20 -0
  5. data/Rakefile +19 -12
  6. data/UPGRADING.md +58 -0
  7. data/VERSION +1 -1
  8. data/bugsnag.gemspec +0 -9
  9. data/lib/bugsnag.rb +64 -86
  10. data/lib/bugsnag/configuration.rb +42 -26
  11. data/lib/bugsnag/delivery.rb +9 -0
  12. data/lib/bugsnag/delivery/synchronous.rb +3 -5
  13. data/lib/bugsnag/delivery/thread_queue.rb +4 -2
  14. data/lib/bugsnag/helpers.rb +5 -16
  15. data/lib/bugsnag/{delayed_job.rb → integrations/delayed_job.rb} +15 -7
  16. data/lib/bugsnag/{mailman.rb → integrations/mailman.rb} +13 -11
  17. data/lib/bugsnag/{que.rb → integrations/que.rb} +11 -11
  18. data/lib/bugsnag/{rack.rb → integrations/rack.rb} +22 -23
  19. data/lib/bugsnag/{rails → integrations/rails}/active_record_rescue.rb +9 -7
  20. data/lib/bugsnag/{rails → integrations/rails}/controller_methods.rb +0 -9
  21. data/lib/bugsnag/{railtie.rb → integrations/railtie.rb} +24 -21
  22. data/lib/bugsnag/{rake.rb → integrations/rake.rb} +12 -9
  23. data/lib/bugsnag/{resque.rb → integrations/resque.rb} +12 -9
  24. data/lib/bugsnag/integrations/shoryuken.rb +49 -0
  25. data/lib/bugsnag/{sidekiq.rb → integrations/sidekiq.rb} +13 -9
  26. data/lib/bugsnag/middleware/callbacks.rb +4 -8
  27. data/lib/bugsnag/middleware/classify_error.rb +7 -13
  28. data/lib/bugsnag/middleware/clearance_user.rb +8 -8
  29. data/lib/bugsnag/middleware/exception_meta_data.rb +34 -0
  30. data/lib/bugsnag/middleware/ignore_error_class.rb +21 -0
  31. data/lib/bugsnag/middleware/mailman.rb +4 -4
  32. data/lib/bugsnag/middleware/rack_request.rb +13 -13
  33. data/lib/bugsnag/middleware/rails3_request.rb +10 -10
  34. data/lib/bugsnag/middleware/rake.rb +5 -5
  35. data/lib/bugsnag/middleware/sidekiq.rb +5 -5
  36. data/lib/bugsnag/middleware/suggestion_data.rb +30 -0
  37. data/lib/bugsnag/middleware/warden_user.rb +6 -6
  38. data/lib/bugsnag/middleware_stack.rb +5 -5
  39. data/lib/bugsnag/report.rb +187 -0
  40. data/lib/bugsnag/stacktrace.rb +113 -0
  41. data/lib/bugsnag/tasks/bugsnag.rake +2 -70
  42. data/spec/cleaner_spec.rb +6 -0
  43. data/spec/configuration_spec.rb +1 -1
  44. data/spec/fixtures/middleware/internal_info_setter.rb +3 -3
  45. data/spec/fixtures/middleware/public_info_setter.rb +3 -3
  46. data/spec/fixtures/tasks/Rakefile +2 -3
  47. data/spec/integration_spec.rb +5 -20
  48. data/spec/{delayed_job_spec.rb → integrations/delayed_job_spec.rb} +0 -0
  49. data/spec/integrations/sidekiq_spec.rb +34 -0
  50. data/spec/middleware_spec.rb +108 -35
  51. data/spec/rack_spec.rb +1 -1
  52. data/spec/{notification_spec.rb → report_spec.rb} +226 -209
  53. data/spec/spec_helper.rb +18 -0
  54. data/spec/{code_spec.rb → stacktrace_spec.rb} +1 -1
  55. metadata +23 -139
  56. data/.document +0 -5
  57. data/lib/bugsnag/capistrano.rb +0 -7
  58. data/lib/bugsnag/capistrano2.rb +0 -32
  59. data/lib/bugsnag/delay/resque.rb +0 -21
  60. data/lib/bugsnag/deploy.rb +0 -35
  61. data/lib/bugsnag/middleware/rails2_request.rb +0 -52
  62. data/lib/bugsnag/notification.rb +0 -506
  63. data/lib/bugsnag/rails.rb +0 -70
  64. data/lib/bugsnag/rails/action_controller_rescue.rb +0 -74
  65. data/lib/bugsnag/shoryuken.rb +0 -41
  66. data/lib/bugsnag/tasks/bugsnag.cap +0 -48
  67. data/rails/init.rb +0 -7
@@ -1,70 +0,0 @@
1
- # Rails 2.x hooks
2
- # For Rails 3+ hooks, see railtie.rb
3
-
4
- require "bugsnag"
5
- require "bugsnag/rails/controller_methods"
6
- require "bugsnag/rails/action_controller_rescue"
7
- require "bugsnag/rails/active_record_rescue"
8
- require "bugsnag/middleware/rails2_request"
9
- require "bugsnag/middleware/callbacks"
10
-
11
- module Bugsnag
12
- module Rails
13
- def self.initialize
14
- if defined?(ActionController::Base)
15
- ActionController::Base.send(:include, Bugsnag::Rails::ActionControllerRescue)
16
- ActionController::Base.send(:include, Bugsnag::Rails::ControllerMethods)
17
- end
18
- if defined?(ActiveRecord::Base) && Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new("4.3")
19
- unless ActiveRecord::Base.respond_to?(:raise_in_transactional_callbacks) && ActiveRecord::Base.raise_in_transactional_callbacks
20
- ActiveRecord::Base.send(:include, Bugsnag::Rails::ActiveRecordRescue)
21
- end
22
- end
23
-
24
- Bugsnag.configure do |config|
25
- config.logger ||= rails_logger
26
- config.release_stage = release_stage if release_stage
27
- config.project_root = rails_root if rails_root
28
-
29
- config.middleware.insert_before(Bugsnag::Middleware::Callbacks,Bugsnag::Middleware::Rails2Request)
30
- end
31
-
32
- # Auto-load configuration settings from config/bugsnag.yml if it exists
33
- config_file = File.join(rails_root, "config", "bugsnag.yml")
34
- config = YAML.load_file(config_file) if File.exist?(config_file)
35
- Bugsnag.configure(config[rails_env] ? config[rails_env] : config) if config
36
-
37
- Bugsnag.configuration.app_type = "rails"
38
- end
39
-
40
- def self.rails_logger
41
- if defined?(::Rails.logger)
42
- rails_logger = ::Rails.logger
43
- elsif defined?(RAILS_DEFAULT_LOGGER)
44
- rails_logger = RAILS_DEFAULT_LOGGER
45
- end
46
- end
47
-
48
- def self.release_stage
49
- ENV["BUGSNAG_RELEASE_STAGE"] || rails_env
50
- end
51
-
52
- def self.rails_env
53
- if defined?(::Rails.env)
54
- ::Rails.env
55
- elsif defined?(RAILS_ENV)
56
- RAILS_ENV
57
- end
58
- end
59
-
60
- def self.rails_root
61
- if defined?(::Rails.root)
62
- ::Rails.root
63
- elsif defined?(RAILS_ROOT)
64
- RAILS_ROOT
65
- end
66
- end
67
- end
68
- end
69
-
70
- Bugsnag::Rails.initialize
@@ -1,74 +0,0 @@
1
- # Rails 2.x only
2
- module Bugsnag::Rails
3
- module ActionControllerRescue
4
-
5
- SEVERITY_REASON = {
6
- :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
7
- :attributes => {
8
- :framework => "Rails"
9
- }
10
- }
11
-
12
- def self.included(base)
13
- base.extend(ClassMethods)
14
-
15
- # Hook into rails exception rescue stack
16
- base.send(:alias_method, :rescue_action_in_public_without_bugsnag, :rescue_action_in_public)
17
- base.send(:alias_method, :rescue_action_in_public, :rescue_action_in_public_with_bugsnag)
18
-
19
- base.send(:alias_method, :rescue_action_locally_without_bugsnag, :rescue_action_locally)
20
- base.send(:alias_method, :rescue_action_locally, :rescue_action_locally_with_bugsnag)
21
-
22
- # Run filters on requests to capture request data
23
- base.send(:prepend_before_filter, :set_bugsnag_request_data)
24
- end
25
-
26
- private
27
- def set_bugsnag_request_data
28
- Bugsnag.clear_request_data
29
- Bugsnag.set_request_data(:rails2_request, request)
30
- end
31
-
32
- def rescue_action_in_public_with_bugsnag(exception)
33
- Bugsnag.auto_notify(exception, {
34
- :severity_reason => SEVERITY_REASON
35
- })
36
-
37
- rescue_action_in_public_without_bugsnag(exception)
38
- end
39
-
40
- def rescue_action_locally_with_bugsnag(exception)
41
- Bugsnag.auto_notify(exception, {
42
- :severity_reason => SEVERITY_REASON
43
- })
44
-
45
- rescue_action_locally_without_bugsnag(exception)
46
- end
47
-
48
- module ClassMethods
49
-
50
- def self.extended(base)
51
- base.singleton_class.class_eval do
52
- alias_method_chain :filter_parameter_logging, :bugsnag
53
- end
54
- end
55
-
56
- # Rails 2 does parameter filtering via a controller configuration method
57
- # that dynamically defines a method on the controller, so the configured
58
- # parameters aren't easily accessible. Intercept these parameters as
59
- # they're configured so that the Bugsnag configuration can take them
60
- # into account.
61
- #
62
- def filter_parameter_logging_with_bugsnag(*filter_words, &block)
63
- if filter_words.length > 0
64
- Bugsnag.configure do |config|
65
- # Use the same regular expression that Rails parameter filtering uses.
66
- config.params_filters << Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true)
67
- end
68
- end
69
- filter_parameter_logging_without_bugsnag(*filter_words, &block)
70
- end
71
- end
72
-
73
- end
74
- end
@@ -1,41 +0,0 @@
1
- require 'shoryuken'
2
-
3
- module Bugsnag
4
- class Shoryuken
5
- def initialize
6
- Bugsnag.configuration.app_type = "shoryuken"
7
- Bugsnag.configuration.default_delivery_method = :synchronous
8
- end
9
-
10
- def call(_, queue, _, body)
11
- begin
12
- Bugsnag.before_notify_callbacks << lambda {|notification|
13
- notification.add_tab(:shoryuken, {
14
- queue: queue,
15
- body: body
16
- })
17
- }
18
-
19
- yield
20
- rescue Exception => ex
21
- Bugsnag.auto_notify(ex, {
22
- :severity_reason => {
23
- :type => Bugsnag::Notification::UNHANDLED_EXCEPTION_MIDDLEWARE,
24
- :attributes => {
25
- :framework => "Shoryuken"
26
- }
27
- }
28
- }) unless [Interrupt, SystemExit, SignalException].include?(ex.class)
29
- raise
30
- ensure
31
- Bugsnag.clear_request_data
32
- end
33
- end
34
- end
35
- end
36
-
37
- ::Shoryuken.configure_server do |config|
38
- config.server_middleware do |chain|
39
- chain.add ::Bugsnag::Shoryuken
40
- end
41
- end
@@ -1,48 +0,0 @@
1
- namespace :load do
2
-
3
- task :defaults do
4
-
5
- set :bugsnag_default_hooks, ->{ true }
6
-
7
- end
8
-
9
- end
10
-
11
- namespace :deploy do
12
-
13
- before :starting, :bugsnag_hooks do
14
- invoke 'bugsnag:add_default_hooks' if fetch(:bugsnag_default_hooks)
15
- end
16
-
17
- end
18
-
19
- namespace :bugsnag do
20
-
21
- task :add_default_hooks do
22
- after 'deploy:published', 'bugsnag:deploy'
23
- end
24
-
25
- desc 'Notify Bugsnag that new production code has been deployed'
26
- task :deploy do
27
- run_locally do
28
- begin
29
- Bugsnag::Deploy.notify({
30
- :api_key => fetch(:bugsnag_api_key, ENV["BUGSNAG_API_KEY"]),
31
- :release_stage => fetch(:bugsnag_env) || ENV["BUGSNAG_RELEASE_STAGE"] || fetch(:rails_env) || fetch(:stage) || "production",
32
- :revision => fetch(:current_revision, ENV["BUGSNAG_REVISION"]),
33
- :repository => fetch(:repo_url, ENV["BUGSNAG_REPOSITORY"]),
34
- :branch => fetch(:branch, ENV["BUGSNAG_BRANCH"]),
35
- :app_version => fetch(:app_version, ENV["BUGSNAG_APP_VERSION"]),
36
- :endpoint => fetch(:bugsnag_endpoint, Bugsnag::Configuration::DEFAULT_ENDPOINT),
37
- :use_ssl => fetch(:bugsnag_use_ssl, true)
38
- })
39
- rescue
40
- error "Bugsnag deploy notification failed, #{$!.inspect}"
41
- end
42
-
43
- info 'Bugsnag deploy notification complete.'
44
- end
45
- end
46
-
47
- end
48
- # vi:ft=ruby
@@ -1,7 +0,0 @@
1
- # On Rails 2.x GEM_ROOT/rails/init.rb is auto loaded for all gems
2
- # so this is the place to initialize Rails 2.x plugin support
3
- if Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new("3.0")
4
- require "bugsnag/rails"
5
- else
6
- Bugsnag.warn "Blocked attempt to initialize legacy Rails 2.x extensions"
7
- end