From fdab9cb47504a2692b4cb9ab2267983033506c31 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Fri, 2 Aug 2019 16:34:08 -0700 Subject: [PATCH 01/10] Adding EnvironmentInformation --- .../src/EnvironmentInformation.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs diff --git a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs new file mode 100644 index 0000000000..c5aca87bc4 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Reflection; + using System.Runtime.InteropServices; + + //{SDK-id}-{process runtime}-{process-arch}-{host-rutnime}-{host-arch} + //{SDK-id}: Should include the name, version, direct version + internal sealed class EnvironmentInformation + { + internal static readonly string clientSDKVersion; + internal static readonly string framework; + internal static readonly string architecture; + + static EnvironmentInformation() + { + Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; + EnvironmentInformation.clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Revision}"; + EnvironmentInformation.framework = RuntimeInformation.FrameworkDescription; + EnvironmentInformation.architecture = RuntimeInformation.ProcessArchitecture.ToString(); + } + + /// + /// Version of the current client. + /// + public string ClientVersion => EnvironmentInformation.clientSDKVersion; + + /// + /// Identifier of the Framework. + /// + /// + public string RuntimeFramework => EnvironmentInformation.framework; + + /// + /// Type of architecture being used. + /// + /// + public string ProcessArchitecture => EnvironmentInformation.architecture; + + public override string ToString() + { + return $"/{this.ClientVersion}-{this.RuntimeFramework}-{this.ProcessArchitecture}"; + } + } +} From fdf62ad8887d7182c7f4c97848756110699813f6 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Fri, 2 Aug 2019 16:34:22 -0700 Subject: [PATCH 02/10] Wiring in UserAgentContainer --- Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index ed9afcd925..94bcd972b7 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -40,6 +40,7 @@ public class CosmosClientOptions private static readonly CosmosSerializer propertiesSerializer = new CosmosJsonSerializerWrapper(new CosmosJsonDotNetSerializer()); private readonly Collection customHandlers; + private readonly string currentEnvironmentInformation; private int gatewayModeMaxConnectionLimit; @@ -49,6 +50,9 @@ public class CosmosClientOptions public CosmosClientOptions() { this.UserAgentContainer = new UserAgentContainer(); + this.EnvironmentInformation = new EnvironmentInformation(); + this.currentEnvironmentInformation = this.EnvironmentInformation.ToString(); + this.UserAgentContainer.Suffix = this.currentEnvironmentInformation; this.GatewayModeMaxConnectionLimit = ConnectionPolicy.Default.MaxConnectionLimit; this.RequestTimeout = ConnectionPolicy.Default.RequestTimeout; this.ConnectionMode = CosmosClientOptions.DefaultConnectionMode; @@ -66,7 +70,7 @@ public CosmosClientOptions() public string ApplicationName { get => this.UserAgentContainer.Suffix; - set => this.UserAgentContainer.Suffix = value; + set => this.UserAgentContainer.Suffix = this.currentEnvironmentInformation + value; } /// @@ -217,6 +221,8 @@ public Collection CustomHandlers internal UserAgentContainer UserAgentContainer { get; private set; } + internal EnvironmentInformation EnvironmentInformation { get; private set; } + /// /// The event handler to be invoked before the request is sent. /// From ba21c4a34b6bc1b6ace0d98d395dfed1bc8e7b69 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Fri, 2 Aug 2019 16:38:08 -0700 Subject: [PATCH 03/10] Tests --- .../EnvironmentInformationTests.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs new file mode 100644 index 0000000000..6eee10f499 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs @@ -0,0 +1,48 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests +{ + using System; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Common; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class EnvironmentInformationTests + { + [TestMethod] + public void ClientVersionIsNotNull() + { + var envInfo = new EnvironmentInformation(); + Assert.IsNotNull(envInfo.ClientVersion); + } + + [TestMethod] + public void ProcessArchitectureIsNotNull() + { + var envInfo = new EnvironmentInformation(); + Assert.IsNotNull(envInfo.ProcessArchitecture); + } + + [TestMethod] + public void FrameworkIsNotNull() + { + var envInfo = new EnvironmentInformation(); + Assert.IsNotNull(envInfo.RuntimeFramework); + } + + [TestMethod] + public void ToStringContainsAll() + { + var envInfo = new EnvironmentInformation(); + var serialization = envInfo.ToString(); + Assert.IsTrue(serialization.Contains(envInfo.ClientVersion)); + Assert.IsTrue(serialization.Contains(envInfo.ProcessArchitecture)); + Assert.IsTrue(serialization.Contains(envInfo.RuntimeFramework)); + } + } +} From e0cc2205872f85c64352e9466361cb1927908ec3 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Mon, 5 Aug 2019 08:21:31 -0700 Subject: [PATCH 04/10] More tests and clientid --- .../src/CosmosClientOptions.cs | 9 +++++++-- .../src/EnvironmentInformation.cs | 9 ++++++++- .../CosmosClientOptionsUnitTests.cs | 19 ++++++++++++++++++- .../EnvironmentInformationTests.cs | 13 ++++++++----- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index 94bcd972b7..244b69c948 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -43,6 +43,7 @@ public class CosmosClientOptions private readonly string currentEnvironmentInformation; private int gatewayModeMaxConnectionLimit; + private string applicationName; /// /// Creates a new CosmosClientOptions @@ -69,8 +70,12 @@ public CosmosClientOptions() /// public string ApplicationName { - get => this.UserAgentContainer.Suffix; - set => this.UserAgentContainer.Suffix = this.currentEnvironmentInformation + value; + get => this.applicationName; + set + { + this.UserAgentContainer.Suffix = this.currentEnvironmentInformation + value; + this.applicationName = value; + } } /// diff --git a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs index c5aca87bc4..1c8b47be43 100644 --- a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs +++ b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs @@ -11,6 +11,7 @@ namespace Microsoft.Azure.Cosmos //{SDK-id}: Should include the name, version, direct version internal sealed class EnvironmentInformation { + internal static readonly string clientId; internal static readonly string clientSDKVersion; internal static readonly string framework; internal static readonly string architecture; @@ -21,8 +22,14 @@ static EnvironmentInformation() EnvironmentInformation.clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Revision}"; EnvironmentInformation.framework = RuntimeInformation.FrameworkDescription; EnvironmentInformation.architecture = RuntimeInformation.ProcessArchitecture.ToString(); + EnvironmentInformation.clientId = Guid.NewGuid().ToString(); } + /// + /// Unique identifier of a client + /// + public string ClientId => EnvironmentInformation.clientId; + /// /// Version of the current client. /// @@ -42,7 +49,7 @@ static EnvironmentInformation() public override string ToString() { - return $"/{this.ClientVersion}-{this.RuntimeFramework}-{this.ProcessArchitecture}"; + return $"/{this.ClientVersion}-{this.RuntimeFramework}-{this.ProcessArchitecture}-{this.ClientId}"; } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs index dfd6e8c085..118abd1dc8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs @@ -90,7 +90,7 @@ public void VerifyCosmosConfigurationPropertiesGetUpdated() Assert.AreEqual(Protocol.Https, policy.ConnectionProtocol); Assert.AreEqual(maxConnections, policy.MaxConnectionLimit); Assert.AreEqual(requestTimeout, policy.RequestTimeout); - Assert.AreEqual(userAgentSuffix, policy.UserAgentSuffix); + Assert.IsTrue(policy.UserAgentSuffix.Contains(userAgentSuffix)); Assert.IsTrue(policy.UseMultipleWriteLocations); Assert.AreEqual(maxRetryAttemptsOnThrottledRequests, policy.RetryOptions.MaxRetryAttemptsOnThrottledRequests); Assert.AreEqual((int)maxRetryWaitTime.TotalSeconds, policy.RetryOptions.MaxRetryWaitTimeInSeconds); @@ -116,6 +116,23 @@ public void ThrowOnNullEndpoint() new CosmosClientBuilder(null, "testKey"); } + [TestMethod] + public void UserAgentContainsEnvironmentInformation() + { + var environmentInformation = new EnvironmentInformation(); + var expectedValue = environmentInformation.ToString(); + CosmosClientOptions cosmosClientOptions = new CosmosClientOptions(); + string userAgentSuffix = "testSuffix"; + cosmosClientOptions.ApplicationName = userAgentSuffix; + + Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.Contains(userAgentSuffix)); + Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.Contains(expectedValue)); + + ConnectionPolicy connectionPolicy = cosmosClientOptions.GetConnectionPolicy(); + Assert.IsTrue(connectionPolicy.UserAgentSuffix.Contains(userAgentSuffix)); + Assert.IsTrue(connectionPolicy.UserAgentSuffix.Contains(expectedValue)); + } + [TestMethod] [ExpectedException(typeof(ArgumentNullException))] public void ThrowOnNullConnectionString() diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs index 6eee10f499..c62965ac3f 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs @@ -4,11 +4,6 @@ namespace Microsoft.Azure.Cosmos.Tests { - using System; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Common; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] @@ -35,6 +30,13 @@ public void FrameworkIsNotNull() Assert.IsNotNull(envInfo.RuntimeFramework); } + [TestMethod] + public void ClientIdIsNotNull() + { + var envInfo = new EnvironmentInformation(); + Assert.IsNotNull(envInfo.ClientId); + } + [TestMethod] public void ToStringContainsAll() { @@ -43,6 +45,7 @@ public void ToStringContainsAll() Assert.IsTrue(serialization.Contains(envInfo.ClientVersion)); Assert.IsTrue(serialization.Contains(envInfo.ProcessArchitecture)); Assert.IsTrue(serialization.Contains(envInfo.RuntimeFramework)); + Assert.IsTrue(serialization.Contains(envInfo.ClientId)); } } } From d5609f8bcbf6893a39d40fdc427ec700a55af6ac Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Mon, 5 Aug 2019 08:54:13 -0700 Subject: [PATCH 05/10] Using valid separators --- Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs index 1c8b47be43..9a5e8ec275 100644 --- a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs +++ b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs @@ -7,8 +7,6 @@ namespace Microsoft.Azure.Cosmos using System.Reflection; using System.Runtime.InteropServices; - //{SDK-id}-{process runtime}-{process-arch}-{host-rutnime}-{host-arch} - //{SDK-id}: Should include the name, version, direct version internal sealed class EnvironmentInformation { internal static readonly string clientId; @@ -22,7 +20,7 @@ static EnvironmentInformation() EnvironmentInformation.clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Revision}"; EnvironmentInformation.framework = RuntimeInformation.FrameworkDescription; EnvironmentInformation.architecture = RuntimeInformation.ProcessArchitecture.ToString(); - EnvironmentInformation.clientId = Guid.NewGuid().ToString(); + EnvironmentInformation.clientId = DateTime.UtcNow.Ticks.ToString(); } /// @@ -49,7 +47,7 @@ static EnvironmentInformation() public override string ToString() { - return $"/{this.ClientVersion}-{this.RuntimeFramework}-{this.ProcessArchitecture}-{this.ClientId}"; + return $" {this.ClientVersion}-{this.RuntimeFramework} {this.ProcessArchitecture} {this.ClientId}"; } } } From a1f9b8801705936ee209c87313872270fabb4891 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Mon, 5 Aug 2019 12:49:02 -0700 Subject: [PATCH 06/10] Addressing comments --- Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs | 6 ++---- .../CosmosClientOptionsUnitTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index 244b69c948..2355420154 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -51,8 +51,8 @@ public class CosmosClientOptions public CosmosClientOptions() { this.UserAgentContainer = new UserAgentContainer(); - this.EnvironmentInformation = new EnvironmentInformation(); - this.currentEnvironmentInformation = this.EnvironmentInformation.ToString(); + EnvironmentInformation environmentInformation = new EnvironmentInformation(); + this.currentEnvironmentInformation = environmentInformation.ToString(); this.UserAgentContainer.Suffix = this.currentEnvironmentInformation; this.GatewayModeMaxConnectionLimit = ConnectionPolicy.Default.MaxConnectionLimit; this.RequestTimeout = ConnectionPolicy.Default.RequestTimeout; @@ -226,8 +226,6 @@ public Collection CustomHandlers internal UserAgentContainer UserAgentContainer { get; private set; } - internal EnvironmentInformation EnvironmentInformation { get; private set; } - /// /// The event handler to be invoked before the request is sent. /// diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs index 118abd1dc8..e562f6f443 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs @@ -125,11 +125,11 @@ public void UserAgentContainsEnvironmentInformation() string userAgentSuffix = "testSuffix"; cosmosClientOptions.ApplicationName = userAgentSuffix; - Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.Contains(userAgentSuffix)); + Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.EndsWith(userAgentSuffix)); Assert.IsTrue(cosmosClientOptions.UserAgentContainer.Suffix.Contains(expectedValue)); ConnectionPolicy connectionPolicy = cosmosClientOptions.GetConnectionPolicy(); - Assert.IsTrue(connectionPolicy.UserAgentSuffix.Contains(userAgentSuffix)); + Assert.IsTrue(connectionPolicy.UserAgentSuffix.EndsWith(userAgentSuffix)); Assert.IsTrue(connectionPolicy.UserAgentSuffix.Contains(expectedValue)); } From b7f525ce5039baf99d64c6e298463cff78ce98d3 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Mon, 5 Aug 2019 13:37:03 -0700 Subject: [PATCH 07/10] ChangeLog --- changelog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.md b/changelog.md index c6451dd26a..198e1f9b97 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added +- [#630](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/630) Added environment information to the User Agent + ### Fixed - [#612](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/612) Bug fix for ReadFeed with partition-key From cf32bab21d501f548c7cb893e58fe8a77dd231f8 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Mon, 5 Aug 2019 16:06:00 -0700 Subject: [PATCH 08/10] Using Build --- Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs | 2 +- .../EnvironmentInformationTests.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs index 9a5e8ec275..df602b9e5d 100644 --- a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs +++ b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs @@ -17,7 +17,7 @@ internal sealed class EnvironmentInformation static EnvironmentInformation() { Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; - EnvironmentInformation.clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Revision}"; + EnvironmentInformation.clientSDKVersion = $"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}"; EnvironmentInformation.framework = RuntimeInformation.FrameworkDescription; EnvironmentInformation.architecture = RuntimeInformation.ProcessArchitecture.ToString(); EnvironmentInformation.clientId = DateTime.UtcNow.Ticks.ToString(); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs index c62965ac3f..00ab746641 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/EnvironmentInformationTests.cs @@ -4,6 +4,8 @@ namespace Microsoft.Azure.Cosmos.Tests { + using System; + using System.Reflection; using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] @@ -14,6 +16,9 @@ public void ClientVersionIsNotNull() { var envInfo = new EnvironmentInformation(); Assert.IsNotNull(envInfo.ClientVersion); + + Version sdkVersion = Assembly.GetAssembly(typeof(CosmosClient)).GetName().Version; + Assert.AreEqual($"{sdkVersion.Major}.{sdkVersion.Minor}.{sdkVersion.Build}", envInfo.ClientVersion, "Version format differs"); } [TestMethod] From 370c5820ad75633af621803fbc6afcc37160ccb7 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Wed, 7 Aug 2019 10:01:45 -0700 Subject: [PATCH 09/10] Changed changelog --- changelog.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 198e1f9b97..60ef396834 100644 --- a/changelog.md +++ b/changelog.md @@ -5,13 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased -### Added -- [#630](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/630) Added environment information to the User Agent - ### Fixed - [#612](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/612) Bug fix for ReadFeed with partition-key - [#614](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/614) Fixed SpatialPath serialization and compatibility with older index versions +- [#630](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/630) Fixed User Agent to contain environment and package information ## [3.1.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.1.0) - 2019-07-26 From ab3376da73d5f13d04f8a6a299e9d1b76ecfd209 Mon Sep 17 00:00:00 2001 From: Matias Quaranta Date: Wed, 7 Aug 2019 15:13:07 -0700 Subject: [PATCH 10/10] Delimiter --- Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs | 2 +- Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs index 2355420154..5f15d74769 100644 --- a/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs +++ b/Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs @@ -73,7 +73,7 @@ public string ApplicationName get => this.applicationName; set { - this.UserAgentContainer.Suffix = this.currentEnvironmentInformation + value; + this.UserAgentContainer.Suffix = this.currentEnvironmentInformation + EnvironmentInformation.Delimiter + value; this.applicationName = value; } } diff --git a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs index df602b9e5d..c2e766649d 100644 --- a/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs +++ b/Microsoft.Azure.Cosmos/src/EnvironmentInformation.cs @@ -9,10 +9,11 @@ namespace Microsoft.Azure.Cosmos internal sealed class EnvironmentInformation { - internal static readonly string clientId; - internal static readonly string clientSDKVersion; - internal static readonly string framework; - internal static readonly string architecture; + internal const string Delimiter = " "; + private static readonly string clientId; + private static readonly string clientSDKVersion; + private static readonly string framework; + private static readonly string architecture; static EnvironmentInformation() {