From a28bd43215bba68a8ddcedb461792b7c89059f00 Mon Sep 17 00:00:00 2001 From: Toby Hsieh Date: Mon, 17 Jun 2019 10:51:38 -0700 Subject: [PATCH 01/13] Handle cases where job is nil in Que error notifier This should fix #545 --- CHANGELOG.md | 9 +++++++++ lib/bugsnag/integrations/que.rb | 24 +++++++++++++----------- spec/integrations/que_spec.rb | 22 +++++++++++++++++++++- 3 files changed, 43 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d651459f4..a289dde3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,15 @@ Changelog ========= +## TBD + +### Fixes + +* Handle `nil` values for the `job` block parameter for the Que error notifier. + This occurs under some conditions such as database connection failures. + | [#545](https://github.com/bugsnag/bugsnag-ruby/issues/545) + | [#548](https://github.com/bugsnag/bugsnag-ruby/pull/548) + ## 6.11.1 (22 Jan 2019) ### Fixes diff --git a/lib/bugsnag/integrations/que.rb b/lib/bugsnag/integrations/que.rb index ff088570a..fee75adf4 100644 --- a/lib/bugsnag/integrations/que.rb +++ b/lib/bugsnag/integrations/que.rb @@ -1,21 +1,23 @@ if defined?(::Que) handler = proc do |error, job| begin - job = job.dup # Make sure the original job object is not mutated. + job &&= job.dup # Make sure the original job object is not mutated. Bugsnag.notify(error, true) do |report| - job[:error_count] += 1 + if job + job[:error_count] += 1 - # If the job was scheduled using ActiveJob then unwrap the job details for clarity: - if job[:job_class] == "ActiveJob::QueueAdapters::QueAdapter::JobWrapper" - wrapped_job = job[:args].last - wrapped_job = wrapped_job.each_with_object({}) { |(k, v), result| result[k.to_sym] = v } # Symbolize keys + # If the job was scheduled using ActiveJob then unwrap the job details for clarity: + if job[:job_class] == "ActiveJob::QueueAdapters::QueAdapter::JobWrapper" + wrapped_job = job[:args].last + wrapped_job = wrapped_job.each_with_object({}) { |(k, v), result| result[k.to_sym] = v } # Symbolize keys - # Align key names with keys in `job` - wrapped_job[:queue] = wrapped_job.delete(:queue_name) - wrapped_job[:args] = wrapped_job.delete(:arguments) + # Align key names with keys in `job` + wrapped_job[:queue] = wrapped_job.delete(:queue_name) + wrapped_job[:args] = wrapped_job.delete(:arguments) - job.merge!(wrapper_job_class: job[:job_class], wrapper_job_id: job[:job_id]).merge!(wrapped_job) + job.merge!(wrapper_job_class: job[:job_class], wrapper_job_id: job[:job_id]).merge!(wrapped_job) + end end report.add_tab(:job, job) @@ -41,4 +43,4 @@ Bugsnag.configuration.app_type ||= "que" Que.error_handler = handler end -end \ No newline at end of file +end diff --git a/spec/integrations/que_spec.rb b/spec/integrations/que_spec.rb index 259217eb6..c1c212a07 100644 --- a/spec/integrations/que_spec.rb +++ b/spec/integrations/que_spec.rb @@ -6,6 +6,9 @@ unless defined?(::Que) @mocked_que = true class ::Que + class << self + attr_accessor :error_notifier + end end end end @@ -25,7 +28,6 @@ class ::Que expect(report).to receive(:add_tab).with(:job, { :error_count => 1, :job_class => 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper', - :args => [{"queue_name" => "foo", "arguments" => "bar"}], :job_id => "ID", :wrapper_job_class => 'ActiveJob::QueueAdapters::QueAdapter::JobWrapper', :wrapper_job_id => "ID", @@ -54,6 +56,24 @@ class ::Que load './lib/bugsnag/integrations/que.rb' end + context 'when the job is nil' do + it 'notifies Bugsnag' do + load './lib/bugsnag/integrations/que.rb' + error = RuntimeError.new('nil job') + report = Bugsnag::Report.new(error, Bugsnag::Configuration.new) + expect(Bugsnag).to receive(:notify).with(error, true).and_yield(report) + + Que.error_notifier.call(error, nil) + + expect(report.meta_data['custom'].fetch('job')).to eq(nil) + expect(report.severity).to eq('error') + expect(report.severity_reason).to eq({ + :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE, + :attributes => {:framework => 'Que'}, + }) + end + end + after do Object.send(:remove_const, :Que) if @mocked_que end From c52a9a73bd47752cb7064d697256b326261b451a Mon Sep 17 00:00:00 2001 From: Toby Hsieh Date: Tue, 13 Aug 2019 17:56:40 -0700 Subject: [PATCH 02/13] Use Module#prepend for Rake integration if Ruby version is new enough This might fix https://github.com/bugsnag/bugsnag-ruby/issues/556 If another gem uses `Module#prepend` on `Rake::Task`, then it can lead to infinite mutual recursion if we use alias_method to monkey patch the `#execute` method. --- lib/bugsnag/integrations/rake.rb | 82 ++++++++++++++++++++++---------- spec/fixtures/tasks/Rakefile | 12 +++++ spec/integrations/rake_spec.rb | 21 ++++---- 3 files changed, 77 insertions(+), 38 deletions(-) diff --git a/lib/bugsnag/integrations/rake.rb b/lib/bugsnag/integrations/rake.rb index a1cfbd397..9c7df1ef9 100644 --- a/lib/bugsnag/integrations/rake.rb +++ b/lib/bugsnag/integrations/rake.rb @@ -2,36 +2,66 @@ Rake::TaskManager.record_task_metadata = true -class Rake::Task - - FRAMEWORK_ATTRIBUTES = { - :framework => "Rake" - } - - ## - # Executes the rake task with Bugsnag setup with contextual data. - def execute_with_bugsnag(args=nil) - Bugsnag.configuration.app_type ||= "rake" - old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] - Bugsnag.configuration.set_request_data :bugsnag_running_task, self - - execute_without_bugsnag(args) - - rescue Exception => ex - Bugsnag.notify(ex, true) do |report| - report.severity = "error" - report.severity_reason = { - :type => Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE, - :attributes => FRAMEWORK_ATTRIBUTES +if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.0') + module Bugsnag + module RakeTask + FRAMEWORK_ATTRIBUTES = { + framework: 'Rake' } + + # Executes the rake task with Bugsnag setup with contextual data. + def execute(args = nil) + Bugsnag.configuration.app_type ||= "rake" + old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] + Bugsnag.configuration.set_request_data :bugsnag_running_task, self + + super + rescue Exception => ex + Bugsnag.notify(ex, true) do |report| + report.severity = "error" + report.severity_reason = { + type: Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE, + attributes: FRAMEWORK_ATTRIBUTES + } + end + raise + ensure + Bugsnag.configuration.set_request_data :bugsnag_running_task, old_task + end end - raise - ensure - Bugsnag.configuration.set_request_data :bugsnag_running_task, old_task end - alias_method :execute_without_bugsnag, :execute - alias_method :execute, :execute_with_bugsnag + Rake::Task.send(:prepend, Bugsnag::RakeTask) +else + class Rake::Task + FRAMEWORK_ATTRIBUTES = { + framework: 'Rake' + } + + ## + # Executes the rake task with Bugsnag setup with contextual data. + def execute_with_bugsnag(args=nil) + Bugsnag.configuration.app_type ||= "rake" + old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] + Bugsnag.configuration.set_request_data :bugsnag_running_task, self + + execute_without_bugsnag(args) + rescue Exception => ex + Bugsnag.notify(ex, true) do |report| + report.severity = "error" + report.severity_reason = { + type: Bugsnag::Report::UNHANDLED_EXCEPTION_MIDDLEWARE, + attributes: FRAMEWORK_ATTRIBUTES + } + end + raise + ensure + Bugsnag.configuration.set_request_data :bugsnag_running_task, old_task + end + + alias_method :execute_without_bugsnag, :execute + alias_method :execute, :execute_with_bugsnag + end end Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Rake) diff --git a/spec/fixtures/tasks/Rakefile b/spec/fixtures/tasks/Rakefile index 385b11049..236b9e290 100644 --- a/spec/fixtures/tasks/Rakefile +++ b/spec/fixtures/tasks/Rakefile @@ -1,3 +1,15 @@ +if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.0') + # Mixing Module#prepend with alias_method can sometimes lead to infinite + # mutual recursion, so this is to test that it doesn't happen. + mod = Module.new do + def execute(args = nil) + puts 'In module prepended to Rake::Task' + super + end + end + Rake::Task.send(:prepend, mod) +end + require "bugsnag/integrations/rake" namespace :test do diff --git a/spec/integrations/rake_spec.rb b/spec/integrations/rake_spec.rb index e97dd45fb..45a884fee 100644 --- a/spec/integrations/rake_spec.rb +++ b/spec/integrations/rake_spec.rb @@ -55,18 +55,15 @@ let(:request) { JSON.parse(queue.pop) } it 'should run the rake middleware when rake tasks crash' do - #Skips this test in ruby 1.9.3 with travis - unless ENV['TRAVIS'] && RUBY_VERSION == "1.9.3" - ENV['BUGSNAG_TEST_SERVER_PORT'] = server.config[:Port].to_s - task_fixtures_path = File.join(File.dirname(__FILE__), '../fixtures', 'tasks') - Dir.chdir(task_fixtures_path) do - system("bundle exec rake test:crash > /dev/null 2>&1") - end - - result = request() - expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil - expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") + ENV['BUGSNAG_TEST_SERVER_PORT'] = server.config[:Port].to_s + task_fixtures_path = File.join(File.dirname(__FILE__), '../fixtures', 'tasks') + Dir.chdir(task_fixtures_path) do + system("bundle exec rake test:crash > /dev/null 2>&1") end + + result = request() + expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil + expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") end end -end \ No newline at end of file +end From 26c350f610fca3ec67efdaa22b890c306689d566 Mon Sep 17 00:00:00 2001 From: Toby Hsieh Date: Wed, 14 Aug 2019 18:26:16 -0700 Subject: [PATCH 03/13] Add CHANGELOG entry for using Module#prepend in Rake integration --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a289dde3a..f18527090 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ Changelog ### Fixes +* Use `Module#prepend` for Rake integration when on a new enough Ruby version + to avoid infinite mutual recursion issues when something else monkey patches + `Rake::Task`. + | [#556](https://github.com/bugsnag/bugsnag-ruby/issues/556) + | [#559](https://github.com/bugsnag/bugsnag-ruby/issues/559) + * Handle `nil` values for the `job` block parameter for the Que error notifier. This occurs under some conditions such as database connection failures. | [#545](https://github.com/bugsnag/bugsnag-ruby/issues/545) From a11345b374a027b43291a8e328d5a9848506923f Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Tue, 9 Jul 2019 14:48:37 +0100 Subject: [PATCH 04/13] feat(configuration): add runtime version informaton to payload Adds Ruby/JRuby and framework versions to both event and session payload. --- CHANGELOG.md | 5 ++++ CONTRIBUTING.md | 7 +++++- lib/bugsnag/configuration.rb | 3 +++ lib/bugsnag/integrations/que.rb | 3 ++- lib/bugsnag/integrations/rack.rb | 3 +++ lib/bugsnag/integrations/railtie.rb | 1 + lib/bugsnag/integrations/rake.rb | 2 ++ lib/bugsnag/integrations/resque.rb | 2 ++ lib/bugsnag/integrations/sidekiq.rb | 1 + lib/bugsnag/middleware/rails3_request.rb | 7 ------ lib/bugsnag/report.rb | 5 +++- lib/bugsnag/session_tracker.rb | 3 ++- spec/configuration_spec.rb | 29 ++++++++++++++++++++++++ spec/integrations/que_spec.rb | 5 ++++ spec/integrations/rack_spec.rb | 25 +++++++++++++++++++- spec/integrations/rake_spec.rb | 3 +++ spec/integrations/resque_spec.rb | 5 ++++ spec/integrations/sidekiq_spec.rb | 3 +++ spec/report_spec.rb | 12 ++++++++++ spec/session_tracker_spec.rb | 1 + 20 files changed, 113 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f18527090..608d26097 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,11 @@ Changelog | [#545](https://github.com/bugsnag/bugsnag-ruby/issues/545) | [#548](https://github.com/bugsnag/bugsnag-ruby/pull/548) +### Enhancements + +* Add Ruby (and other framework) version strings to report and session payloads (device.runtimeVersions) + | [560](https://github.com/bugsnag/bugsnag-ruby/pull/560) + ## 6.11.1 (22 Jan 2019) ### Fixes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8063f19a0..1aa92f2eb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -18,7 +18,12 @@ Thank you! - Run the tests with and make sure they all pass ``` - rake spec + bundle exec rake spec + ``` +- You will need to add the following test dependencies: + + ``` + bundle install --with test --binstubs ``` - For adding a new integration (like support for a web framework or worker queue), include an example in the `example/` directory showing off what diff --git a/lib/bugsnag/configuration.rb b/lib/bugsnag/configuration.rb index b51880887..e5b7f61e5 100644 --- a/lib/bugsnag/configuration.rb +++ b/lib/bugsnag/configuration.rb @@ -34,6 +34,7 @@ class Configuration attr_accessor :proxy_password attr_accessor :timeout attr_accessor :hostname + attr_accessor :runtime_versions attr_accessor :ignore_classes attr_accessor :auto_capture_sessions attr_accessor :track_sessions @@ -93,6 +94,8 @@ def initialize self.send_code = true self.meta_data_filters = Set.new(DEFAULT_META_DATA_FILTERS) self.hostname = default_hostname + self.runtime_versions = { "ruby" => RUBY_VERSION } + self.runtime_versions["jruby"] = JRUBY_VERSION if defined?(JRUBY_VERSION) self.timeout = 15 self.notify_release_stages = nil self.auto_capture_sessions = true diff --git a/lib/bugsnag/integrations/que.rb b/lib/bugsnag/integrations/que.rb index 36c1f12cd..2e9c4a464 100644 --- a/lib/bugsnag/integrations/que.rb +++ b/lib/bugsnag/integrations/que.rb @@ -1,5 +1,4 @@ require 'que' - if defined?(::Que) handler = proc do |error, job| begin @@ -40,9 +39,11 @@ if Que.respond_to?(:error_notifier=) Bugsnag.configuration.app_type ||= "que" + Bugsnag.configuration.runtime_versions[:que] = ::Que::Version Que.error_notifier = handler elsif Que.respond_to?(:error_handler=) Bugsnag.configuration.app_type ||= "que" + Bugsnag.configuration.runtime_versions[:que] = ::Que::Version Que.error_handler = handler end end diff --git a/lib/bugsnag/integrations/rack.rb b/lib/bugsnag/integrations/rack.rb index 3d37875da..e7569b2a0 100644 --- a/lib/bugsnag/integrations/rack.rb +++ b/lib/bugsnag/integrations/rack.rb @@ -29,7 +29,10 @@ def initialize(app) config.middleware.insert_before(Bugsnag::Middleware::Callbacks, Bugsnag::Middleware::WardenUser) if defined?(Warden) config.middleware.insert_before(Bugsnag::Middleware::Callbacks, Bugsnag::Middleware::ClearanceUser) if defined?(Clearance) + # Set environment data for payload config.app_type ||= "rack" + config.runtime_versions["rack"] = ::Rack.release if defined?(::Rack) + config.runtime_versions["sinatra"] = ::Sinatra::VERSION if defined?(::Sinatra) end end diff --git a/lib/bugsnag/integrations/railtie.rb b/lib/bugsnag/integrations/railtie.rb index 294e94975..476d39990 100644 --- a/lib/bugsnag/integrations/railtie.rb +++ b/lib/bugsnag/integrations/railtie.rb @@ -28,6 +28,7 @@ class Railtie < ::Rails::Railtie config.release_stage = ENV["BUGSNAG_RELEASE_STAGE"] || ::Rails.env.to_s config.project_root = ::Rails.root.to_s config.middleware.insert_before Bugsnag::Middleware::Callbacks, Bugsnag::Middleware::Rails3Request + config.runtime_versions["rails"] = ::Rails::VERSION::STRING end ActiveSupport.on_load(:action_controller) do diff --git a/lib/bugsnag/integrations/rake.rb b/lib/bugsnag/integrations/rake.rb index 9c7df1ef9..1670c1677 100644 --- a/lib/bugsnag/integrations/rake.rb +++ b/lib/bugsnag/integrations/rake.rb @@ -14,6 +14,7 @@ def execute(args = nil) Bugsnag.configuration.app_type ||= "rake" old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] Bugsnag.configuration.set_request_data :bugsnag_running_task, self + Bugsnag.configuration.runtime_versions[:rake] = ::Rake::VERSION super rescue Exception => ex @@ -44,6 +45,7 @@ def execute_with_bugsnag(args=nil) Bugsnag.configuration.app_type ||= "rake" old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] Bugsnag.configuration.set_request_data :bugsnag_running_task, self + Bugsnag.configuration.runtime_versions[:rake] = ::Rake::VERSION execute_without_bugsnag(args) rescue Exception => ex diff --git a/lib/bugsnag/integrations/resque.rb b/lib/bugsnag/integrations/resque.rb index 5382049da..14fd1cccb 100644 --- a/lib/bugsnag/integrations/resque.rb +++ b/lib/bugsnag/integrations/resque.rb @@ -62,10 +62,12 @@ def save Resque.after_fork do Bugsnag.configuration.app_type = "resque" Bugsnag.configuration.default_delivery_method = :synchronous + Bugsnag.configuration.runtime_versions[:resque] = ::Resque::VERSION end else Resque.before_first_fork do Bugsnag.configuration.app_type = "resque" Bugsnag.configuration.default_delivery_method = :synchronous + Bugsnag.configuration.runtime_versions[:resque] = ::Resque::VERSION end end diff --git a/lib/bugsnag/integrations/sidekiq.rb b/lib/bugsnag/integrations/sidekiq.rb index 27f9ae994..f392bcc1e 100644 --- a/lib/bugsnag/integrations/sidekiq.rb +++ b/lib/bugsnag/integrations/sidekiq.rb @@ -15,6 +15,7 @@ def initialize Bugsnag.configuration.internal_middleware.use(Bugsnag::Middleware::Sidekiq) Bugsnag.configuration.app_type = "sidekiq" Bugsnag.configuration.default_delivery_method = :synchronous + Bugsnag.configuration.runtime_versions["sidekiq"] = ::Sidekiq::VERSION end def call(worker, msg, queue) diff --git a/lib/bugsnag/middleware/rails3_request.rb b/lib/bugsnag/middleware/rails3_request.rb index 30b45004a..16cc588d3 100644 --- a/lib/bugsnag/middleware/rails3_request.rb +++ b/lib/bugsnag/middleware/rails3_request.rb @@ -32,13 +32,6 @@ def call(report) }) report.user["id"] = client_ip - - # Add the rails version - if report.configuration.send_environment - report.add_tab(:environment, { - :railsVersion => Rails::VERSION::STRING - }) - end end @bugsnag.call(report) diff --git a/lib/bugsnag/report.rb b/lib/bugsnag/report.rb index c48666340..4f38d8ae1 100644 --- a/lib/bugsnag/report.rb +++ b/lib/bugsnag/report.rb @@ -29,6 +29,7 @@ class Report attr_accessor :delivery_method attr_accessor :exceptions attr_accessor :hostname + attr_accessor :runtime_versions attr_accessor :grouping_hash attr_accessor :meta_data attr_accessor :raw_exceptions @@ -55,6 +56,7 @@ def initialize(exception, passed_configuration, auto_notify=false) self.breadcrumbs = [] self.delivery_method = configuration.delivery_method self.hostname = configuration.hostname + self.runtime_versions = configuration.runtime_versions self.meta_data = {} self.release_stage = configuration.release_stage self.severity = auto_notify ? "error" : "warning" @@ -97,7 +99,8 @@ def as_json }, context: context, device: { - hostname: hostname + hostname: hostname, + runtimeVersions: runtime_versions }, exceptions: exceptions, groupingHash: grouping_hash, diff --git a/lib/bugsnag/session_tracker.rb b/lib/bugsnag/session_tracker.rb index 30a7a54a9..d57e227c7 100644 --- a/lib/bugsnag/session_tracker.rb +++ b/lib/bugsnag/session_tracker.rb @@ -118,7 +118,8 @@ def deliver(session_payload) :version => Bugsnag::Report::NOTIFIER_VERSION }, :device => { - :hostname => Bugsnag.configuration.hostname + :hostname => Bugsnag.configuration.hostname, + :runtimeVersions => Bugsnag.configuration.runtime_versions }, :app => { :version => Bugsnag.configuration.app_version, diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index aa8cbb08d..97610d68e 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -1,4 +1,6 @@ # encoding: utf-8 +require 'json' +require 'socket' require 'spec_helper' describe Bugsnag::Configuration do @@ -161,6 +163,33 @@ end end + describe "#hostname" do + it "has a default value" do + expect(subject.hostname.length).to be > 0 + end + it "has a value set by Socket" do + expect(subject.hostname).to eq(Socket.gethostname) + end + it "has a value set by DYNO environment variable" do + ENV['DYNO'] = 'localhost' + expect(subject.hostname).to eq("localhost") + end + after do + ENV['DYNO'] = nil + end + end + + describe "#runtime_versions" do + it "has a default value" do + expect(subject.runtime_versions.length).to be > 0 + expect(subject.runtime_versions["ruby"]).to eq(RUBY_VERSION) + end + it "has a settable value" do + subject.runtime_versions["ruby"] = '9.9.9' + expect(subject.runtime_versions["ruby"]).to eq('9.9.9') + end + end + describe "logger" do class TestLogger attr_accessor :logs diff --git a/spec/integrations/que_spec.rb b/spec/integrations/que_spec.rb index af8878fe6..18820a464 100644 --- a/spec/integrations/que_spec.rb +++ b/spec/integrations/que_spec.rb @@ -6,6 +6,7 @@ unless defined?(::Que) @mocked_que = true class ::Que + Version = '9.9.9' class << self attr_accessor :error_notifier end @@ -53,6 +54,8 @@ def require(path) allow(Bugsnag).to receive(:configuration).and_return(config) expect(config).to receive(:app_type) expect(config).to receive(:app_type=).with('que') + runtime = {} + expect(config).to receive(:runtime_versions).and_return(runtime) allow(config).to receive(:clear_request_data) expect(Que).to receive(:error_notifier=) do |handler| handler.call(error, job) @@ -60,6 +63,8 @@ def require(path) #Kick off load './lib/bugsnag/integrations/que.rb' + + expect(runtime).to eq(:que => '9.9.9') end context 'when the job is nil' do diff --git a/spec/integrations/rack_spec.rb b/spec/integrations/rack_spec.rb index 18c0ee67c..c29f8bd10 100644 --- a/spec/integrations/rack_spec.rb +++ b/spec/integrations/rack_spec.rb @@ -18,6 +18,19 @@ app = lambda { |env| raise exception } rack_stack = Bugsnag::Rack.new(app) + before do + unless defined?(::Rack) + @mocked_rack = true + class Rack + def self.release + '9.9.9' + end + class Request + end + end + end + end + it "re-raises the exception" do expect { rack_stack.call(rack_env) }.to raise_error(BugsnagTestException) end @@ -47,6 +60,14 @@ } end + it "applies the rack version" do + app = lambda { |env| raise BugsnagTestException.new("It crashed") } + rack_stack = Bugsnag::Rack.new(app) + + expect(Bugsnag.configuration.runtime_versions["rack"]).to_not be nil + expect(Bugsnag.configuration.runtime_versions["rack"]).to eq '9.9.9' + end + it "does not deliver an exception if auto_notify is disabled" do Bugsnag.configure do |config| config.auto_notify = false @@ -63,6 +84,9 @@ unless defined?(::Rack) @mocked_rack = true class Rack + def self.release + '9.9.9' + end class Request end end @@ -196,7 +220,6 @@ class Request end it "don't mess with middlewares list on each req" do - stub_const('Rack', nil) app = lambda { |env| ['200', {}, ['']] } Bugsnag::Rack.new(app) diff --git a/spec/integrations/rake_spec.rb b/spec/integrations/rake_spec.rb index 45a884fee..acdedd4be 100644 --- a/spec/integrations/rake_spec.rb +++ b/spec/integrations/rake_spec.rb @@ -1,6 +1,7 @@ require 'webrick' require 'spec_helper' require 'json' +require 'rake' describe "Bugsnag Rake integration" do describe Bugsnag::Middleware::Rake do @@ -64,6 +65,8 @@ result = request() expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") + expect(result["events"][0]["app"]["type"]).to eq("rake") + expect(result["events"][0]["device"]["runtimeVersions"]["rake"]).to eq(::Rake::VERSION) end end end diff --git a/spec/integrations/resque_spec.rb b/spec/integrations/resque_spec.rb index 2e773abf8..47c2759d0 100644 --- a/spec/integrations/resque_spec.rb +++ b/spec/integrations/resque_spec.rb @@ -6,6 +6,7 @@ unless defined?(::Resque) @mocked_resque = true class ::Resque + VERSION = '9.9.9' class Worker end class Failure @@ -44,10 +45,14 @@ def require(path) expect(fork_check).to receive(:fork_per_job?).and_return(true) expect(::Resque).to receive(:after_fork).and_yield expect(Bugsnag.configuration).to receive(:app_type=).with("resque") + runtime = {} + expect(Bugsnag.configuration).to receive(:runtime_versions).and_return(runtime) expect(Bugsnag.configuration).to receive(:default_delivery_method=).with(:synchronous) #Kick off require './lib/bugsnag/integrations/resque' + + expect(runtime).to eq(:resque => '9.9.9') end it "can configure" do diff --git a/spec/integrations/sidekiq_spec.rb b/spec/integrations/sidekiq_spec.rb index 5e7076841..70553b1b9 100644 --- a/spec/integrations/sidekiq_spec.rb +++ b/spec/integrations/sidekiq_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'sidekiq' require 'sidekiq/testing' class Worker @@ -29,6 +30,8 @@ def perform(value) expect(event["metaData"]["sidekiq"]["msg"]["args"]).to eq([-0]) expect(event["metaData"]["sidekiq"]["msg"]["queue"]).to eq("default") expect(event["severity"]).to eq("error") + expect(event["app"]["type"]).to eq("sidekiq") + expect(event["device"]["runtimeVersions"]["sidekiq"]).to eq(::Sidekiq::VERSION) } end end diff --git a/spec/report_spec.rb b/spec/report_spec.rb index 96c62d0ae..37c2b12ff 100644 --- a/spec/report_spec.rb +++ b/spec/report_spec.rb @@ -1267,4 +1267,16 @@ def gloops } end end + + it 'should include device data when notify is called' do + Bugsnag.configuration.hostname = 'test-host' + Bugsnag.configuration.runtime_versions["ruby"] = '9.9.9' + Bugsnag.notify(BugsnagTestException.new("It crashed")) + + expect(Bugsnag).to have_sent_notification{ |payload, headers| + event = payload["events"][0] + expect(event["device"]["hostname"]).to eq('test-host') + expect(event["device"]["runtimeVersions"]["ruby"]).to eq('9.9.9') + } + end end diff --git a/spec/session_tracker_spec.rb b/spec/session_tracker_spec.rb index 50a249b0f..2be481d84 100644 --- a/spec/session_tracker_spec.rb +++ b/spec/session_tracker_spec.rb @@ -129,6 +129,7 @@ device = payload["device"] expect(device.include?("hostname")).to be true expect(device["hostname"]).to eq(Bugsnag.configuration.hostname) + expect(device["runtimeVersions"]).to eq(Bugsnag.configuration.runtime_versions) end it 'uses middleware to attach session to notification' do From e7f337a7af8d4be4078d23c4690acd581766ea21 Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Fri, 16 Aug 2019 09:44:57 +0100 Subject: [PATCH 05/13] fix: runtime version changes following review --- CHANGELOG.md | 2 +- lib/bugsnag/configuration.rb | 3 ++- lib/bugsnag/integrations/que.rb | 4 ++-- lib/bugsnag/integrations/rake.rb | 4 ++-- lib/bugsnag/integrations/resque.rb | 4 ++-- spec/configuration_spec.rb | 22 +++++++++++++--------- spec/integrations/que_spec.rb | 2 +- spec/integrations/rack_spec.rb | 1 - spec/integrations/rake_spec.rb | 2 +- spec/integrations/resque_spec.rb | 2 +- spec/report_spec.rb | 4 ++-- spec/session_tracker_spec.rb | 2 +- 12 files changed, 28 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 608d26097..13d32513e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,7 @@ Changelog ### Enhancements -* Add Ruby (and other framework) version strings to report and session payloads (device.runtimeVersions) +* Add Ruby (and other framework) version strings to report and session payloads (device.runtimeVersions). | [560](https://github.com/bugsnag/bugsnag-ruby/pull/560) ## 6.11.1 (22 Jan 2019) diff --git a/lib/bugsnag/configuration.rb b/lib/bugsnag/configuration.rb index e5b7f61e5..c5a919430 100644 --- a/lib/bugsnag/configuration.rb +++ b/lib/bugsnag/configuration.rb @@ -94,7 +94,8 @@ def initialize self.send_code = true self.meta_data_filters = Set.new(DEFAULT_META_DATA_FILTERS) self.hostname = default_hostname - self.runtime_versions = { "ruby" => RUBY_VERSION } + self.runtime_versions = {} + self.runtime_versions["ruby"] = RUBY_VERSION self.runtime_versions["jruby"] = JRUBY_VERSION if defined?(JRUBY_VERSION) self.timeout = 15 self.notify_release_stages = nil diff --git a/lib/bugsnag/integrations/que.rb b/lib/bugsnag/integrations/que.rb index 2e9c4a464..8cf701497 100644 --- a/lib/bugsnag/integrations/que.rb +++ b/lib/bugsnag/integrations/que.rb @@ -39,11 +39,11 @@ if Que.respond_to?(:error_notifier=) Bugsnag.configuration.app_type ||= "que" - Bugsnag.configuration.runtime_versions[:que] = ::Que::Version + Bugsnag.configuration.runtime_versions["que"] = ::Que::Version Que.error_notifier = handler elsif Que.respond_to?(:error_handler=) Bugsnag.configuration.app_type ||= "que" - Bugsnag.configuration.runtime_versions[:que] = ::Que::Version + Bugsnag.configuration.runtime_versions["que"] = ::Que::Version Que.error_handler = handler end end diff --git a/lib/bugsnag/integrations/rake.rb b/lib/bugsnag/integrations/rake.rb index 1670c1677..dcd426451 100644 --- a/lib/bugsnag/integrations/rake.rb +++ b/lib/bugsnag/integrations/rake.rb @@ -14,7 +14,7 @@ def execute(args = nil) Bugsnag.configuration.app_type ||= "rake" old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] Bugsnag.configuration.set_request_data :bugsnag_running_task, self - Bugsnag.configuration.runtime_versions[:rake] = ::Rake::VERSION + Bugsnag.configuration.runtime_versions["rake"] = ::Rake::VERSION super rescue Exception => ex @@ -45,7 +45,7 @@ def execute_with_bugsnag(args=nil) Bugsnag.configuration.app_type ||= "rake" old_task = Bugsnag.configuration.request_data[:bugsnag_running_task] Bugsnag.configuration.set_request_data :bugsnag_running_task, self - Bugsnag.configuration.runtime_versions[:rake] = ::Rake::VERSION + Bugsnag.configuration.runtime_versions["rake"] = ::Rake::VERSION execute_without_bugsnag(args) rescue Exception => ex diff --git a/lib/bugsnag/integrations/resque.rb b/lib/bugsnag/integrations/resque.rb index 14fd1cccb..913dd43c4 100644 --- a/lib/bugsnag/integrations/resque.rb +++ b/lib/bugsnag/integrations/resque.rb @@ -62,12 +62,12 @@ def save Resque.after_fork do Bugsnag.configuration.app_type = "resque" Bugsnag.configuration.default_delivery_method = :synchronous - Bugsnag.configuration.runtime_versions[:resque] = ::Resque::VERSION + Bugsnag.configuration.runtime_versions["resque"] = ::Resque::VERSION end else Resque.before_first_fork do Bugsnag.configuration.app_type = "resque" Bugsnag.configuration.default_delivery_method = :synchronous - Bugsnag.configuration.runtime_versions[:resque] = ::Resque::VERSION + Bugsnag.configuration.runtime_versions["resque"] = ::Resque::VERSION end end diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 97610d68e..906659209 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -165,28 +165,32 @@ describe "#hostname" do it "has a default value" do - expect(subject.hostname.length).to be > 0 + expect(subject.hostname.length).to be > 0 end + it "has a value set by Socket" do - expect(subject.hostname).to eq(Socket.gethostname) + expect(subject.hostname).to eq(Socket.gethostname) end + it "has a value set by DYNO environment variable" do - ENV['DYNO'] = 'localhost' - expect(subject.hostname).to eq("localhost") + ENV['DYNO'] = 'localhost' + expect(subject.hostname).to eq("localhost") end + after do - ENV['DYNO'] = nil + ENV['DYNO'] = nil end end describe "#runtime_versions" do it "has a default value" do - expect(subject.runtime_versions.length).to be > 0 - expect(subject.runtime_versions["ruby"]).to eq(RUBY_VERSION) + expect(subject.runtime_versions.length).to be > 0 + expect(subject.runtime_versions["ruby"]).to eq(RUBY_VERSION) end + it "has a settable value" do - subject.runtime_versions["ruby"] = '9.9.9' - expect(subject.runtime_versions["ruby"]).to eq('9.9.9') + subject.runtime_versions["ruby"] = '9.9.9' + expect(subject.runtime_versions["ruby"]).to eq('9.9.9') end end diff --git a/spec/integrations/que_spec.rb b/spec/integrations/que_spec.rb index 18820a464..5708179b2 100644 --- a/spec/integrations/que_spec.rb +++ b/spec/integrations/que_spec.rb @@ -64,7 +64,7 @@ def require(path) #Kick off load './lib/bugsnag/integrations/que.rb' - expect(runtime).to eq(:que => '9.9.9') + expect(runtime).to eq("que" => "9.9.9") end context 'when the job is nil' do diff --git a/spec/integrations/rack_spec.rb b/spec/integrations/rack_spec.rb index c29f8bd10..95cc9f013 100644 --- a/spec/integrations/rack_spec.rb +++ b/spec/integrations/rack_spec.rb @@ -64,7 +64,6 @@ class Request app = lambda { |env| raise BugsnagTestException.new("It crashed") } rack_stack = Bugsnag::Rack.new(app) - expect(Bugsnag.configuration.runtime_versions["rack"]).to_not be nil expect(Bugsnag.configuration.runtime_versions["rack"]).to eq '9.9.9' end diff --git a/spec/integrations/rake_spec.rb b/spec/integrations/rake_spec.rb index acdedd4be..b61fcb603 100644 --- a/spec/integrations/rake_spec.rb +++ b/spec/integrations/rake_spec.rb @@ -66,7 +66,7 @@ expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") expect(result["events"][0]["app"]["type"]).to eq("rake") - expect(result["events"][0]["device"]["runtimeVersions"]["rake"]).to eq(::Rake::VERSION) + expect(result["events"][0]["device"]["runtimeVersions"]["rake"]).to match(/\d+\.\d+\.\d+/) end end end diff --git a/spec/integrations/resque_spec.rb b/spec/integrations/resque_spec.rb index 47c2759d0..ac04ad9e5 100644 --- a/spec/integrations/resque_spec.rb +++ b/spec/integrations/resque_spec.rb @@ -52,7 +52,7 @@ def require(path) #Kick off require './lib/bugsnag/integrations/resque' - expect(runtime).to eq(:resque => '9.9.9') + expect(runtime).to eq("resque" => "9.9.9") end it "can configure" do diff --git a/spec/report_spec.rb b/spec/report_spec.rb index 37c2b12ff..3d4b8530f 100644 --- a/spec/report_spec.rb +++ b/spec/report_spec.rb @@ -1252,7 +1252,7 @@ def gloops if defined?(JRUBY_VERSION) - it "should work with java.lang.Throwables" do + it "works with java.lang.Throwables" do begin JRubyException.raise! rescue @@ -1268,7 +1268,7 @@ def gloops end end - it 'should include device data when notify is called' do + it 'includes device data when notify is called' do Bugsnag.configuration.hostname = 'test-host' Bugsnag.configuration.runtime_versions["ruby"] = '9.9.9' Bugsnag.notify(BugsnagTestException.new("It crashed")) diff --git a/spec/session_tracker_spec.rb b/spec/session_tracker_spec.rb index 2be481d84..e208494c8 100644 --- a/spec/session_tracker_spec.rb +++ b/spec/session_tracker_spec.rb @@ -129,7 +129,7 @@ device = payload["device"] expect(device.include?("hostname")).to be true expect(device["hostname"]).to eq(Bugsnag.configuration.hostname) - expect(device["runtimeVersions"]).to eq(Bugsnag.configuration.runtime_versions) + expect(device["runtimeVersions"]["ruby"]).to eq(Bugsnag.configuration.runtime_versions["ruby"]) end it 'uses middleware to attach session to notification' do From e86291e09b49e472c3a85dc6d1c584236b571bbf Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Wed, 21 Aug 2019 11:15:23 +0100 Subject: [PATCH 06/13] Changes following review comments for runtime versions --- lib/bugsnag/report.rb | 14 +++++++------- spec/configuration_spec.rb | 2 -- spec/integrations/rake_spec.rb | 2 +- spec/integrations/sidekiq_spec.rb | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/bugsnag/report.rb b/lib/bugsnag/report.rb index 4f38d8ae1..e7d02c488 100644 --- a/lib/bugsnag/report.rb +++ b/lib/bugsnag/report.rb @@ -50,15 +50,15 @@ def initialize(exception, passed_configuration, auto_notify=false) self.raw_exceptions = generate_raw_exceptions(exception) self.exceptions = generate_exception_list - self.api_key = configuration.api_key - self.app_type = configuration.app_type - self.app_version = configuration.app_version + self.api_key = configuration.api_key.dup + self.app_type = configuration.app_type.dup + self.app_version = configuration.app_version.dup self.breadcrumbs = [] - self.delivery_method = configuration.delivery_method - self.hostname = configuration.hostname - self.runtime_versions = configuration.runtime_versions + self.delivery_method = configuration.delivery_method.dup + self.hostname = configuration.hostname.dup + self.runtime_versions = configuration.runtime_versions.dup self.meta_data = {} - self.release_stage = configuration.release_stage + self.release_stage = configuration.release_stage.dup self.severity = auto_notify ? "error" : "warning" self.severity_reason = auto_notify ? {:type => UNHANDLED_EXCEPTION} : {:type => HANDLED_EXCEPTION} self.user = {} diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 906659209..bf8d8ec82 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -1,7 +1,5 @@ # encoding: utf-8 require 'json' -require 'socket' -require 'spec_helper' describe Bugsnag::Configuration do describe "delivery_method" do diff --git a/spec/integrations/rake_spec.rb b/spec/integrations/rake_spec.rb index b61fcb603..2141d6226 100644 --- a/spec/integrations/rake_spec.rb +++ b/spec/integrations/rake_spec.rb @@ -66,7 +66,7 @@ expect(result["events"][0]["metaData"]["rake_task"]).not_to be_nil expect(result["events"][0]["metaData"]["rake_task"]["name"]).to eq("test:crash") expect(result["events"][0]["app"]["type"]).to eq("rake") - expect(result["events"][0]["device"]["runtimeVersions"]["rake"]).to match(/\d+\.\d+\.\d+/) + expect(result["events"][0]["device"]["runtimeVersions"]["rake"]).to match(/\A\d+\.\d+\.\d+/) end end end diff --git a/spec/integrations/sidekiq_spec.rb b/spec/integrations/sidekiq_spec.rb index 70553b1b9..cb14391ad 100644 --- a/spec/integrations/sidekiq_spec.rb +++ b/spec/integrations/sidekiq_spec.rb @@ -31,7 +31,7 @@ def perform(value) expect(event["metaData"]["sidekiq"]["msg"]["queue"]).to eq("default") expect(event["severity"]).to eq("error") expect(event["app"]["type"]).to eq("sidekiq") - expect(event["device"]["runtimeVersions"]["sidekiq"]).to eq(::Sidekiq::VERSION) + expect(event["device"]["runtimeVersions"]["sidekiq"]).to match(/\A\d+\.\d+\.\d+/) } end end From 1d2aecd7c3ed0ce762db3899412c72c6832c662f Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Fri, 23 Aug 2019 09:17:16 +0100 Subject: [PATCH 07/13] fix: remove use of `dup` on nil fields Also restore missing requires and remove json from configuration spec --- lib/bugsnag/report.rb | 12 ++++++------ spec/configuration_spec.rb | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/bugsnag/report.rb b/lib/bugsnag/report.rb index e7d02c488..c3b1e54aa 100644 --- a/lib/bugsnag/report.rb +++ b/lib/bugsnag/report.rb @@ -50,15 +50,15 @@ def initialize(exception, passed_configuration, auto_notify=false) self.raw_exceptions = generate_raw_exceptions(exception) self.exceptions = generate_exception_list - self.api_key = configuration.api_key.dup - self.app_type = configuration.app_type.dup - self.app_version = configuration.app_version.dup + self.api_key = configuration.api_key + self.app_type = configuration.app_type + self.app_version = configuration.app_version self.breadcrumbs = [] - self.delivery_method = configuration.delivery_method.dup - self.hostname = configuration.hostname.dup + self.delivery_method = configuration.delivery_method + self.hostname = configuration.hostname self.runtime_versions = configuration.runtime_versions.dup self.meta_data = {} - self.release_stage = configuration.release_stage.dup + self.release_stage = configuration.release_stage self.severity = auto_notify ? "error" : "warning" self.severity_reason = auto_notify ? {:type => UNHANDLED_EXCEPTION} : {:type => HANDLED_EXCEPTION} self.user = {} diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index bf8d8ec82..3938e1818 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -1,5 +1,6 @@ # encoding: utf-8 -require 'json' +require 'socket' +require 'spec_helper' describe Bugsnag::Configuration do describe "delivery_method" do From ca0c68209a2e9cda97f1eea87f4668d248727554 Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Fri, 23 Aug 2019 10:08:18 +0100 Subject: [PATCH 08/13] test: removed stray require not needed for configuration spec --- spec/configuration_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 3938e1818..ae3690db2 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -1,5 +1,4 @@ # encoding: utf-8 -require 'socket' require 'spec_helper' describe Bugsnag::Configuration do From 1a4f04d3d7aeb9112b7ba73373dc0b4345c674c2 Mon Sep 17 00:00:00 2001 From: seph Date: Tue, 20 Aug 2019 10:58:19 -0400 Subject: [PATCH 09/13] Allow symbols in breadcrumbs Validate Symbol as an allowed type to breadcrumbs. I can't tell if this will have break something else, I can't trace everywhere it's used. Fixes https://github.com/bugsnag/bugsnag-ruby/issues/539 --- lib/bugsnag/breadcrumbs/validator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bugsnag/breadcrumbs/validator.rb b/lib/bugsnag/breadcrumbs/validator.rb index 64eabb434..85509fe21 100644 --- a/lib/bugsnag/breadcrumbs/validator.rb +++ b/lib/bugsnag/breadcrumbs/validator.rb @@ -53,7 +53,7 @@ def validate(breadcrumb) # # @param value [Object] the object to be type checked def valid_meta_data_type?(value) - value.nil? || value.is_a?(String) || value.is_a?(Numeric) || value.is_a?(FalseClass) || value.is_a?(TrueClass) + value.nil? || value.is_a?(String) || value.is_a?(Symbol) || value.is_a?(Numeric) || value.is_a?(FalseClass) || value.is_a?(TrueClass) end end end From c1fde6c7f085c6d027feff5b5f0bb6ec3b5b5ef3 Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Tue, 27 Aug 2019 09:43:58 +0100 Subject: [PATCH 10/13] test/docs: updated spec and added changelog --- CHANGELOG.md | 3 +++ lib/bugsnag/breadcrumbs/validator.rb | 2 +- spec/breadcrumbs/validator_spec.rb | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f18527090..e82a050be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ Changelog | [#545](https://github.com/bugsnag/bugsnag-ruby/issues/545) | [#548](https://github.com/bugsnag/bugsnag-ruby/pull/548) +* Allow symbols in breadcrumb meta data. + | [#563](https://github.com/bugsnag/bugsnag-ruby/pull/563) + ## 6.11.1 (22 Jan 2019) ### Fixes diff --git a/lib/bugsnag/breadcrumbs/validator.rb b/lib/bugsnag/breadcrumbs/validator.rb index 85509fe21..c6893b50a 100644 --- a/lib/bugsnag/breadcrumbs/validator.rb +++ b/lib/bugsnag/breadcrumbs/validator.rb @@ -49,7 +49,7 @@ def validate(breadcrumb) ## # Tests whether the meta_data types are non-complex objects. # - # Acceptable types are String, Numeric, TrueClass, FalseClass, and nil. + # Acceptable types are String, Symbol, Numeric, TrueClass, FalseClass, and nil. # # @param value [Object] the object to be type checked def valid_meta_data_type?(value) diff --git a/spec/breadcrumbs/validator_spec.rb b/spec/breadcrumbs/validator_spec.rb index 34de2c20d..07e7b2c5b 100644 --- a/spec/breadcrumbs/validator_spec.rb +++ b/spec/breadcrumbs/validator_spec.rb @@ -64,6 +64,7 @@ meta_data = { :string => "This is a string", + :symbol => :this_is_a_symbol, :integer => 12345, :float => 12345.6789, :false => false, From 444e5363b2ebc3aea1657613f04ecf0248d6565b Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Tue, 27 Aug 2019 10:00:50 +0100 Subject: [PATCH 11/13] test: small require/assertion changes following review --- spec/integrations/rake_spec.rb | 1 - spec/integrations/sidekiq_spec.rb | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/spec/integrations/rake_spec.rb b/spec/integrations/rake_spec.rb index 2141d6226..f9118cf7e 100644 --- a/spec/integrations/rake_spec.rb +++ b/spec/integrations/rake_spec.rb @@ -1,7 +1,6 @@ require 'webrick' require 'spec_helper' require 'json' -require 'rake' describe "Bugsnag Rake integration" do describe Bugsnag::Middleware::Rake do diff --git a/spec/integrations/sidekiq_spec.rb b/spec/integrations/sidekiq_spec.rb index cb14391ad..3ea757098 100644 --- a/spec/integrations/sidekiq_spec.rb +++ b/spec/integrations/sidekiq_spec.rb @@ -1,5 +1,4 @@ require 'spec_helper' -require 'sidekiq' require 'sidekiq/testing' class Worker @@ -31,7 +30,7 @@ def perform(value) expect(event["metaData"]["sidekiq"]["msg"]["queue"]).to eq("default") expect(event["severity"]).to eq("error") expect(event["app"]["type"]).to eq("sidekiq") - expect(event["device"]["runtimeVersions"]["sidekiq"]).to match(/\A\d+\.\d+\.\d+/) + expect(event["device"]["runtimeVersions"]["sidekiq"]).to eq('2.0.0') } end end From 2efcab7f905c4c24e0b601566a69d4eca217be43 Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Wed, 28 Aug 2019 12:52:09 +0100 Subject: [PATCH 12/13] Release v6.12.0 --- CHANGELOG.md | 18 +++++++++--------- VERSION | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a2ed1b52..0772fa57c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ Changelog ========= -## TBD +## 6.12.0 (28 Aug 2019) + +### Enhancements + +* Add Ruby (and other framework) version strings to report and session payloads (device.runtimeVersions). + | [560](https://github.com/bugsnag/bugsnag-ruby/pull/560) + +* Allow symbols in breadcrumb meta data. + | [#563](https://github.com/bugsnag/bugsnag-ruby/pull/563) ### Fixes @@ -16,14 +24,6 @@ Changelog | [#545](https://github.com/bugsnag/bugsnag-ruby/issues/545) | [#548](https://github.com/bugsnag/bugsnag-ruby/pull/548) -### Enhancements - -* Add Ruby (and other framework) version strings to report and session payloads (device.runtimeVersions). - | [560](https://github.com/bugsnag/bugsnag-ruby/pull/560) - -* Allow symbols in breadcrumb meta data. - | [#563](https://github.com/bugsnag/bugsnag-ruby/pull/563) - ## 6.11.1 (22 Jan 2019) ### Fixes diff --git a/VERSION b/VERSION index fac714a32..d4e6cb429 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.11.1 +6.12.0 From e938bcee8e89256d76489d5ebcdce9c05e1758b7 Mon Sep 17 00:00:00 2001 From: Tom Longridge Date: Wed, 28 Aug 2019 16:38:23 +0100 Subject: [PATCH 13/13] Amended changelog to add attribution --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0772fa57c..14e694076 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ Changelog * Allow symbols in breadcrumb meta data. | [#563](https://github.com/bugsnag/bugsnag-ruby/pull/563) + | [directionless](https://github.com/directionless) ### Fixes