From 80bc5817a6da331848995be554528b7da2d2b40d Mon Sep 17 00:00:00 2001 From: Mikkel Malmberg Date: Tue, 7 Dec 2021 14:45:49 +0100 Subject: [PATCH 1/3] MongoDB spy: Make sure to close the right span --- lib/elastic_apm/spies/mongo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elastic_apm/spies/mongo.rb b/lib/elastic_apm/spies/mongo.rb index 8e04f81e8..12e671db1 100644 --- a/lib/elastic_apm/spies/mongo.rb +++ b/lib/elastic_apm/spies/mongo.rb @@ -98,7 +98,7 @@ def pop_event(event) span = events.delete(event.operation_id) return unless (curr = ElasticAPM.current_span) - curr == span && ElasticAPM.end_span + curr == span && ElasticAPM.end_span(span) end def build_context(event) From 0a6af4a2d07e778ce33611a3d3def7fb9e7a6701 Mon Sep 17 00:00:00 2001 From: Mikkel Malmberg Date: Wed, 8 Dec 2021 00:19:06 +0100 Subject: [PATCH 2/3] Update lib/elastic_apm/spies/mongo.rb Co-authored-by: Emily S --- lib/elastic_apm/spies/mongo.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/elastic_apm/spies/mongo.rb b/lib/elastic_apm/spies/mongo.rb index 12e671db1..82acd7bb8 100644 --- a/lib/elastic_apm/spies/mongo.rb +++ b/lib/elastic_apm/spies/mongo.rb @@ -98,7 +98,6 @@ def pop_event(event) span = events.delete(event.operation_id) return unless (curr = ElasticAPM.current_span) - curr == span && ElasticAPM.end_span(span) end def build_context(event) From 22265ad3efd9114c83ea238ec1aa92af0f92b236 Mon Sep 17 00:00:00 2001 From: Mikkel Malmberg Date: Wed, 8 Dec 2021 00:19:10 +0100 Subject: [PATCH 3/3] Update lib/elastic_apm/spies/mongo.rb Co-authored-by: Emily S --- lib/elastic_apm/spies/mongo.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elastic_apm/spies/mongo.rb b/lib/elastic_apm/spies/mongo.rb index 82acd7bb8..d9ed837fd 100644 --- a/lib/elastic_apm/spies/mongo.rb +++ b/lib/elastic_apm/spies/mongo.rb @@ -96,7 +96,7 @@ def push_event(event) def pop_event(event) span = events.delete(event.operation_id) - return unless (curr = ElasticAPM.current_span) + ElasticAPM.end_span(span) end