From 2a22d04781dc1fc411fdccdce34ab5a9d8455e1f Mon Sep 17 00:00:00 2001 From: Sourabh Jain Date: Mon, 8 Jul 2024 06:02:12 +0530 Subject: [PATCH] update env variable name and updated known issue section --- .../src/Telemetry/VmMetadataApiHandler.cs | 4 ++-- .../VmMetadataApiHandlerTest.cs | 10 +++++----- changelog.md | 1 + 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/VmMetadataApiHandler.cs b/Microsoft.Azure.Cosmos/src/Telemetry/VmMetadataApiHandler.cs index c88bc1c510..96836a6c64 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/VmMetadataApiHandler.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/VmMetadataApiHandler.cs @@ -36,7 +36,7 @@ internal static class VmMetadataApiHandler private static AzureVMMetadata azMetadata = null; /// - /// Check for environment variable COSMOS_DISABLE_VM_METADATA_ACCESS to decide if VM metadata call should be made or not. + /// Check for environment variable COSMOS_DISABLE_IMDS_ACCESS to decide if VM metadata call should be made or not. /// If environment variable is set to true, then VM metadata call will not be made. /// If environment variable is set to false, then VM metadata call will be made. /// If environment variable is not set, then VM metadata call will be made. @@ -45,7 +45,7 @@ internal static class VmMetadataApiHandler internal static void TryInitialize(CosmosHttpClient httpClient) { bool isVMMetadataAccessDisabled = - ConfigurationManager.GetEnvironmentVariable("COSMOS_DISABLE_VM_METADATA_ACCESS", false); + ConfigurationManager.GetEnvironmentVariable("COSMOS_DISABLE_IMDS_ACCESS", false); if (isVMMetadataAccessDisabled) { return; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/VmMetadataApiHandlerTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/VmMetadataApiHandlerTest.cs index 2145815887..0c60b627dc 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/VmMetadataApiHandlerTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/VmMetadataApiHandlerTest.cs @@ -38,14 +38,14 @@ public void Initialize() } [TestMethod] - [DataRow("true", DisplayName = "When COSMOS_DISABLE_VM_METADATA_ACCESS is set as true, VM ID should not be fetched")] - [DataRow("false", DisplayName = "When COSMOS_DISABLE_VM_METADATA_ACCESS is set as false, VM ID should be fetched")] - [DataRow(null, DisplayName = "When COSMOS_DISABLE_VM_METADATA_ACCESS is NOT set, VM ID should be fetched")] + [DataRow("true", DisplayName = "When COSMOS_DISABLE_IMDS_ACCESS is set as true, VM ID should not be fetched")] + [DataRow("false", DisplayName = "When COSMOS_DISABLE_IMDS_ACCESS is set as false, VM ID should be fetched")] + [DataRow(null, DisplayName = "When COSMOS_DISABLE_IMDS_ACCESS is NOT set, VM ID should be fetched")] public async Task GetVmIdAsMachineIdTest(string isVmMetadataAccessDisabled) { if (isVmMetadataAccessDisabled != null) { - Environment.SetEnvironmentVariable("COSMOS_DISABLE_VM_METADATA_ACCESS", isVmMetadataAccessDisabled); + Environment.SetEnvironmentVariable("COSMOS_DISABLE_IMDS_ACCESS", isVmMetadataAccessDisabled); } try @@ -84,7 +84,7 @@ static Task sendFunc(HttpRequestMessage request, Cancellati } finally { - Environment.SetEnvironmentVariable("COSMOS_DISABLE_VM_METADATA_ACCESS", null); + Environment.SetEnvironmentVariable("COSMOS_DISABLE_IMDS_ACCESS", null); } } diff --git a/changelog.md b/changelog.md index 658274524d..10a93874a2 100644 --- a/changelog.md +++ b/changelog.md @@ -1393,6 +1393,7 @@ Below is a list of any know issues affecting the [recommended minimum version](# | --- | --- | --- | --- | | `FeedIterator` enters an infinite loop after a physical partition split occurs in a container using hierarchical partition keys. | Queries using prefix partition keys. | Rather than having the PK included in the query request options, filtering on top level hierarchical Pks should be done through where clauses. | [#4326](https://github.com/Azure/azure-cosmos-dotnet-v3/issues/4326) | | Single partition queries (queries explicitly targetted to single partition or any queries on collection that had single physical partition) that resume using continuation token after partition split can observe failure on SDK v3.38 and beyond. | Explicit query exeuction using continuation token will fail query execution if these conditions are met. | Turn off Optimistic Direct Execution during query execution either by setting EnableOptimisticDirectExecution to false in query request options or by setting environment variable AZURE_COSMOS_OPTIMISTIC_DIRECT_EXECUTION_ENABLED to false. | [#4432](https://github.com/Azure/azure-cosmos-dotnet-v3/issues/4432) | +| An [Azure API](https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=linux) call is made to get the VM information. This call fails if cutomer is on non-Azure VM. | Although this call is made only during once during client initialization but this failure would come up into monitoring tool which leads to a confusion.| Turn off this call by setting environment variable COSMOS_DISABLE_IMDS_ACCESS to false. |[#4187](https://github.com/Azure/azure-cosmos-dotnet-v3/issues/4187) | ## Release & Retirement dates