From b665fcc39866b0b7daf5c54a5ed95e9e2b898f2a Mon Sep 17 00:00:00 2001 From: Johnny Shields <27655+johnnyshields@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:05:23 +0900 Subject: [PATCH 1/3] Rename resque:setup.rake to resque_setup.rake --- .../rails-51/lib/tasks/{resque:setup.rake => resque_setup.rake} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename example/rails-51/lib/tasks/{resque:setup.rake => resque_setup.rake} (100%) diff --git a/example/rails-51/lib/tasks/resque:setup.rake b/example/rails-51/lib/tasks/resque_setup.rake similarity index 100% rename from example/rails-51/lib/tasks/resque:setup.rake rename to example/rails-51/lib/tasks/resque_setup.rake From b62a1c62b1e1d26fc33b9b4c380585851626be13 Mon Sep 17 00:00:00 2001 From: Johnny Shields <27655+johnnyshields@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:05:59 +0900 Subject: [PATCH 2/3] Rename resque:setup.rake to resque_setup.rake --- .../rails-60/lib/tasks/{resque:setup.rake => resque_setup.rake} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename example/rails-60/lib/tasks/{resque:setup.rake => resque_setup.rake} (100%) diff --git a/example/rails-60/lib/tasks/resque:setup.rake b/example/rails-60/lib/tasks/resque_setup.rake similarity index 100% rename from example/rails-60/lib/tasks/resque:setup.rake rename to example/rails-60/lib/tasks/resque_setup.rake From 390309c04bf63572486ee0fccda592d39487a83a Mon Sep 17 00:00:00 2001 From: johnnyshields <27655+johnnyshields@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:19:14 +0900 Subject: [PATCH 3/3] Mongo add sort --- lib/bugsnag/integrations/mongo.rb | 1 + spec/integrations/mongo_spec.rb | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/lib/bugsnag/integrations/mongo.rb b/lib/bugsnag/integrations/mongo.rb index e1b2d22d0..42f01416b 100644 --- a/lib/bugsnag/integrations/mongo.rb +++ b/lib/bugsnag/integrations/mongo.rb @@ -60,6 +60,7 @@ def leave_mongo_breadcrumb(event_name, event) filter = sanitize_filter_hash(command["filter"]) meta_data[:filter] = JSON.dump(filter) end + meta_data[:sort] = JSON.dump(command["sort"]) unless command["sort"].nil? end meta_data[:message] = event.message if defined?(event.message) diff --git a/spec/integrations/mongo_spec.rb b/spec/integrations/mongo_spec.rb index fc2594ebe..e1bfe9c2e 100644 --- a/spec/integrations/mongo_spec.rb +++ b/spec/integrations/mongo_spec.rb @@ -174,6 +174,27 @@ def require(path) ) subscriber.send(:leave_mongo_breadcrumb, event_name, event) end + + it "adds a JSON string of sort data" do + command["sort"] = {"a" => 1, "b" => -1} + expect(subscriber).to receive(:pop_command).with("123456").and_return(command) + expect(Bugsnag).to receive(:leave_breadcrumb).with( + "Mongo query #{event_name}", + { + :event_name => "mongo.#{event_name}", + :command_name => "command", + :database_name => "database", + :operation_id => "1234567890", + :request_id => "123456", + :duration => "123.456", + :collection => "collection_name_command", + :sort => '{"a":1,"b":-1}' + }, + "process", + :auto + ) + subscriber.send(:leave_mongo_breadcrumb, event_name, event) + end end end