From 56e0cf84c94cc46408375a53de20cc3fa9e5b55d Mon Sep 17 00:00:00 2001 From: donoghuc Date: Thu, 15 May 2025 11:05:00 -0700 Subject: [PATCH 1/2] Add less restrictive gem spec for mongo gem It looks like latest features (including jruby 10 enablement) will require the latest minor release of the mongo gem. Specifically: The latest mongo gem relaxes the range for the ruby-bson gem. This would allow the uptake of https://github.com/mongodb/bson-ruby/pull/353 if it is accepted. --- instrumentation/mongo/Appraisals | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instrumentation/mongo/Appraisals b/instrumentation/mongo/Appraisals index 63b14c31eb..4e0ac7ca9f 100644 --- a/instrumentation/mongo/Appraisals +++ b/instrumentation/mongo/Appraisals @@ -4,6 +4,6 @@ # # SPDX-License-Identifier: Apache-2.0 -appraise 'mongo-2.13' do - gem 'mongo', '~> 2.13.0' +appraise 'mongo-2' do + gem 'mongo', '~> 2.13' end From fc8d3a1535fee664ff21fa98bc68992e703c4ff3 Mon Sep 17 00:00:00 2001 From: donoghuc Date: Thu, 15 May 2025 17:55:04 -0700 Subject: [PATCH 2/2] Update test expectations based on latest mongo gem This commit updates the test expectation for an updated message string. The same behavior is observbed, the message has just been updated. This commit also updates construction of a test mongodb client with a newly required value for auth_source when building a simple client. --- .../opentelemetry/instrumentation/mongo/subscriber_test.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/instrumentation/mongo/test/opentelemetry/instrumentation/mongo/subscriber_test.rb b/instrumentation/mongo/test/opentelemetry/instrumentation/mongo/subscriber_test.rb index 4a0a7af0e6..fe6ff241db 100644 --- a/instrumentation/mongo/test/opentelemetry/instrumentation/mongo/subscriber_test.rb +++ b/instrumentation/mongo/test/opentelemetry/instrumentation/mongo/subscriber_test.rb @@ -380,7 +380,7 @@ module MongoTraceTest _(span.events[0].name).must_equal 'exception' _(span.events[0].timestamp).must_be_kind_of Integer _(span.events[0].attributes['exception.type']).must_equal 'CommandFailed' - _(span.events[0].attributes['exception.message']).must_equal 'ns not found (26)' + _(span.events[0].attributes['exception.message']).must_equal '[26:NamespaceNotFound]: ns not found' end describe 'that triggers #failed before #started' do @@ -402,7 +402,8 @@ module MongoTraceTest database: TestHelper.database, auth_mech: :plain, user: 'plain_user', - password: 'plain_pass' + password: 'plain_pass', + auth_source: '$external' } end