mirror of https://github.com/mongodb/mongo
SERVER-112812 Fix invalid access issue when TestData.enableOTELTracing is enabled (#43176)
GitOrigin-RevId: 93124538b5a759a9f8c37176462d70c76f79b302
This commit is contained in:
parent
6d408e2a5b
commit
0a38d039a1
|
|
@ -47,7 +47,7 @@ BSONTextMapCarrier::BSONTextMapCarrier(const BSONObj& bson) {
|
|||
OtelStringView BSONTextMapCarrier::Get(OtelStringView key) const noexcept {
|
||||
auto it = _values.find(key);
|
||||
if (it == _values.end()) {
|
||||
return {};
|
||||
return kMissingKeyReturnValue;
|
||||
}
|
||||
return it->second;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@ namespace mongo {
|
|||
namespace otel {
|
||||
namespace traces {
|
||||
|
||||
// TODO SERVER-112886: Once this ticket is resolved this should be changed back to an empty string.
|
||||
constexpr OtelStringView kMissingKeyReturnValue = " ";
|
||||
|
||||
using opentelemetry::nostd::function_ref;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ TEST(BSONTextMapCarrier, GetExistingKey) {
|
|||
|
||||
TEST(BSONTextMapCarrier, GetMissingKey) {
|
||||
BSONTextMapCarrier carrier;
|
||||
ASSERT_EQ(carrier.Get(keyA), "");
|
||||
ASSERT_EQ(carrier.Get(keyA), kMissingKeyReturnValue);
|
||||
}
|
||||
|
||||
TEST(BSONTextMapCarrier, SetExistingKey) {
|
||||
|
|
@ -127,7 +127,7 @@ TEST(BSONTextMapCarrier, NonStringFieldsIgnored) {
|
|||
ASSERT_EQ(keys.size(), 1);
|
||||
ASSERT_TRUE(keys.contains(keyA));
|
||||
ASSERT_EQ(carrier.Get(keyA), valueA);
|
||||
ASSERT_EQ(carrier.Get("uuid"), "");
|
||||
ASSERT_EQ(carrier.Get("uuid"), kMissingKeyReturnValue);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -353,10 +353,9 @@ let _jsTestOptions = {};
|
|||
|
||||
function jsTestOptions() {
|
||||
if (TestData) {
|
||||
// TODO (SERVER-112812): Enable OpenTelemetry tracing.
|
||||
// const isMultiversion =
|
||||
// TestData.useRandomBinVersionsWithinReplicaSet || TestData.mixedBinVersions || TestData.mongosBinVersion;
|
||||
const enableOTELTracing = false; //TestData.enableOTELTracing ?? !isMultiversion;
|
||||
const isMultiversion =
|
||||
TestData.useRandomBinVersionsWithinReplicaSet || TestData.mixedBinVersions || TestData.mongosBinVersion;
|
||||
const enableOTELTracing = TestData.enableOTELTracing ?? !isMultiversion;
|
||||
|
||||
return Object.merge(_jsTestOptions, {
|
||||
// Test commands should be enabled by default if no enableTestCommands were present in
|
||||
|
|
|
|||
Loading…
Reference in New Issue