From b1bdbebf82262cb202644d762f5f04f67b0b42d8 Mon Sep 17 00:00:00 2001 From: Sourabh Jain Date: Sat, 2 Sep 2023 23:04:12 +0530 Subject: [PATCH] fix tests --- .../OpenTelemetry/Filters/DiagnosticsFilterHelper.cs | 1 + .../DistributedTracingOTelTests.cs | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/Filters/DiagnosticsFilterHelper.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/Filters/DiagnosticsFilterHelper.cs index 05bd949671..029c3f4031 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/Filters/DiagnosticsFilterHelper.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/Filters/DiagnosticsFilterHelper.cs @@ -18,6 +18,7 @@ public static bool IsLatencyThresholdCrossed( OperationType operationType, OpenTelemetryAttributes response) { + config ??= new CosmosThresholdOptions(); TimeSpan latencyThreshold = operationType == OperationType.Query ? config.NonPointOperationLatencyThreshold : config.PointOperationLatencyThreshold; return response.Diagnostics.GetClientElapsedTime() > latencyThreshold; } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DistributedTracingOTelTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DistributedTracingOTelTests.cs index 299055c611..6ed14ff7ca 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DistributedTracingOTelTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/DistributedTracingOTelTests.cs @@ -182,7 +182,7 @@ await base.TestInit(validateSinglePartitionKeyRangeCacheCall: false, customizeClientBuilder: (builder) => builder .WithClientTelemetryOptions(new CosmosClientTelemetryOptions() { - DisableDistributedTracing = enableDistributingTracing + DisableDistributedTracing = !enableDistributingTracing }) .WithConnectionModeGateway()); } @@ -192,7 +192,7 @@ await base.TestInit(validateSinglePartitionKeyRangeCacheCall: false, customizeClientBuilder: (builder) => builder .WithClientTelemetryOptions(new CosmosClientTelemetryOptions() { - DisableDistributedTracing = enableDistributingTracing + DisableDistributedTracing = !enableDistributingTracing })); }