diff --git a/.github/fabricbot.json b/.github/fabricbot.json index 90924da0c3..e400139553 100644 --- a/.github/fabricbot.json +++ b/.github/fabricbot.json @@ -102,7 +102,82 @@ } ] } + }, + { + "taskType": "trigger", + "capabilityId": "AutoMerge", + "subCapability": "AutoMerge", + "version": "1.0", + "config": { + "taskName": "PR Automerge", + "allowAutoMergeInstructionsWithoutLabel": false, + "mergeType": "squash", + "deleteBranches": true, + "removeLabelOnPush": true, + "label": "auto-merge", + "requireAllStatuses": false, + "requireSpecificCheckRuns": false, + "usePrDescriptionAsCommitMessage": false, + "minMinutesOpen": "60", + "enforceDMPAsStatus": true + } + }, + { + "taskType": "scheduled", + "capabilityId": "ScheduledSearch", + "subCapability": "ScheduledSearch", + "version": "1.1", + "config": { + "frequency": [ + { + "weekDay": 1, + "hours": [ + 9 + ], + "timezoneOffset": -7 + } + ], + "searchTerms": [ + { + "name": "isOpen", + "parameters": {} + }, + { + "name": "isIssue", + "parameters": {} + }, + { + "name": "hasLabel", + "parameters": { + "label": "needs-more-information" + } + }, + { + "name": "noActivitySince", + "parameters": { + "days": 14 + } + }, + { + "name": "noAssignees", + "parameters": {} + } + ], + "taskName": "Close inactive needs-information", + "actions": [ + { + "name": "addReply", + "parameters": { + "comment": "@${issueAuthor} this issue requires more information for the team to be able to help. In case this information is available, please add it and re-open the Issue." + } + }, + { + "name": "closeIssue", + "parameters": {} + } + ] + } } ], "userGroups": [] -} \ No newline at end of file +} diff --git a/Directory.Build.props b/Directory.Build.props index 39004a08ab..a24f0ab2ac 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,13 +1,13 @@ - 3.32.2 - 3.32.2 + 3.33.0 + 3.33.0 preview - 3.30.4 + 3.30.8 2.0.1 2.0.1 preview - 1.0.0-preview04 + 1.0.0-preview05 1.1.0-preview3 10.0 $([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../')) diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md b/Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md index a17680a9f8..58fcf1d790 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/changelog.md @@ -3,6 +3,11 @@ Preview features are treated as a separate branch and will not be included in th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [1.0.0-preview05](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview05) - 2023-04-27 + +#### Fixes +- [#3809](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3809) Adds api FetchDataEncryptionKeyWithoutRawKeyAsync and FetchDataEncryptionKey to get DEK without and with raw key respectively. + ### [1.0.0-preview04](https://www.nuget.org/packages/Microsoft.Azure.Cosmos.Encryption.Custom/1.0.0-preview04) - 2022-08-16 #### Fixes diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosDataEncryptionKeyProvider.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosDataEncryptionKeyProvider.cs index 1c8cffce8e..773845aa9e 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosDataEncryptionKeyProvider.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosDataEncryptionKeyProvider.cs @@ -166,11 +166,25 @@ public async Task InitializeAsync( this.container = containerResponse.Container; } + /// + public override async Task FetchDataEncryptionKeyWithoutRawKeyAsync( + string id, + string encryptionAlgorithm, + CancellationToken cancellationToken) + { + return await this.FetchDekAsync(id, encryptionAlgorithm, cancellationToken); + } + /// public override async Task FetchDataEncryptionKeyAsync( string id, string encryptionAlgorithm, CancellationToken cancellationToken) + { + return await this.FetchDekAsync(id, encryptionAlgorithm, cancellationToken, true); + } + + private async Task FetchDekAsync(string id, string encryptionAlgorithm, CancellationToken cancellationToken, bool withRawKey = false) { DataEncryptionKeyProperties dataEncryptionKeyProperties = await this.dataEncryptionKeyContainerCore.FetchDataEncryptionKeyPropertiesAsync( id, @@ -200,7 +214,8 @@ public override async Task FetchDataEncryptionKeyAsync( InMemoryRawDek inMemoryRawDek = await this.dataEncryptionKeyContainerCore.FetchUnwrappedAsync( dataEncryptionKeyProperties, diagnosticsContext: CosmosDiagnosticsContext.Create(null), - cancellationToken: cancellationToken); + cancellationToken: cancellationToken, + withRawKey); return inMemoryRawDek.DataEncryptionKey; } diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosEncryptor.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosEncryptor.cs index 3a325e77b2..462bd56a1f 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosEncryptor.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/CosmosEncryptor.cs @@ -35,14 +35,14 @@ public override async Task DecryptAsync( string encryptionAlgorithm, CancellationToken cancellationToken = default) { - DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync( + DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync( dataEncryptionKeyId, encryptionAlgorithm, cancellationToken); if (dek == null) { - throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync)}."); + throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync)}."); } return dek.DecryptData(cipherText); @@ -55,14 +55,14 @@ public override async Task EncryptAsync( string encryptionAlgorithm, CancellationToken cancellationToken = default) { - DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync( + DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync( dataEncryptionKeyId, encryptionAlgorithm, cancellationToken); if (dek == null) { - throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync)}."); + throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync)}."); } return dek.EncryptData(plainText); diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyContainerCore.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyContainerCore.cs index b5f5d340c9..68e5414275 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyContainerCore.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyContainerCore.cs @@ -335,6 +335,7 @@ internal async Task FetchUnWrappedMdeSupportedLegacyDekAsync( unwrapResult.DataEncryptionKey); return new MdeEncryptionAlgorithm( + unwrapResult.DataEncryptionKey, plaintextDataEncryptionKey, Data.Encryption.Cryptography.EncryptionType.Randomized); } @@ -378,13 +379,14 @@ internal async Task FetchUnWrappedLegacySupportedMdeDekAsync( internal async Task FetchUnwrappedAsync( DataEncryptionKeyProperties dekProperties, CosmosDiagnosticsContext diagnosticsContext, - CancellationToken cancellationToken) + CancellationToken cancellationToken, + bool withRawKey = false) { try { if (string.Equals(dekProperties.EncryptionAlgorithm, CosmosEncryptionAlgorithm.MdeAeadAes256CbcHmac256Randomized)) { - DataEncryptionKey dek = this.InitMdeEncryptionAlgorithm(dekProperties); + DataEncryptionKey dek = this.InitMdeEncryptionAlgorithm(dekProperties, withRawKey); // TTL is not used since DEK is not cached. return new InMemoryRawDek(dek, TimeSpan.FromMilliseconds(0)); @@ -564,7 +566,7 @@ private async Task UnWrapDekMdeEncAlgoAsync( return unwrapResult; } - internal DataEncryptionKey InitMdeEncryptionAlgorithm(DataEncryptionKeyProperties dekProperties) + internal DataEncryptionKey InitMdeEncryptionAlgorithm(DataEncryptionKeyProperties dekProperties, bool withRawKey = false) { if (this.DekProvider.MdeKeyWrapProvider == null) { @@ -576,7 +578,8 @@ internal DataEncryptionKey InitMdeEncryptionAlgorithm(DataEncryptionKeyPropertie dekProperties, Data.Encryption.Cryptography.EncryptionType.Randomized, this.DekProvider.MdeKeyWrapProvider.EncryptionKeyStoreProvider, - this.DekProvider.PdekCacheTimeToLive); + this.DekProvider.PdekCacheTimeToLive, + withRawKey); } private async Task ReadResourceAsync( diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyProvider.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyProvider.cs index 502e14897b..c92df3fa60 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyProvider.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/DataEncryptionKeyProvider.cs @@ -14,7 +14,19 @@ namespace Microsoft.Azure.Cosmos.Encryption.Custom public abstract class DataEncryptionKeyProvider { /// - /// Retrieves the data encryption key for the given id. + /// Retrieves the data encryption key for the given id without rawkey. RawKey will be set to null. + /// + /// Identifier of the data encryption key. + /// Encryption algorithm that the retrieved key will be used with. + /// Token for request cancellation. + /// Data encryption key bytes. + public abstract Task FetchDataEncryptionKeyWithoutRawKeyAsync( + string id, + string encryptionAlgorithm, + CancellationToken cancellationToken); + + /// + /// Retrieves the data encryption key for the given id with RawKey value. /// /// Identifier of the data encryption key. /// Encryption algorithm that the retrieved key will be used with. diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/EncryptionContainer.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/src/EncryptionContainer.cs index ae0ec2aead..eebf5900cf 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/EncryptionContainer.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/EncryptionContainer.cs @@ -791,13 +791,6 @@ public override Task> GetFeedRangesAsync( return this.container.GetFeedRangesAsync(cancellationToken); } - public override Task> GetPartitionKeyRangesAsync( - FeedRange feedRange, - CancellationToken cancellationToken = default) - { - return this.container.GetPartitionKeyRangesAsync(feedRange, cancellationToken); - } - public override FeedIterator GetItemQueryStreamIterator( FeedRange feedRange, QueryDefinition queryDefinition, @@ -1010,6 +1003,14 @@ public override async Task> ReadManyItemsAsync( return this.ResponseFactory.CreateItemFeedResponse(responseMessage); } +#if ENCRYPTIONPREVIEW + public override Task> GetPartitionKeyRangesAsync( + FeedRange feedRange, + CancellationToken cancellationToken = default) + { + return this.container.GetPartitionKeyRangesAsync(feedRange, cancellationToken); + } + public override Task DeleteAllItemsByPartitionKeyStreamAsync( Cosmos.PartitionKey partitionKey, RequestOptions requestOptions = null, @@ -1020,6 +1021,7 @@ public override Task DeleteAllItemsByPartitionKeyStreamAsync( requestOptions, cancellationToken); } +#endif private async Task ReadManyItemsHelperAsync( IReadOnlyList<(string id, PartitionKey partitionKey)> items, diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/MdeServices/MdeEncryptionAlgorithm.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/src/MdeServices/MdeEncryptionAlgorithm.cs index d9144a5c4f..68d863114e 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/MdeServices/MdeEncryptionAlgorithm.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/MdeServices/MdeEncryptionAlgorithm.cs @@ -14,8 +14,10 @@ internal sealed class MdeEncryptionAlgorithm : DataEncryptionKey { private readonly AeadAes256CbcHmac256EncryptionAlgorithm mdeAeadAes256CbcHmac256EncryptionAlgorithm; + private readonly byte[] unwrapKey; + // unused for MDE Algorithm. - public override byte[] RawKey => null; + public override byte[] RawKey { get; } public override string EncryptionAlgorithm => CosmosEncryptionAlgorithm.MdeAeadAes256CbcHmac256Randomized; @@ -32,7 +34,8 @@ public MdeEncryptionAlgorithm( DataEncryptionKeyProperties dekProperties, Data.Encryption.Cryptography.EncryptionType encryptionType, EncryptionKeyStoreProvider encryptionKeyStoreProvider, - TimeSpan? cacheTimeToLive) + TimeSpan? cacheTimeToLive, + bool withRawKey=false) { if (dekProperties == null) { @@ -49,36 +52,39 @@ public MdeEncryptionAlgorithm( dekProperties.EncryptionKeyWrapMetadata.Value, encryptionKeyStoreProvider); - ProtectedDataEncryptionKey protectedDataEncryptionKey; - if (cacheTimeToLive.HasValue) + if (!withRawKey) { - // no caching - if (cacheTimeToLive.Value == TimeSpan.Zero) - { - protectedDataEncryptionKey = new ProtectedDataEncryptionKey( + ProtectedDataEncryptionKey protectedDataEncryptionKey = cacheTimeToLive.HasValue && cacheTimeToLive.Value == TimeSpan.Zero + ? new ProtectedDataEncryptionKey( + dekProperties.Id, + keyEncryptionKey, + dekProperties.WrappedDataEncryptionKey) + : ProtectedDataEncryptionKey.GetOrCreate( dekProperties.Id, keyEncryptionKey, dekProperties.WrappedDataEncryptionKey); - } - else - { - protectedDataEncryptionKey = ProtectedDataEncryptionKey.GetOrCreate( - dekProperties.Id, - keyEncryptionKey, - dekProperties.WrappedDataEncryptionKey); - } + this.mdeAeadAes256CbcHmac256EncryptionAlgorithm = AeadAes256CbcHmac256EncryptionAlgorithm.GetOrCreate( + protectedDataEncryptionKey, + encryptionType); } else { - protectedDataEncryptionKey = ProtectedDataEncryptionKey.GetOrCreate( - dekProperties.Id, - keyEncryptionKey, - dekProperties.WrappedDataEncryptionKey); + byte[] rawKey = keyEncryptionKey.DecryptEncryptionKey(dekProperties.WrappedDataEncryptionKey); + PlaintextDataEncryptionKey plaintextDataEncryptionKey = cacheTimeToLive.HasValue && (cacheTimeToLive.Value == TimeSpan.Zero) + ? new PlaintextDataEncryptionKey( + dekProperties.Id, + rawKey) + : PlaintextDataEncryptionKey.GetOrCreate( + dekProperties.Id, + rawKey); + this.RawKey = rawKey; + this.mdeAeadAes256CbcHmac256EncryptionAlgorithm = AeadAes256CbcHmac256EncryptionAlgorithm.GetOrCreate( + plaintextDataEncryptionKey, + encryptionType); + } - this.mdeAeadAes256CbcHmac256EncryptionAlgorithm = AeadAes256CbcHmac256EncryptionAlgorithm.GetOrCreate( - protectedDataEncryptionKey, - encryptionType); + } /// @@ -90,9 +96,11 @@ public MdeEncryptionAlgorithm( /// Data Encryption Key /// Encryption type public MdeEncryptionAlgorithm( + byte[] rawkey, Data.Encryption.Cryptography.DataEncryptionKey dataEncryptionKey, Data.Encryption.Cryptography.EncryptionType encryptionType) { + this.RawKey = rawkey; this.mdeAeadAes256CbcHmac256EncryptionAlgorithm = AeadAes256CbcHmac256EncryptionAlgorithm.GetOrCreate( dataEncryptionKey, encryptionType); diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj b/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj index d368f399bd..09b92aa37e 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj @@ -4,13 +4,11 @@ Microsoft.Azure.Cosmos.Encryption.Custom Microsoft.Azure.Cosmos.Encryption.Custom $(LangVersion) - true - $([System.DateTime]::Now.ToString(yyyyMMdd)) $(CustomEncryptionVersion) Microsoft Corporation Microsoft - This is an internal library that provides an implementation for client-side encryption for Azure Cosmos DB's SQL API for multi-tenant use case. For more information, refer to https://aka.ms/CosmosCustomClientEncryption + This is an internal library that provides an implementation for client-side encryption for Azure Cosmos DB for NoSQL for multi-tenant use case. For more information, refer to https://aka.ms/CosmosCustomClientEncryption © Microsoft Corporation. All rights reserved. Microsoft Azure Cosmos DB client-side encryption library for multi-tenant Microsoft.Azure.Cosmos.Encryption.Custom @@ -24,8 +22,12 @@ - - + + + + + + diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/LegacyEncryptionTests.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/LegacyEncryptionTests.cs index 27f4567732..2785f04815 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/LegacyEncryptionTests.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/LegacyEncryptionTests.cs @@ -1747,14 +1747,14 @@ public override async Task DecryptAsync( throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned."); } - DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync( + DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync( dataEncryptionKeyId, encryptionAlgorithm, cancellationToken); if (dek == null) { - throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync)}."); + throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync)}."); } return dek.DecryptData(cipherText); @@ -1766,7 +1766,7 @@ public override async Task EncryptAsync( string encryptionAlgorithm, CancellationToken cancellationToken = default) { - DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync( + DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync( dataEncryptionKeyId, encryptionAlgorithm, cancellationToken); diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/MdeCustomEncryptionTests.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/MdeCustomEncryptionTests.cs index 3b2b8f8d97..e100268ea0 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/MdeCustomEncryptionTests.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/EmulatorTests/MdeCustomEncryptionTests.cs @@ -20,6 +20,7 @@ namespace Microsoft.Azure.Cosmos.Encryption.EmulatorTests using EncryptionKeyWrapMetadata = Custom.EncryptionKeyWrapMetadata; using DataEncryptionKey = Custom.DataEncryptionKey; using Newtonsoft.Json.Linq; + using System.Buffers.Text; [TestClass] public class MdeCustomEncryptionTests @@ -103,6 +104,47 @@ public async Task EncryptionCreateDek() Assert.AreEqual(dekProperties, readProperties); } + [TestMethod] + public async Task FetchDataEncryptionKeyWithRawKey() + { + CosmosDataEncryptionKeyProvider dekProvider = new CosmosDataEncryptionKeyProvider(new TestEncryptionKeyStoreProvider()); + await dekProvider.InitializeAsync(MdeCustomEncryptionTests.database, MdeCustomEncryptionTests.keyContainer.Id); + DataEncryptionKey k = await dekProvider.FetchDataEncryptionKeyAsync(dekProperties.Id, dekProperties.EncryptionAlgorithm, CancellationToken.None); + Assert.IsNotNull(k.RawKey); + } + + [TestMethod] + public async Task FetchDataEncryptionKeyWithoutRawKey() + { + CosmosDataEncryptionKeyProvider dekProvider = new CosmosDataEncryptionKeyProvider(new TestEncryptionKeyStoreProvider()); + await dekProvider.InitializeAsync(MdeCustomEncryptionTests.database, MdeCustomEncryptionTests.keyContainer.Id); + DataEncryptionKey k = await dekProvider.FetchDataEncryptionKeyWithoutRawKeyAsync(dekProperties.Id, dekProperties.EncryptionAlgorithm, CancellationToken.None); + Assert.IsNull(k.RawKey); + } + + [TestMethod] + [Obsolete] + public async Task FetchDataEncryptionKeyMdeDEKAndLegacyBasedAlgorithm() + { + CosmosDataEncryptionKeyProvider dekProvider = new CosmosDataEncryptionKeyProvider(new TestEncryptionKeyStoreProvider()); + await dekProvider.InitializeAsync(MdeCustomEncryptionTests.database, MdeCustomEncryptionTests.keyContainer.Id); + DataEncryptionKey k = await dekProvider.FetchDataEncryptionKeyAsync(dekProperties.Id, CosmosEncryptionAlgorithm.AEAes256CbcHmacSha256Randomized, CancellationToken.None); + Assert.IsNotNull(k.RawKey); + } + + [TestMethod] + [Obsolete] + public async Task FetchDataEncryptionKeyLegacyDEKAndMdeBasedAlgorithm() + { + string dekId = "legacyDEK"; + DataEncryptionKeyProperties dekProperties = await MdeCustomEncryptionTests.CreateDekAsync(MdeCustomEncryptionTests.dekProvider, dekId, CosmosEncryptionAlgorithm.AEAes256CbcHmacSha256Randomized); + // Use different DEK provider to avoid (unintentional) cache impact + CosmosDataEncryptionKeyProvider dekProvider = new CosmosDataEncryptionKeyProvider(new TestKeyWrapProvider(), new TestEncryptionKeyStoreProvider()); + await dekProvider.InitializeAsync(MdeCustomEncryptionTests.database, MdeCustomEncryptionTests.keyContainer.Id); + DataEncryptionKey k = await dekProvider.FetchDataEncryptionKeyAsync(dekProperties.Id, CosmosEncryptionAlgorithm.MdeAeadAes256CbcHmac256Randomized, CancellationToken.None); + Assert.IsNotNull(k.RawKey); + } + [TestMethod] public async Task EncryptionRewrapDek() { @@ -2190,14 +2232,14 @@ public override async Task DecryptAsync( throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned."); } - DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync( + DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync( dataEncryptionKeyId, encryptionAlgorithm, cancellationToken); if (dek == null) { - throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync)}."); + throw new InvalidOperationException($"Null {nameof(DataEncryptionKey)} returned from {nameof(this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync)}."); } return dek.DecryptData(cipherText); @@ -2209,7 +2251,7 @@ public override async Task EncryptAsync( string encryptionAlgorithm, CancellationToken cancellationToken = default) { - DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyAsync( + DataEncryptionKey dek = await this.DataEncryptionKeyProvider.FetchDataEncryptionKeyWithoutRawKeyAsync( dataEncryptionKeyId, encryptionAlgorithm, cancellationToken); diff --git a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/CosmosEncryptorTests.cs b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/CosmosEncryptorTests.cs index 747bf3e295..63c5b370d1 100644 --- a/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/CosmosEncryptorTests.cs +++ b/Microsoft.Azure.Cosmos.Encryption.Custom/tests/Microsoft.Azure.Cosmos.Encryption.Custom.Tests/CosmosEncryptorTests.cs @@ -34,7 +34,7 @@ public static void ClassInitialize(TestContext testContext) CosmosEncryptorTests.mockDataEncryptionKeyProvider = new Mock(); CosmosEncryptorTests.mockDataEncryptionKeyProvider - .Setup(m => m.FetchDataEncryptionKeyAsync(It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(m => m.FetchDataEncryptionKeyWithoutRawKeyAsync(It.IsAny(), It.IsAny(), It.IsAny())) .ReturnsAsync((string dekId, string algo, CancellationToken cancellationToken) => dekId == CosmosEncryptorTests.dekId ? CosmosEncryptorTests.mockDataEncryptionKey.Object : null); @@ -82,7 +82,7 @@ public async Task ValidateEncryptDecrypt() Times.Once); CosmosEncryptorTests.mockDataEncryptionKeyProvider.Verify( - m => m.FetchDataEncryptionKeyAsync( + m => m.FetchDataEncryptionKeyWithoutRawKeyAsync( CosmosEncryptorTests.dekId, CosmosEncryptionAlgorithm.MdeAeadAes256CbcHmac256Randomized, It.IsAny()), Times.Exactly(2)); diff --git a/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj b/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj index 9fe41b765f..f58b171cd5 100644 --- a/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj +++ b/Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj @@ -12,7 +12,7 @@ $([System.DateTime]::Now.ToString(yyyyMMdd)) Microsoft Corporation Microsoft - This library provides an implementation for client-side encryption for Azure Cosmos's SQL API. For more information, refer to https://aka.ms/CosmosClientEncryption + This library provides an implementation for client-side encryption for Azure Cosmos DB for NoSQL. For more information, refer to https://aka.ms/CosmosClientEncryption © Microsoft Corporation. All rights reserved. Microsoft Azure Cosmos DB client-side encryption library Microsoft.Azure.Cosmos.Encryption diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/AppSettings.json b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/AppSettings.json new file mode 100644 index 0000000000..028030099b --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/AppSettings.json @@ -0,0 +1,5 @@ +{ + "CosmosDBEndPointUrl": "https://localhost:8081", + "CosmosDBAuthorizationKey": "Super secret key", + "ApplicationInsightsConnectionString": "Super secret connection string" +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj new file mode 100644 index 0000000000..59162abaca --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/ApplicationInsights.csproj @@ -0,0 +1,25 @@ + + + + Exe + net6.0 + Cosmos.Samples.ApplicationInsights + Cosmos.Samples.ApplicationInsights + latest + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs new file mode 100644 index 0000000000..288ce80c64 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/ApplicationInsights/Program.cs @@ -0,0 +1,118 @@ +namespace Cosmos.Samples.ApplicationInsights +{ + using System; + using System.Threading.Tasks; + using Newtonsoft.Json; + using Microsoft.Azure.Cosmos; + using Microsoft.Extensions.Logging; + using Microsoft.Extensions.Configuration; + using Microsoft.Extensions.DependencyInjection; + using Microsoft.ApplicationInsights; + using Microsoft.ApplicationInsights.WorkerService; + using Microsoft.Extensions.Logging.ApplicationInsights; + + internal class Program + { + private static readonly string databaseName = "samples"; + private static readonly string containerName = "ai-sample"; + + private static TelemetryClient? _telemetryClient; + + static async Task Main() + { + try + { + IConfigurationRoot configuration = new ConfigurationBuilder() + .AddJsonFile("AppSettings.json") + .Build(); + + string endpoint = configuration["CosmosDBEndPointUrl"]; + if (string.IsNullOrEmpty(endpoint)) + { + throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json"); + } + + string authKey = configuration["CosmosDBAuthorizationKey"]; + if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key")) + { + throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json"); + } + + string aiConnectionString = configuration["ApplicationInsightsConnectionString"]; + if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret connection string")) + { + throw new ArgumentException("Please specify a valid ApplicationInsightsConnectionString in the appSettings.json"); + } + + // + IServiceCollection services = new ServiceCollection(); + services.AddApplicationInsightsTelemetryWorkerService((ApplicationInsightsServiceOptions options) => options.ConnectionString = aiConnectionString); + + IServiceProvider serviceProvider = services.BuildServiceProvider(); + _telemetryClient = serviceProvider.GetRequiredService(); + // + + CosmosClientOptions options = new CosmosClientOptions() + { + IsDistributedTracingEnabled = true // Defaults to true, set to false to disable + }; + using (CosmosClient client = new CosmosClient(endpoint, authKey, options)) + { + Console.WriteLine($"Getting container reference for {containerName}."); + + ContainerProperties properties = new ContainerProperties(containerName, partitionKeyPath: "/id"); + + await client.CreateDatabaseIfNotExistsAsync(databaseName); + Container container = await client.GetDatabase(databaseName).CreateContainerIfNotExistsAsync(properties); + + await Program.RunCrudDemo(container); + } + } + finally + { + // Explicitly calling Flush() followed by sleep is required for Application Insights logging in console apps to ensure that telemetry is sent to the back-end even if application terminates. + _telemetryClient?.Flush(); + await Task.Delay(5000); + + Console.WriteLine("End of demo."); + } + } + + public static async Task RunCrudDemo(Container container) + { + // Any operations will automatically generate telemetry + + for (int i = 1; i <= 5; i++) + { + await container.CreateItemAsync(new Item { Id = $"{i}", Status = "new" }, new PartitionKey($"{i}")); + Console.WriteLine($"Created document with id: {i}"); + } + + for (int i = 1; i <= 5; i++) + { + await container.ReadItemAsync($"{i}", new PartitionKey($"{i}")); + Console.WriteLine($"Read document with id: {i}"); + } + + for (int i = 1; i <= 5; i++) + { + await container.ReplaceItemAsync(new Item { Id = $"{i}", Status = "updated" }, $"{i}", new PartitionKey($"{i}")); + Console.WriteLine($"Updated document with id: {i}"); + } + + for (int i = 1; i <= 5; i++) + { + await container.DeleteItemAsync($"{i}", new PartitionKey($"{i}")); + Console.WriteLine($"Deleted document with id: {i}"); + } + } + } + + internal class Item + { + [JsonProperty("id")] + public string Id { get; set; } + + public string Status { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/Cosmos.Samples.Usage.sln b/Microsoft.Azure.Cosmos.Samples/Usage/Cosmos.Samples.Usage.sln index de1e1f4731..999b48d928 100644 --- a/Microsoft.Azure.Cosmos.Samples/Usage/Cosmos.Samples.Usage.sln +++ b/Microsoft.Azure.Cosmos.Samples/Usage/Cosmos.Samples.Usage.sln @@ -51,6 +51,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CFPullModelAllVersionsAndDe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CFPullModelLatestVersionMode", "CFPullModelLatestVersionMode\CFPullModelLatestVersionMode.csproj", "{985B0E0A-D480-4C3C-A1FC-589F2EC4BBF6}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OpenTelemetry", "OpenTelemetry\OpenTelemetry.csproj", "{C6EF6948-C085-4013-A21F-99303ECBA7A9}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApplicationInsights", "ApplicationInsights\ApplicationInsights.csproj", "{55149A3C-A263-4EE5-AD2D-02FE9AC4D291}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -153,6 +157,14 @@ Global {985B0E0A-D480-4C3C-A1FC-589F2EC4BBF6}.Debug|Any CPU.Build.0 = Debug|Any CPU {985B0E0A-D480-4C3C-A1FC-589F2EC4BBF6}.Release|Any CPU.ActiveCfg = Release|Any CPU {985B0E0A-D480-4C3C-A1FC-589F2EC4BBF6}.Release|Any CPU.Build.0 = Release|Any CPU + {C6EF6948-C085-4013-A21F-99303ECBA7A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C6EF6948-C085-4013-A21F-99303ECBA7A9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C6EF6948-C085-4013-A21F-99303ECBA7A9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C6EF6948-C085-4013-A21F-99303ECBA7A9}.Release|Any CPU.Build.0 = Release|Any CPU + {55149A3C-A263-4EE5-AD2D-02FE9AC4D291}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55149A3C-A263-4EE5-AD2D-02FE9AC4D291}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55149A3C-A263-4EE5-AD2D-02FE9AC4D291}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55149A3C-A263-4EE5-AD2D-02FE9AC4D291}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/AppSettings.json b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/AppSettings.json new file mode 100644 index 0000000000..1ea1245434 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/AppSettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Azure-Cosmos-Operation-Request-Diagnostics": "Information" + } + }, + "CosmosDBEndPointUrl": "https://localhost:8081", + "CosmosDBAuthorizationKey": "Super secret key", + "ApplicationInsightsConnectionString": "Super secret connection string" +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj new file mode 100644 index 0000000000..46fe296b80 --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/OpenTelemetry.csproj @@ -0,0 +1,28 @@ + + + + Exe + net6.0 + Cosmos.Samples.OpenTelemetry + Cosmos.Samples.OpenTelemetry + latest + + + + + + + + + + + + + + + + PreserveNewest + + + + diff --git a/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs new file mode 100644 index 0000000000..4d6431823e --- /dev/null +++ b/Microsoft.Azure.Cosmos.Samples/Usage/OpenTelemetry/Program.cs @@ -0,0 +1,140 @@ +namespace Cosmos.Samples.OpenTelemetry +{ + using global::OpenTelemetry; + using global::OpenTelemetry.Trace; + using global::OpenTelemetry.Resources; + using System; + using System.Threading.Tasks; + using Newtonsoft.Json; + using Microsoft.Azure.Cosmos; + using Microsoft.Extensions.Azure; + using Microsoft.Extensions.Logging; + using Microsoft.Extensions.Configuration; + using Azure.Monitor.OpenTelemetry.Exporter; + + internal class Program + { + private static readonly string databaseName = "samples"; + private static readonly string containerName = "otel-sample"; + private static readonly string serviceName = "MySampleService"; + + private static TracerProvider? _traceProvider; + + static async Task Main() + { + try + { + IConfigurationRoot configuration = new ConfigurationBuilder() + .AddJsonFile("AppSettings.json") + .Build(); + + string endpoint = configuration["CosmosDBEndPointUrl"]; + if (string.IsNullOrEmpty(endpoint)) + { + throw new ArgumentNullException("Please specify a valid CosmosDBEndPointUrl in the appSettings.json"); + } + + string authKey = configuration["CosmosDBAuthorizationKey"]; + if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret key")) + { + throw new ArgumentException("Please specify a valid CosmosDBAuthorizationKey in the appSettings.json"); + } + + string aiConnectionString = configuration["ApplicationInsightsConnectionString"]; + if (string.IsNullOrEmpty(authKey) || string.Equals(authKey, "Super secret connection string")) + { + throw new ArgumentException("Please specify a valid ApplicationInsightsConnectionString in the appSettings.json"); + } + + // + ResourceBuilder resource = ResourceBuilder.CreateDefault().AddService( + serviceName: serviceName, + serviceVersion: "1.0.0"); + + // Set up logging to forward logs to chosen exporter + using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => builder.AddOpenTelemetry(options => + { + options.IncludeFormattedMessage = true; + options.SetResourceBuilder(resource); + options.AddAzureMonitorLogExporter(o => o.ConnectionString = aiConnectionString); // Set up exporter of your choice + })); + + AzureEventSourceLogForwarder logforwader = new AzureEventSourceLogForwarder(loggerFactory); + logforwader.Start(); + + // Configure OpenTelemetry trace provider + AppContext.SetSwitch("Azure.Experimental.EnableActivitySource", true); + _traceProvider = Sdk.CreateTracerProviderBuilder() + .AddSource("Azure.Cosmos.Operation") // Cosmos DB source for operation level telemetry + .AddAzureMonitorTraceExporter(o => o.ConnectionString = aiConnectionString) // Set up exporter of your choice + .SetResourceBuilder(resource) + .Build(); + // + + // + CosmosClientOptions options = new CosmosClientOptions() + { + IsDistributedTracingEnabled = true // Defaults to true, set to false to disable + }; + // + using (CosmosClient client = new CosmosClient(endpoint, authKey, options)) + { + Console.WriteLine($"Getting container reference for {containerName}."); + + ContainerProperties properties = new ContainerProperties(containerName, partitionKeyPath: "/id"); + + await client.CreateDatabaseIfNotExistsAsync(databaseName); + Container container = await client.GetDatabase(databaseName).CreateContainerIfNotExistsAsync(properties); + + await Program.RunCrudDemo(container); + } + + } + finally + { + _traceProvider?.Dispose(); + // Sleep is required for logging in console apps to ensure that telemetry is sent to the back-end even if application terminates. + await Task.Delay(5000); + + Console.WriteLine("End of demo."); + } + } + + public static async Task RunCrudDemo(Container container) + { + // Any operations will automatically generate telemetry + + for(int i = 1; i <= 5; i++) + { + await container.CreateItemAsync(new Item { Id = $"{i}", Status = "new" }, new PartitionKey($"{i}")); + Console.WriteLine($"Created document with id: {i}"); + } + + for (int i = 1; i <= 5; i++) + { + await container.ReadItemAsync($"{i}", new PartitionKey($"{i}")); + Console.WriteLine($"Read document with id: {i}"); + } + + for (int i = 1; i <= 5; i++) + { + await container.ReplaceItemAsync(new Item { Id = $"{i}", Status = "updated" }, $"{i}", new PartitionKey($"{i}")); + Console.WriteLine($"Updated document with id: {i}"); + } + + for (int i = 1; i <= 5; i++) + { + await container.DeleteItemAsync($"{i}", new PartitionKey($"{i}")); + Console.WriteLine($"Deleted document with id: {i}"); + } + } + } + + internal class Item + { + [JsonProperty("id")] + public string Id { get; set; } + + public string Status { get; set; } + } +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.32.3-preview.txt b/Microsoft.Azure.Cosmos/contracts/API_3.32.3-preview.txt new file mode 100644 index 0000000000..69b7a4b83e --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.32.3-preview.txt @@ -0,0 +1,1531 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItemChange + { + public ChangeFeedItemChange(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(DateTime conflictResolutionTimestamp, long lsn, ChangeFeedOperationType operationType, long previousLsn); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public abstract Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool IsDistributedTracingEnabled { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public IWebProxy WebProxy { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyCentral = "Germany Central"; + public const string GermanyNorth = "Germany North"; + public const string GermanyNortheast = "Germany Northeast"; + public const string GermanyWestCentral = "Germany West Central"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SouthIndia = "South India"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithDistributedTracing(bool isEnabled=true); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsPrimitive(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.32.3.txt b/Microsoft.Azure.Cosmos/contracts/API_3.32.3.txt new file mode 100644 index 0000000000..5218206b0e --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.32.3.txt @@ -0,0 +1,1478 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public IWebProxy WebProxy { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyCentral = "Germany Central"; + public const string GermanyNorth = "Germany North"; + public const string GermanyNortheast = "Germany Northeast"; + public const string GermanyWestCentral = "Germany West Central"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SouthIndia = "South India"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsPrimitive(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.33.0-preview.txt b/Microsoft.Azure.Cosmos/contracts/API_3.33.0-preview.txt new file mode 100644 index 0000000000..4b3c5c951e --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.33.0-preview.txt @@ -0,0 +1,1540 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public class ChangeFeedItemChange + { + public ChangeFeedItemChange(); + public T Current { get; set; } + public ChangeFeedMetadata Metadata { get; set; } + public T Previous { get; set; } + } + public class ChangeFeedMetadata + { + public ChangeFeedMetadata(DateTime conflictResolutionTimestamp, long lsn, ChangeFeedOperationType operationType, long previousLsn); + public DateTime ConflictResolutionTimestamp { get; } + public bool IsTimeToLiveExpired { get; } + public long Lsn { get; } + public ChangeFeedOperationType OperationType { get; } + public long PreviousLsn { get; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode AllVersionsAndDeletes { get; } + public static ChangeFeedMode Incremental { get; } + public static ChangeFeedMode LatestVersion { get; } + } + public enum ChangeFeedOperationType + { + Create = 0, + Delete = 2, + Replace = 1, + } + public sealed class ChangeFeedPolicy + { + public ChangeFeedPolicy(); + public static TimeSpan FullFidelityNoRetention { get; } + public TimeSpan FullFidelityRetention { get; set; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public abstract Task DeleteAllItemsByPartitionKeyStreamAsync(PartitionKey partitionKey, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> GetPartitionKeyRangesAsync(FeedRange feedRange, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ChangeFeedPolicy ChangeFeedPolicy { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool IsDistributedTracingEnabled { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public IWebProxy WebProxy { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public enum PriorityLevel + { + High = 1, + Low = 2, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyCentral = "Germany Central"; + public const string GermanyNorth = "Germany North"; + public const string GermanyNortheast = "Germany Northeast"; + public const string GermanyWestCentral = "Germany West Central"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SouthIndia = "South India"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public Nullable PriorityLevel { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public class ChangeFeedPolicyDefinition + { + public ContainerBuilder Attach(); + } + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ChangeFeedPolicyDefinition WithChangeFeedPolicy(TimeSpan retention); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithDistributedTracing(bool isEnabled=true); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsPrimitive(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query, IDictionary namedParameters); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/contracts/API_3.33.0.txt b/Microsoft.Azure.Cosmos/contracts/API_3.33.0.txt new file mode 100644 index 0000000000..af7ab6eef4 --- /dev/null +++ b/Microsoft.Azure.Cosmos/contracts/API_3.33.0.txt @@ -0,0 +1,1493 @@ +namespace Microsoft.Azure.Cosmos +{ + public class AccountConsistency + { + public AccountConsistency(); + public ConsistencyLevel DefaultConsistencyLevel { get; } + public int MaxStalenessIntervalInSeconds { get; } + public int MaxStalenessPrefix { get; } + } + public class AccountProperties + { + public AccountConsistency Consistency { get; } + public string ETag { get; } + public string Id { get; } + public IEnumerable ReadableRegions { get; } + public IEnumerable WritableRegions { get; } + } + public class AccountRegion + { + public AccountRegion(); + public string Endpoint { get; } + public string Name { get; } + } + public sealed class BoundingBoxProperties + { + public BoundingBoxProperties(); + public double Xmax { get; set; } + public double Xmin { get; set; } + public double Ymax { get; set; } + public double Ymin { get; set; } + } + public abstract class ChangeFeedEstimator + { + protected ChangeFeedEstimator(); + public abstract FeedIterator GetCurrentStateIterator(ChangeFeedEstimatorRequestOptions changeFeedEstimatorRequestOptions=null); + } + public sealed class ChangeFeedEstimatorRequestOptions + { + public ChangeFeedEstimatorRequestOptions(); + public Nullable MaxItemCount { get; set; } + } + public abstract class ChangeFeedMode + { + public static ChangeFeedMode Incremental { get; } + } + public abstract class ChangeFeedProcessor + { + protected ChangeFeedProcessor(); + public abstract Task StartAsync(); + public abstract Task StopAsync(); + } + public class ChangeFeedProcessorBuilder + { + public ChangeFeedProcessor Build(); + public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate); + public ChangeFeedProcessorBuilder WithInstanceName(string instanceName); + public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate); + public ChangeFeedProcessorBuilder WithLeaseConfiguration(Nullable acquireInterval=default(Nullable), Nullable expirationInterval=default(Nullable), Nullable renewInterval=default(Nullable)); + public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer); + public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate); + public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount); + public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval); + public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime); + } + public abstract class ChangeFeedProcessorContext + { + protected ChangeFeedProcessorContext(); + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract Headers Headers { get; } + public abstract string LeaseToken { get; } + } + public sealed class ChangeFeedProcessorState + { + public ChangeFeedProcessorState(string leaseToken, long estimatedLag, string instanceName); + public long EstimatedLag { get; } + public string InstanceName { get; } + public string LeaseToken { get; } + } + public class ChangeFeedProcessorUserException : Exception + { + public ChangeFeedProcessorUserException(Exception originalException, ChangeFeedProcessorContext context); + protected ChangeFeedProcessorUserException(SerializationInfo info, StreamingContext context); + public ChangeFeedProcessorContext ChangeFeedProcessorContext { get; } + public override void GetObjectData(SerializationInfo info, StreamingContext context); + } + public sealed class ChangeFeedRequestOptions : RequestOptions + { + public ChangeFeedRequestOptions(); + public new string IfMatchEtag { get; set; } + public new string IfNoneMatchEtag { get; set; } + public Nullable PageSizeHint { get; set; } + } + public abstract class ChangeFeedStartFrom + { + public static ChangeFeedStartFrom Beginning(); + public static ChangeFeedStartFrom Beginning(FeedRange feedRange); + public static ChangeFeedStartFrom ContinuationToken(string continuationToken); + public static ChangeFeedStartFrom Now(); + public static ChangeFeedStartFrom Now(FeedRange feedRange); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc); + public static ChangeFeedStartFrom Time(DateTime dateTimeUtc, FeedRange feedRange); + } + public sealed class ClientEncryptionIncludedPath + { + public ClientEncryptionIncludedPath(); + public string ClientEncryptionKeyId { get; set; } + public string EncryptionAlgorithm { get; set; } + public string EncryptionType { get; set; } + public string Path { get; set; } + } + public abstract class ClientEncryptionKey + { + protected ClientEncryptionKey(); + public abstract string Id { get; } + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class ClientEncryptionKeyProperties : IEquatable + { + protected ClientEncryptionKeyProperties(); + public ClientEncryptionKeyProperties(string id, string encryptionAlgorithm, byte[] wrappedDataEncryptionKey, EncryptionKeyWrapMetadata encryptionKeyWrapMetadata); + public Nullable CreatedTime { get; } + public string EncryptionAlgorithm { get; } + public EncryptionKeyWrapMetadata EncryptionKeyWrapMetadata { get; } + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public virtual string SelfLink { get; } + public byte[] WrappedDataEncryptionKey { get; } + public bool Equals(ClientEncryptionKeyProperties other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public class ClientEncryptionKeyResponse : Response + { + protected ClientEncryptionKeyResponse(); + public override string ActivityId { get; } + public virtual ClientEncryptionKey ClientEncryptionKey { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ClientEncryptionKeyProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ClientEncryptionKey (ClientEncryptionKeyResponse response); + } + public sealed class ClientEncryptionPolicy + { + public ClientEncryptionPolicy(IEnumerable includedPaths); + public ClientEncryptionPolicy(IEnumerable includedPaths, int policyFormatVersion); + public IEnumerable IncludedPaths { get; } + public int PolicyFormatVersion { get; } + } + public sealed class CompositePath + { + public CompositePath(); + public CompositePathSortOrder Order { get; set; } + public string Path { get; set; } + } + public enum CompositePathSortOrder + { + Ascending = 0, + Descending = 1, + } + public class ConflictProperties + { + public ConflictProperties(); + public string Id { get; } + public OperationKind OperationKind { get; } + public string SelfLink { get; } + } + public enum ConflictResolutionMode + { + Custom = 1, + LastWriterWins = 0, + } + public class ConflictResolutionPolicy + { + public ConflictResolutionPolicy(); + public ConflictResolutionMode Mode { get; set; } + public string ResolutionPath { get; set; } + public string ResolutionProcedure { get; set; } + } + public abstract class Conflicts + { + protected Conflicts(); + public abstract Task DeleteAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetConflictQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetConflictQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract T ReadConflictContent(ConflictProperties conflict); + public abstract Task> ReadCurrentAsync(ConflictProperties conflict, PartitionKey partitionKey, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum ConnectionMode + { + Direct = 1, + Gateway = 0, + } + public enum ConsistencyLevel + { + BoundedStaleness = 1, + ConsistentPrefix = 4, + Eventual = 3, + Session = 2, + Strong = 0, + } + public abstract class Container + { + protected Container(); + public abstract Conflicts Conflicts { get; } + public abstract Database Database { get; } + public abstract string Id { get; } + public abstract Scripts Scripts { get; } + public abstract Task> CreateItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch CreateTransactionalBatch(PartitionKey partitionKey); + public abstract Task DeleteContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> DeleteItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ChangeFeedEstimator GetChangeFeedEstimator(string processorName, Container leaseContainer); + public abstract ChangeFeedProcessorBuilder GetChangeFeedEstimatorBuilder(string processorName, Container.ChangesEstimationHandler estimationDelegate, Nullable estimationPeriod=default(Nullable)); + public abstract FeedIterator GetChangeFeedIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedStreamHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedStreamHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilderWithManualCheckpoint(string processorName, Container.ChangeFeedHandlerWithManualCheckpoint onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangeFeedHandler onChangesDelegate); + public abstract ChangeFeedProcessorBuilder GetChangeFeedProcessorBuilder(string processorName, Container.ChangesHandler onChangesDelegate); + public abstract FeedIterator GetChangeFeedStreamIterator(ChangeFeedStartFrom changeFeedStartFrom, ChangeFeedMode changeFeedMode, ChangeFeedRequestOptions changeFeedRequestOptions=null); + public abstract Task> GetFeedRangesAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract IOrderedQueryable GetItemLinqQueryable(bool allowSynchronousQueryExecution=false, string continuationToken=null, QueryRequestOptions requestOptions=null, CosmosLinqSerializerOptions linqSerializerOptions=null); + public abstract FeedIterator GetItemQueryIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(FeedRange feedRange, QueryDefinition queryDefinition, string continuationToken, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetItemQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task> PatchItemAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task PatchItemStreamAsync(string id, PartitionKey partitionKey, IReadOnlyList patchOperations, PatchItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadContainerStreamAsync(ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadItemAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadItemStreamAsync(string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadManyItemsAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadManyItemsStreamAsync(IReadOnlyList> items, ReadManyRequestOptions readManyRequestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceContainerStreamAsync(ContainerProperties containerProperties, ContainerRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReplaceItemAsync(T item, string id, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceItemStreamAsync(Stream streamPayload, string id, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> UpsertItemAsync(T item, Nullable partitionKey=default(Nullable), ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertItemStreamAsync(Stream streamPayload, PartitionKey partitionKey, ItemRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public delegate Task ChangeFeedHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, IReadOnlyCollection changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangeFeedHandler(ChangeFeedProcessorContext context, IReadOnlyCollection changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedMonitorErrorDelegate(string leaseToken, Exception exception); + public delegate Task ChangeFeedMonitorLeaseAcquireDelegate(string leaseToken); + public delegate Task ChangeFeedMonitorLeaseReleaseDelegate(string leaseToken); + public delegate Task ChangeFeedStreamHandler(ChangeFeedProcessorContext context, Stream changes, CancellationToken cancellationToken); + public delegate Task ChangeFeedStreamHandlerWithManualCheckpoint(ChangeFeedProcessorContext context, Stream changes, Func checkpointAsync, CancellationToken cancellationToken); + public delegate Task ChangesEstimationHandler(long estimatedPendingChanges, CancellationToken cancellationToken); + public delegate Task ChangesHandler(IReadOnlyCollection changes, CancellationToken cancellationToken); + } + public class ContainerProperties + { + public ContainerProperties(); + public ContainerProperties(string id, IReadOnlyList partitionKeyPaths); + public ContainerProperties(string id, string partitionKeyPath); + public Nullable AnalyticalStoreTimeToLiveInSeconds { get; set; } + public ClientEncryptionPolicy ClientEncryptionPolicy { get; set; } + public ConflictResolutionPolicy ConflictResolutionPolicy { get; set; } + public Nullable DefaultTimeToLive { get; set; } + public string ETag { get; } + public GeospatialConfig GeospatialConfig { get; set; } + public string Id { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public Nullable LastModified { get; } + public Nullable PartitionKeyDefinitionVersion { get; set; } + public string PartitionKeyPath { get; set; } + public IReadOnlyList PartitionKeyPaths { get; set; } + public string SelfLink { get; } + public string TimeToLivePropertyPath { get; set; } + public UniqueKeyPolicy UniqueKeyPolicy { get; set; } + } + public class ContainerRequestOptions : RequestOptions + { + public ContainerRequestOptions(); + public bool PopulateQuotaInfo { get; set; } + } + public class ContainerResponse : Response + { + protected ContainerResponse(); + public override string ActivityId { get; } + public virtual Container Container { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override ContainerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Container (ContainerResponse response); + } + public class CosmosClient : IDisposable + { + protected CosmosClient(); + public CosmosClient(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, TokenCredential tokenCredential, CosmosClientOptions clientOptions=null); + public CosmosClient(string connectionString, CosmosClientOptions clientOptions=null); + public CosmosClient(string accountEndpoint, string authKeyOrResourceToken, CosmosClientOptions clientOptions=null); + public virtual CosmosClientOptions ClientOptions { get; } + public virtual Uri Endpoint { get; } + public virtual CosmosResponseFactory ResponseFactory { get; } + public static Task CreateAndInitializeAsync(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, TokenCredential tokenCredential, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string connectionString, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public static Task CreateAndInitializeAsync(string accountEndpoint, string authKeyOrResourceToken, IReadOnlyList> containers, CosmosClientOptions cosmosClientOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseIfNotExistsAsync(string id, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public virtual Task CreateDatabaseStreamAsync(DatabaseProperties databaseProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual Container GetContainer(string databaseId, string containerId); + public virtual Database GetDatabase(string id); + public virtual FeedIterator GetDatabaseQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual FeedIterator GetDatabaseQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public virtual Task ReadAccountAsync(); + } + public class CosmosClientOptions + { + public CosmosClientOptions(); + public bool AllowBulkExecution { get; set; } + public string ApplicationName { get; set; } + public IReadOnlyList ApplicationPreferredRegions { get; set; } + public string ApplicationRegion { get; set; } + public ConnectionMode ConnectionMode { get; set; } + public Nullable ConsistencyLevel { get; set; } + public Collection CustomHandlers { get; } + public Nullable EnableContentResponseOnWrite { get; set; } + public bool EnableTcpConnectionEndpointRediscovery { get; set; } + public int GatewayModeMaxConnectionLimit { get; set; } + public Func HttpClientFactory { get; set; } + public Nullable IdleTcpConnectionTimeout { get; set; } + public bool LimitToEndpoint { get; set; } + public Nullable MaxRequestsPerTcpConnection { get; set; } + public Nullable MaxRetryAttemptsOnRateLimitedRequests { get; set; } + public Nullable MaxRetryWaitTimeOnRateLimitedRequests { get; set; } + public Nullable MaxTcpConnectionsPerEndpoint { get; set; } + public Nullable OpenTcpConnectionTimeout { get; set; } + public Nullable PortReuseMode { get; set; } + public TimeSpan RequestTimeout { get; set; } + public CosmosSerializer Serializer { get; set; } + public CosmosSerializationOptions SerializerOptions { get; set; } + public Func ServerCertificateCustomValidationCallback { get; set; } + public Nullable TokenCredentialBackgroundRefreshInterval { get; set; } + public IWebProxy WebProxy { get; set; } + } + public abstract class CosmosDiagnostics + { + protected CosmosDiagnostics(); + public virtual TimeSpan GetClientElapsedTime(); + public abstract IReadOnlyList> GetContactedRegions(); + public virtual int GetFailedRequestCount(); + public virtual Nullable GetStartTimeUtc(); + public abstract override string ToString(); + } + public class CosmosException : Exception + { + public CosmosException(string message, HttpStatusCode statusCode, int subStatusCode, string activityId, double requestCharge); + public virtual string ActivityId { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual Headers Headers { get; } + public override string Message { get; } + public virtual double RequestCharge { get; } + public virtual string ResponseBody { get; } + public virtual Nullable RetryAfter { get; } + public override string StackTrace { get; } + public virtual HttpStatusCode StatusCode { get; } + public virtual int SubStatusCode { get; } + public override string ToString(); + public virtual bool TryGetHeader(string headerName, out string value); + } + public sealed class CosmosLinqSerializerOptions + { + public CosmosLinqSerializerOptions(); + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public class CosmosOperationCanceledException : OperationCanceledException + { + public CosmosOperationCanceledException(OperationCanceledException originalException, CosmosDiagnostics diagnostics); + protected CosmosOperationCanceledException(SerializationInfo info, StreamingContext context); + public override IDictionary Data { get; } + public CosmosDiagnostics Diagnostics { get; } + public override string HelpLink { get; set; } + public override string Message { get; } + public override string Source { get; set; } + public override string StackTrace { get; } + public override Exception GetBaseException(); + public override void GetObjectData(SerializationInfo info, StreamingContext context); + public override string ToString(); + } + public enum CosmosPropertyNamingPolicy + { + CamelCase = 1, + Default = 0, + } + public abstract class CosmosResponseFactory + { + protected CosmosResponseFactory(); + public abstract FeedResponse CreateItemFeedResponse(ResponseMessage responseMessage); + public abstract ItemResponse CreateItemResponse(ResponseMessage responseMessage); + public abstract StoredProcedureExecuteResponse CreateStoredProcedureExecuteResponse(ResponseMessage responseMessage); + } + public sealed class CosmosSerializationOptions + { + public CosmosSerializationOptions(); + public bool IgnoreNullValues { get; set; } + public bool Indented { get; set; } + public CosmosPropertyNamingPolicy PropertyNamingPolicy { get; set; } + } + public abstract class CosmosSerializer + { + protected CosmosSerializer(); + public abstract T FromStream(Stream stream); + public abstract Stream ToStream(T input); + } + public abstract class Database + { + protected Database(); + public abstract CosmosClient Client { get; } + public abstract string Id { get; } + public abstract Task CreateClientEncryptionKeyAsync(ClientEncryptionKeyProperties clientEncryptionKeyProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerIfNotExistsAsync(string id, string partitionKeyPath, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateContainerStreamAsync(ContainerProperties containerProperties, Nullable throughput=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ContainerBuilder DefineContainer(string name, string partitionKeyPath); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract ClientEncryptionKey GetClientEncryptionKey(string id); + public abstract FeedIterator GetClientEncryptionKeyQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Container GetContainer(string id); + public abstract FeedIterator GetContainerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetContainerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract User GetUser(string id); + public abstract FeedIterator GetUserQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadStreamAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadThroughputAsync(RequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ReadThroughputAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(ThroughputProperties throughputProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceThroughputAsync(int throughput, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertUserAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class DatabaseProperties + { + public DatabaseProperties(); + public DatabaseProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class DatabaseResponse : Response + { + protected DatabaseResponse(); + public override string ActivityId { get; } + public virtual Database Database { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override DatabaseProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Database (DatabaseResponse response); + } + public enum DataType + { + LineString = 3, + MultiPolygon = 5, + Number = 0, + Point = 2, + Polygon = 4, + String = 1, + } + public class DedicatedGatewayRequestOptions + { + public DedicatedGatewayRequestOptions(); + public Nullable MaxIntegratedCacheStaleness { get; set; } + } + public class EncryptionKeyWrapMetadata : IEquatable + { + public EncryptionKeyWrapMetadata(EncryptionKeyWrapMetadata source); + public EncryptionKeyWrapMetadata(string type, string name, string value, string algorithm); + public string Algorithm { get; } + public string Name { get; } + public string Type { get; } + public string Value { get; } + public bool Equals(EncryptionKeyWrapMetadata other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class ExcludedPath + { + public ExcludedPath(); + public string Path { get; set; } + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedIterator : IDisposable + { + protected FeedIterator(); + public abstract bool HasMoreResults { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public abstract Task> ReadNextAsync(CancellationToken cancellationToken=default(CancellationToken)); + } + public abstract class FeedRange + { + protected FeedRange(); + public static FeedRange FromJsonString(string toStringValue); + public static FeedRange FromPartitionKey(PartitionKey partitionKey); + public abstract string ToJsonString(); + } + public abstract class FeedResponse : IEnumerable, IEnumerable + { + protected FeedResponse(); + public override string ActivityId { get; } + public abstract string ContinuationToken { get; } + public abstract int Count { get; } + public override string ETag { get; } + public abstract string IndexMetrics { get; } + public override double RequestCharge { get; } + public abstract IEnumerator GetEnumerator(); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public sealed class GeospatialConfig + { + public GeospatialConfig(); + public GeospatialConfig(GeospatialType geospatialType); + public GeospatialType GeospatialType { get; set; } + } + public enum GeospatialType + { + Geography = 0, + Geometry = 1, + } + public class Headers : IEnumerable + { + public Headers(); + public virtual string ActivityId { get; } + public virtual string ContentLength { get; set; } + public virtual string ContentType { get; } + public virtual string ContinuationToken { get; } + public virtual string ETag { get; } + public virtual string this[string headerName] { get; set; } + public virtual string Location { get; } + public virtual double RequestCharge { get; } + public virtual string Session { get; } + public virtual void Add(string headerName, IEnumerable values); + public virtual void Add(string headerName, string value); + public virtual string[] AllKeys(); + public virtual string Get(string headerName); + public virtual IEnumerator GetEnumerator(); + public virtual T GetHeaderValue(string headerName); + public virtual string GetValueOrDefault(string headerName); + public virtual void Remove(string headerName); + public virtual void Set(string headerName, string value); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + public virtual bool TryGetValue(string headerName, out string value); + } + public sealed class IncludedPath + { + public IncludedPath(); + public string Path { get; set; } + } + public enum IndexingDirective + { + Default = 0, + Exclude = 2, + Include = 1, + } + public enum IndexingMode + { + Consistent = 0, + Lazy = 1, + None = 2, + } + public sealed class IndexingPolicy + { + public IndexingPolicy(); + public bool Automatic { get; set; } + public Collection> CompositeIndexes { get; } + public Collection ExcludedPaths { get; } + public Collection IncludedPaths { get; } + public IndexingMode IndexingMode { get; set; } + public Collection SpatialIndexes { get; } + } + public enum IndexKind + { + Hash = 0, + Range = 1, + Spatial = 2, + } + public class ItemRequestOptions : RequestOptions + { + public ItemRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + public IEnumerable PostTriggers { get; set; } + public IEnumerable PreTriggers { get; set; } + public string SessionToken { get; set; } + } + public class ItemResponse : Response + { + protected ItemResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public override HttpStatusCode StatusCode { get; } + } + public enum OperationKind + { + Create = 1, + Delete = 3, + Invalid = 0, + Read = 4, + Replace = 2, + } + public struct PartitionKey : IEquatable + { + public static readonly PartitionKey None; + public static readonly PartitionKey Null; + public static readonly string SystemKeyName; + public static readonly string SystemKeyPath; + public PartitionKey(bool partitionKeyValue); + public PartitionKey(double partitionKeyValue); + public PartitionKey(string partitionKeyValue); + public bool Equals(PartitionKey other); + public override bool Equals(object obj); + public override int GetHashCode(); + public static bool operator ==(PartitionKey left, PartitionKey right); + public static bool operator !=(PartitionKey left, PartitionKey right); + public override string ToString(); + } + public sealed class PartitionKeyBuilder + { + public PartitionKeyBuilder(); + public PartitionKeyBuilder Add(bool val); + public PartitionKeyBuilder Add(double val); + public PartitionKeyBuilder Add(string val); + public PartitionKeyBuilder AddNoneType(); + public PartitionKeyBuilder AddNullValue(); + public PartitionKey Build(); + } + public enum PartitionKeyDefinitionVersion + { + V1 = 1, + V2 = 2, + } + public sealed class PatchItemRequestOptions : ItemRequestOptions + { + public PatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public abstract class PatchOperation + { + protected PatchOperation(); + public virtual string From { get; set; } + public abstract PatchOperationType OperationType { get; } + public abstract string Path { get; } + public static PatchOperation Add(string path, T value); + public static PatchOperation Increment(string path, double value); + public static PatchOperation Increment(string path, long value); + public static PatchOperation Move(string from, string path); + public static PatchOperation Remove(string path); + public static PatchOperation Replace(string path, T value); + public static PatchOperation Set(string path, T value); + public virtual bool TrySerializeValueParameter(CosmosSerializer cosmosSerializer, out Stream valueParam); + } + public enum PatchOperationType + { + Add = 0, + Increment = 4, + Move = 5, + Remove = 1, + Replace = 2, + Set = 3, + } + public abstract class PatchOperation : PatchOperation + { + protected PatchOperation(); + public abstract T Value { get; } + } + public abstract class Permission + { + protected Permission(); + public abstract string Id { get; } + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadAsync(Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public enum PermissionMode : byte + { + All = (byte)2, + Read = (byte)1, + } + public class PermissionProperties + { + public PermissionProperties(string id, PermissionMode permissionMode, Container container, PartitionKey resourcePartitionKey, string itemId); + public PermissionProperties(string id, PermissionMode permissionMode, Container container, Nullable resourcePartitionKey=default(Nullable)); + public string ETag { get; } + public string Id { get; } + public Nullable LastModified { get; } + public PermissionMode PermissionMode { get; } + public Nullable ResourcePartitionKey { get; set; } + public string ResourceUri { get; } + public string SelfLink { get; } + public string Token { get; } + } + public class PermissionResponse : Response + { + protected PermissionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public virtual Permission Permission { get; } + public override double RequestCharge { get; } + public override PermissionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator Permission (PermissionResponse response); + } + public enum PortReuseMode + { + PrivatePortPool = 1, + ReuseUnicastPort = 0, + } + public class QueryDefinition + { + public QueryDefinition(string query); + public string QueryText { get; } + public IReadOnlyList> GetQueryParameters(); + public QueryDefinition WithParameter(string name, object value); + public QueryDefinition WithParameterStream(string name, Stream valueStream); + } + public class QueryRequestOptions : RequestOptions + { + public QueryRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public DedicatedGatewayRequestOptions DedicatedGatewayRequestOptions { get; set; } + public Nullable EnableLowPrecisionOrderBy { get; set; } + public Nullable EnableScanInQuery { get; set; } + public Nullable MaxBufferedItemCount { get; set; } + public Nullable MaxConcurrency { get; set; } + public Nullable MaxItemCount { get; set; } + public Nullable PartitionKey { get; set; } + public Nullable PopulateIndexMetrics { get; set; } + public Nullable ResponseContinuationTokenLimitInKb { get; set; } + public string SessionToken { get; set; } + } + public class ReadManyRequestOptions : RequestOptions + { + public ReadManyRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public static class Regions + { + public const string AustraliaCentral = "Australia Central"; + public const string AustraliaCentral2 = "Australia Central 2"; + public const string AustraliaEast = "Australia East"; + public const string AustraliaSoutheast = "Australia Southeast"; + public const string BrazilSouth = "Brazil South"; + public const string BrazilSoutheast = "Brazil Southeast"; + public const string CanadaCentral = "Canada Central"; + public const string CanadaEast = "Canada East"; + public const string CentralIndia = "Central India"; + public const string CentralUS = "Central US"; + public const string CentralUSEUAP = "Central US EUAP"; + public const string ChinaEast = "China East"; + public const string ChinaEast2 = "China East 2"; + public const string ChinaEast3 = "China East 3"; + public const string ChinaNorth = "China North"; + public const string ChinaNorth2 = "China North 2"; + public const string ChinaNorth3 = "China North 3"; + public const string EastAsia = "East Asia"; + public const string EastUS = "East US"; + public const string EastUS2 = "East US 2"; + public const string EastUS2EUAP = "East US 2 EUAP"; + public const string EastUSSLV = "East US SLV"; + public const string FranceCentral = "France Central"; + public const string FranceSouth = "France South"; + public const string GermanyCentral = "Germany Central"; + public const string GermanyNorth = "Germany North"; + public const string GermanyNortheast = "Germany Northeast"; + public const string GermanyWestCentral = "Germany West Central"; + public const string JapanEast = "Japan East"; + public const string JapanWest = "Japan West"; + public const string JioIndiaCentral = "Jio India Central"; + public const string JioIndiaWest = "Jio India West"; + public const string KoreaCentral = "Korea Central"; + public const string KoreaSouth = "Korea South"; + public const string NorthCentralUS = "North Central US"; + public const string NorthEurope = "North Europe"; + public const string NorwayEast = "Norway East"; + public const string NorwayWest = "Norway West"; + public const string PolandCentral = "Poland Central"; + public const string QatarCentral = "Qatar Central"; + public const string SouthAfricaNorth = "South Africa North"; + public const string SouthAfricaWest = "South Africa West"; + public const string SouthCentralUS = "South Central US"; + public const string SoutheastAsia = "Southeast Asia"; + public const string SouthIndia = "South India"; + public const string SwedenCentral = "Sweden Central"; + public const string SwedenSouth = "Sweden South"; + public const string SwitzerlandNorth = "Switzerland North"; + public const string SwitzerlandWest = "Switzerland West"; + public const string UAECentral = "UAE Central"; + public const string UAENorth = "UAE North"; + public const string UKSouth = "UK South"; + public const string UKWest = "UK West"; + public const string USDoDCentral = "USDoD Central"; + public const string USDoDEast = "USDoD East"; + public const string USGovArizona = "USGov Arizona"; + public const string USGovTexas = "USGov Texas"; + public const string USGovVirginia = "USGov Virginia"; + public const string USNatEast = "USNat East"; + public const string USNatWest = "USNat West"; + public const string USSecEast = "USSec East"; + public const string USSecWest = "USSec West"; + public const string WestCentralUS = "West Central US"; + public const string WestEurope = "West Europe"; + public const string WestIndia = "West India"; + public const string WestUS = "West US"; + public const string WestUS2 = "West US 2"; + public const string WestUS3 = "West US 3"; + } + public abstract class RequestHandler + { + protected RequestHandler(); + public RequestHandler InnerHandler { get; set; } + public virtual Task SendAsync(RequestMessage request, CancellationToken cancellationToken); + } + public class RequestMessage : IDisposable + { + public RequestMessage(); + public RequestMessage(HttpMethod method, Uri requestUri); + public virtual Stream Content { get; set; } + public virtual Headers Headers { get; } + public virtual HttpMethod Method { get; } + public virtual Dictionary Properties { get; } + public virtual Uri RequestUri { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + } + public class RequestOptions + { + public RequestOptions(); + public Action AddRequestHeaders { get; set; } + public string IfMatchEtag { get; set; } + public string IfNoneMatchEtag { get; set; } + public IReadOnlyDictionary Properties { get; set; } + public RequestOptions ShallowCopy(); + } + public class ResponseMessage : IDisposable + { + public ResponseMessage(); + public ResponseMessage(HttpStatusCode statusCode, RequestMessage requestMessage=null, string errorMessage=null); + public virtual Stream Content { get; set; } + public virtual string ContinuationToken { get; } + public virtual CosmosDiagnostics Diagnostics { get; set; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public string IndexMetrics { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual RequestMessage RequestMessage { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual ResponseMessage EnsureSuccessStatusCode(); + } + public abstract class Response + { + protected Response(); + public abstract string ActivityId { get; } + public abstract CosmosDiagnostics Diagnostics { get; } + public abstract string ETag { get; } + public abstract Headers Headers { get; } + public abstract double RequestCharge { get; } + public abstract T Resource { get; } + public abstract HttpStatusCode StatusCode { get; } + public static implicit operator T (Response response); + } + public sealed class SpatialPath + { + public SpatialPath(); + public BoundingBoxProperties BoundingBox { get; set; } + public string Path { get; set; } + public Collection SpatialTypes { get; } + } + public enum SpatialType + { + LineString = 1, + MultiPolygon = 3, + Point = 0, + Polygon = 2, + } + public class ThroughputProperties + { + public Nullable AutoscaleMaxThroughput { get; } + public string ETag { get; } + public Nullable LastModified { get; } + public string SelfLink { get; } + public Nullable Throughput { get; } + public static ThroughputProperties CreateAutoscaleThroughput(int autoscaleMaxThroughput); + public static ThroughputProperties CreateManualThroughput(int throughput); + } + public class ThroughputResponse : Response + { + protected ThroughputResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public Nullable IsReplacePending { get; } + public Nullable MinThroughput { get; } + public override double RequestCharge { get; } + public override ThroughputProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator ThroughputProperties (ThroughputResponse response); + } + public abstract class TransactionalBatch + { + protected TransactionalBatch(); + public abstract TransactionalBatch CreateItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch CreateItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch DeleteItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract Task ExecuteAsync(TransactionalBatchRequestOptions requestOptions, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteAsync(CancellationToken cancellationToken=default(CancellationToken)); + public abstract TransactionalBatch PatchItem(string id, IReadOnlyList patchOperations, TransactionalBatchPatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReadItem(string id, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItemStream(string id, Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch ReplaceItem(string id, T item, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItemStream(Stream streamPayload, TransactionalBatchItemRequestOptions requestOptions=null); + public abstract TransactionalBatch UpsertItem(T item, TransactionalBatchItemRequestOptions requestOptions=null); + } + public class TransactionalBatchItemRequestOptions : RequestOptions + { + public TransactionalBatchItemRequestOptions(); + public Nullable EnableContentResponseOnWrite { get; set; } + public Nullable IndexingDirective { get; set; } + } + public class TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual string ETag { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual Stream ResourceStream { get; } + public virtual TimeSpan RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + } + public class TransactionalBatchOperationResult : TransactionalBatchOperationResult + { + protected TransactionalBatchOperationResult(); + public virtual T Resource { get; set; } + } + public class TransactionalBatchPatchItemRequestOptions : TransactionalBatchItemRequestOptions + { + public TransactionalBatchPatchItemRequestOptions(); + public string FilterPredicate { get; set; } + } + public class TransactionalBatchRequestOptions : RequestOptions + { + public TransactionalBatchRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public string SessionToken { get; set; } + } + public class TransactionalBatchResponse : IDisposable, IEnumerable, IEnumerable, IReadOnlyCollection, IReadOnlyList + { + protected TransactionalBatchResponse(); + public virtual string ActivityId { get; } + public virtual int Count { get; } + public virtual CosmosDiagnostics Diagnostics { get; } + public virtual string ErrorMessage { get; } + public virtual Headers Headers { get; } + public virtual bool IsSuccessStatusCode { get; } + public virtual TransactionalBatchOperationResult this[int index] { get; } + public virtual double RequestCharge { get; } + public virtual Nullable RetryAfter { get; } + public virtual HttpStatusCode StatusCode { get; } + public void Dispose(); + protected virtual void Dispose(bool disposing); + public virtual IEnumerator GetEnumerator(); + public virtual TransactionalBatchOperationResult GetOperationResultAtIndex(int index); + IEnumerator System.Collections.IEnumerable.GetEnumerator(); + } + public class UniqueKey + { + public UniqueKey(); + public Collection Paths { get; } + } + public sealed class UniqueKeyPolicy + { + public UniqueKeyPolicy(); + public Collection UniqueKeys { get; } + } + public abstract class User + { + protected User(); + public abstract string Id { get; } + public abstract Task CreatePermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Permission GetPermission(string id); + public abstract FeedIterator GetPermissionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetPermissionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadAsync(RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceAsync(UserProperties userProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task UpsertPermissionAsync(PermissionProperties permissionProperties, Nullable tokenExpiryInSeconds=default(Nullable), RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class UserProperties + { + protected UserProperties(); + public UserProperties(string id); + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class UserResponse : Response + { + protected UserResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public virtual User User { get; } + public static implicit operator User (UserResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Fluent +{ + public sealed class ClientEncryptionPolicyDefinition + { + public ContainerBuilder Attach(); + public ClientEncryptionPolicyDefinition WithIncludedPath(ClientEncryptionIncludedPath path); + } + public class CompositeIndexDefinition + { + public T Attach(); + public CompositeIndexDefinition Path(string path); + public CompositeIndexDefinition Path(string path, CompositePathSortOrder sortOrder); + } + public class ConflictResolutionDefinition + { + public ContainerBuilder Attach(); + public ConflictResolutionDefinition WithCustomStoredProcedureResolution(string conflictResolutionProcedure); + public ConflictResolutionDefinition WithLastWriterWinsResolution(string conflictResolutionPath); + } + public class ContainerBuilder : ContainerDefinition + { + protected ContainerBuilder(); + public ContainerBuilder(Database database, string name, string partitionKeyPath); + public new ContainerProperties Build(); + public Task CreateAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(ThroughputProperties throughputProperties, CancellationToken cancellationToken=default(CancellationToken)); + public Task CreateIfNotExistsAsync(Nullable throughput=default(Nullable), CancellationToken cancellationToken=default(CancellationToken)); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(); + public ClientEncryptionPolicyDefinition WithClientEncryptionPolicy(int policyFormatVersion); + public ConflictResolutionDefinition WithConflictResolution(); + public UniqueKeyDefinition WithUniqueKey(); + } + public abstract class ContainerDefinition where T : ContainerDefinition + { + public ContainerDefinition(); + public ContainerProperties Build(); + public T WithDefaultTimeToLive(int defaultTtlInSeconds); + public T WithDefaultTimeToLive(TimeSpan defaultTtlTimeSpan); + public IndexingPolicyDefinition WithIndexingPolicy(); + public T WithPartitionKeyDefinitionVersion(PartitionKeyDefinitionVersion partitionKeyDefinitionVersion); + public T WithTimeToLivePropertyPath(string propertyPath); + } + public class CosmosClientBuilder + { + public CosmosClientBuilder(string connectionString); + public CosmosClientBuilder(string accountEndpoint, AzureKeyCredential authKeyOrResourceTokenCredential); + public CosmosClientBuilder(string accountEndpoint, TokenCredential tokenCredential); + public CosmosClientBuilder(string accountEndpoint, string authKeyOrResourceToken); + public CosmosClientBuilder AddCustomHandlers(params RequestHandler[] customHandlers); + public CosmosClient Build(); + public Task BuildAndInitializeAsync(IReadOnlyList> containers, CancellationToken cancellationToken=default(CancellationToken)); + public CosmosClientBuilder WithApplicationName(string applicationName); + public CosmosClientBuilder WithApplicationPreferredRegions(IReadOnlyList applicationPreferredRegions); + public CosmosClientBuilder WithApplicationRegion(string applicationRegion); + public CosmosClientBuilder WithBulkExecution(bool enabled); + public CosmosClientBuilder WithConnectionModeDirect(); + public CosmosClientBuilder WithConnectionModeDirect(Nullable idleTcpConnectionTimeout=default(Nullable), Nullable openTcpConnectionTimeout=default(Nullable), Nullable maxRequestsPerTcpConnection=default(Nullable), Nullable maxTcpConnectionsPerEndpoint=default(Nullable), Nullable portReuseMode=default(Nullable), Nullable enableTcpConnectionEndpointRediscovery=default(Nullable)); + public CosmosClientBuilder WithConnectionModeGateway(Nullable maxConnectionLimit=default(Nullable), IWebProxy webProxy=null); + public CosmosClientBuilder WithConsistencyLevel(ConsistencyLevel consistencyLevel); + public CosmosClientBuilder WithContentResponseOnWrite(bool contentResponseOnWrite); + public CosmosClientBuilder WithCustomSerializer(CosmosSerializer cosmosJsonSerializer); + public CosmosClientBuilder WithHttpClientFactory(Func httpClientFactory); + public CosmosClientBuilder WithLimitToEndpoint(bool limitToEndpoint); + public CosmosClientBuilder WithRequestTimeout(TimeSpan requestTimeout); + public CosmosClientBuilder WithSerializerOptions(CosmosSerializationOptions cosmosSerializerOptions); + public CosmosClientBuilder WithThrottlingRetryOptions(TimeSpan maxRetryWaitTimeOnThrottledRequests, int maxRetryAttemptsOnThrottledRequests); + } + public class IndexingPolicyDefinition + { + public IndexingPolicyDefinition(); + public T Attach(); + public IndexingPolicyDefinition WithAutomaticIndexing(bool enabled); + public CompositeIndexDefinition> WithCompositeIndex(); + public PathsDefinition> WithExcludedPaths(); + public PathsDefinition> WithIncludedPaths(); + public IndexingPolicyDefinition WithIndexingMode(IndexingMode indexingMode); + public SpatialIndexDefinition> WithSpatialIndex(); + } + public class PathsDefinition + { + public T Attach(); + public PathsDefinition Path(string path); + } + public class SpatialIndexDefinition + { + public T Attach(); + public SpatialIndexDefinition Path(string path); + public SpatialIndexDefinition Path(string path, params SpatialType[] spatialTypes); + } + public class UniqueKeyDefinition + { + public ContainerBuilder Attach(); + public UniqueKeyDefinition Path(string path); + } +} +namespace Microsoft.Azure.Cosmos.Linq +{ + public static class CosmosLinq + { + public static object InvokeUserDefinedFunction(string udfName, params object[] arguments); + } + public static class CosmosLinqExtensions + { + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> AverageAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> AverageAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> CountAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static bool IsDefined(this object obj); + public static bool IsNull(this object obj); + public static bool IsPrimitive(this object obj); + public static Task> MaxAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> MinAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task>> SumAsync(this IQueryable> source, CancellationToken cancellationToken=default(CancellationToken)); + public static Task> SumAsync(this IQueryable source, CancellationToken cancellationToken=default(CancellationToken)); + public static FeedIterator ToFeedIterator(this IQueryable query); + public static QueryDefinition ToQueryDefinition(this IQueryable query); + public static FeedIterator ToStreamIterator(this IQueryable query); + } +} +namespace Microsoft.Azure.Cosmos.Scripts +{ + public abstract class Scripts + { + protected Scripts(); + public abstract Task CreateStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task CreateUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task DeleteUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task> ExecuteStoredProcedureAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, PartitionKey partitionKey, dynamic parameters, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ExecuteStoredProcedureStreamAsync(string storedProcedureId, Stream streamPayload, PartitionKey partitionKey, StoredProcedureRequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract FeedIterator GetStoredProcedureQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetStoredProcedureQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetTriggerQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(QueryDefinition queryDefinition, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract FeedIterator GetUserDefinedFunctionQueryStreamIterator(string queryText=null, string continuationToken=null, QueryRequestOptions requestOptions=null); + public abstract Task ReadStoredProcedureAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadTriggerAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReadUserDefinedFunctionAsync(string id, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceStoredProcedureAsync(StoredProcedureProperties storedProcedureProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceTriggerAsync(TriggerProperties triggerProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + public abstract Task ReplaceUserDefinedFunctionAsync(UserDefinedFunctionProperties userDefinedFunctionProperties, RequestOptions requestOptions=null, CancellationToken cancellationToken=default(CancellationToken)); + } + public class StoredProcedureExecuteResponse : Response + { + protected StoredProcedureExecuteResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override T Resource { get; } + public virtual string ScriptLog { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + } + public class StoredProcedureProperties + { + public StoredProcedureProperties(); + public StoredProcedureProperties(string id, string body); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public Nullable LastModified { get; } + public string SelfLink { get; } + } + public class StoredProcedureRequestOptions : RequestOptions + { + public StoredProcedureRequestOptions(); + public Nullable ConsistencyLevel { get; set; } + public bool EnableScriptLogging { get; set; } + public string SessionToken { get; set; } + } + public class StoredProcedureResponse : Response + { + protected StoredProcedureResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override StoredProcedureProperties Resource { get; } + public virtual string SessionToken { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator StoredProcedureProperties (StoredProcedureResponse response); + } + public enum TriggerOperation : short + { + All = (short)0, + Create = (short)1, + Delete = (short)3, + Replace = (short)4, + Update = (short)2, + } + public class TriggerProperties + { + public TriggerProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + public TriggerOperation TriggerOperation { get; set; } + public TriggerType TriggerType { get; set; } + } + public class TriggerResponse : Response + { + protected TriggerResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override TriggerProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator TriggerProperties (TriggerResponse response); + } + public enum TriggerType : byte + { + Post = (byte)1, + Pre = (byte)0, + } + public class UserDefinedFunctionProperties + { + public UserDefinedFunctionProperties(); + public string Body { get; set; } + public string ETag { get; } + public string Id { get; set; } + public string SelfLink { get; } + } + public class UserDefinedFunctionResponse : Response + { + protected UserDefinedFunctionResponse(); + public override string ActivityId { get; } + public override CosmosDiagnostics Diagnostics { get; } + public override string ETag { get; } + public override Headers Headers { get; } + public override double RequestCharge { get; } + public override UserDefinedFunctionProperties Resource { get; } + public override HttpStatusCode StatusCode { get; } + public static implicit operator UserDefinedFunctionProperties (UserDefinedFunctionResponse response); + } +} +namespace Microsoft.Azure.Cosmos.Spatial +{ + public sealed class BoundingBox : IEquatable + { + public BoundingBox(Position min, Position max); + public Position Max { get; } + public Position Min { get; } + public bool Equals(BoundingBox other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public abstract class Crs + { + protected Crs(CrsType type); + public static Crs Default { get; } + public CrsType Type { get; } + public static Crs Unspecified { get; } + public static LinkedCrs Linked(string href); + public static LinkedCrs Linked(string href, string type); + public static NamedCrs Named(string name); + } + public enum CrsType + { + Linked = 1, + Named = 0, + Unspecified = 2, + } + public abstract class Geometry + { + protected Geometry(GeometryType type, GeometryParams geometryParams); + public IDictionary AdditionalProperties { get; } + public BoundingBox BoundingBox { get; } + public Crs Crs { get; } + public GeometryType Type { get; } + public double Distance(Geometry to); + public override bool Equals(object obj); + public override int GetHashCode(); + public bool Intersects(Geometry geometry2); + public bool IsValid(); + public GeometryValidationResult IsValidDetailed(); + public bool Within(Geometry outer); + } + public class GeometryParams + { + public GeometryParams(); + public IDictionary AdditionalProperties { get; set; } + public BoundingBox BoundingBox { get; set; } + public Crs Crs { get; set; } + } + public enum GeometryShape + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public enum GeometryType + { + GeometryCollection = 6, + LineString = 2, + MultiLineString = 3, + MultiPoint = 1, + MultiPolygon = 5, + Point = 0, + Polygon = 4, + } + public class GeometryValidationResult + { + public GeometryValidationResult(); + public bool IsValid { get; } + public string Reason { get; } + } + public sealed class LinearRing : IEquatable + { + public LinearRing(IList coordinates); + public ReadOnlyCollection Positions { get; } + public bool Equals(LinearRing other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LineString : Geometry, IEquatable + { + public LineString(IList coordinates); + public LineString(IList coordinates, GeometryParams geometryParams); + public ReadOnlyCollection Positions { get; } + public bool Equals(LineString other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class LinkedCrs : Crs, IEquatable + { + public string Href { get; } + public string HrefType { get; } + public bool Equals(LinkedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class MultiPolygon : Geometry, IEquatable + { + public MultiPolygon(IList polygons); + public MultiPolygon(IList polygons, GeometryParams geometryParams); + public ReadOnlyCollection Polygons { get; } + public bool Equals(MultiPolygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class NamedCrs : Crs, IEquatable + { + public string Name { get; } + public bool Equals(NamedCrs other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Point : Geometry, IEquatable + { + public Point(Position position); + public Point(Position position, GeometryParams geometryParams); + public Point(double longitude, double latitude); + public Position Position { get; } + public bool Equals(Point other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Polygon : Geometry, IEquatable + { + public Polygon(IList rings); + public Polygon(IList rings, GeometryParams geometryParams); + public Polygon(IList externalRingPositions); + public ReadOnlyCollection Rings { get; } + public bool Equals(Polygon other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class PolygonCoordinates : IEquatable + { + public PolygonCoordinates(IList rings); + public ReadOnlyCollection Rings { get; } + public bool Equals(PolygonCoordinates other); + public override bool Equals(object obj); + public override int GetHashCode(); + } + public sealed class Position : IEquatable + { + public Position(IList coordinates); + public Position(double longitude, double latitude); + public Position(double longitude, double latitude, Nullable altitude); + public Nullable Altitude { get; } + public ReadOnlyCollection Coordinates { get; } + public double Latitude { get; } + public double Longitude { get; } + public bool Equals(Position other); + public override bool Equals(object obj); + public override int GetHashCode(); + } +} diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs index 7df0871d74..50098a8057 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedMode.cs @@ -38,12 +38,7 @@ internal ChangeFeedMode() /// Latest version mode includes item creations and updates, not deletions. /// /// A to receive latest version item changes. -#if PREVIEW - public -#else - internal -#endif - static ChangeFeedMode LatestVersion => ChangeFeedModeIncremental.Instance; + public static ChangeFeedMode LatestVersion => ChangeFeedModeIncremental.Instance; /// /// Creates a to receive notifications for creations, deletes, as well as all intermediary snapshots for updates. diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Exceptions/ChangeFeedProcessorUserException.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Exceptions/ChangeFeedProcessorUserException.cs index b62eba6ec7..b3b4f51932 100644 --- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Exceptions/ChangeFeedProcessorUserException.cs +++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/Exceptions/ChangeFeedProcessorUserException.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos { using System; using System.Runtime.Serialization; - using global::Azure.Core.Pipeline; + using global::Azure.Core; using Microsoft.Azure.Cosmos.Telemetry; using Microsoft.Azure.Cosmos.Telemetry.Diagnostics; diff --git a/Microsoft.Azure.Cosmos/src/DocumentClient.cs b/Microsoft.Azure.Cosmos/src/DocumentClient.cs index c7504d312c..451166618d 100644 --- a/Microsoft.Azure.Cosmos/src/DocumentClient.cs +++ b/Microsoft.Azure.Cosmos/src/DocumentClient.cs @@ -167,6 +167,9 @@ internal partial class DocumentClient : IDisposable, IAuthorizationTokenProvider //RemoteCertificateValidationCallback internal RemoteCertificateValidationCallback remoteCertificateValidationCallback; + //Distributed Tracing Flag + internal bool isDistributedTracingEnabled; + //SessionContainer. internal ISessionContainer sessionContainer; @@ -426,6 +429,7 @@ internal DocumentClient(Uri serviceEndpoint, /// Flag to allow Quorum Read with Eventual Consistency Account /// /// This delegate responsible for validating the third party certificate. + /// This is distributed tracing flag /// /// The service endpoint can be obtained from the Azure Management Portal. /// If you are connecting using one of the Master Keys, these can be obtained along with the endpoint from the Azure Management Portal @@ -452,7 +456,8 @@ internal DocumentClient(Uri serviceEndpoint, IStoreClientFactory storeClientFactory = null, bool isLocalQuorumConsistency = false, string cosmosClientId = null, - RemoteCertificateValidationCallback remoteCertificateValidationCallback = null) + RemoteCertificateValidationCallback remoteCertificateValidationCallback = null, + bool isDistributedTracingEnabled = false) { if (sendingRequestEventArgs != null) { @@ -485,7 +490,8 @@ internal DocumentClient(Uri serviceEndpoint, enableCpuMonitor: enableCpuMonitor, storeClientFactory: storeClientFactory, cosmosClientId: cosmosClientId, - remoteCertificateValidationCallback: remoteCertificateValidationCallback); + remoteCertificateValidationCallback: remoteCertificateValidationCallback, + isDistributedTracingEnabled: isDistributedTracingEnabled); } /// @@ -668,7 +674,8 @@ internal virtual void Initialize(Uri serviceEndpoint, IStoreClientFactory storeClientFactory = null, TokenCredential tokenCredential = null, string cosmosClientId = null, - RemoteCertificateValidationCallback remoteCertificateValidationCallback = null) + RemoteCertificateValidationCallback remoteCertificateValidationCallback = null, + bool isDistributedTracingEnabled = false) { if (serviceEndpoint == null) { @@ -677,6 +684,7 @@ internal virtual void Initialize(Uri serviceEndpoint, this.clientId = cosmosClientId; this.remoteCertificateValidationCallback = remoteCertificateValidationCallback; + this.isDistributedTracingEnabled = isDistributedTracingEnabled; this.queryPartitionProvider = new AsyncLazy(async () => { @@ -6658,7 +6666,8 @@ private void InitializeDirectConnectivity(IStoreClientFactory storeClientFactory enableTcpConnectionEndpointRediscovery: this.ConnectionPolicy.EnableTcpConnectionEndpointRediscovery, addressResolver: this.AddressResolver, rntbdMaxConcurrentOpeningConnectionCount: this.rntbdMaxConcurrentOpeningConnectionCount, - remoteCertificateValidationCallback: this.remoteCertificateValidationCallback ); + remoteCertificateValidationCallback: this.remoteCertificateValidationCallback, + isDistributedTracingEnabled: this.isDistributedTracingEnabled); if (this.transportClientHandlerFactory != null) { @@ -6909,6 +6918,11 @@ private INameValueCollection GetRequestHeaders( headers.Set(HttpConstants.HttpHeaders.ConsistencyLevel, options.ConsistencyLevel.ToString()); } + if (options.PriorityLevel.HasValue) + { + headers.Set(HttpConstants.HttpHeaders.PriorityLevel, options.PriorityLevel.ToString()); + } + if (options.IndexingDirective.HasValue) { headers.Set(HttpConstants.HttpHeaders.IndexingDirective, options.IndexingDirective.ToString()); diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ComputedPropertiesDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ComputedPropertiesDefinition.cs new file mode 100644 index 0000000000..41a6db5168 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ComputedPropertiesDefinition.cs @@ -0,0 +1,60 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +namespace Microsoft.Azure.Cosmos.Fluent +{ + using System; + using System.Collections.ObjectModel; + + /// + /// Computed Properties fluent definition. + /// + /// +#if PREVIEW + public +#else + internal +#endif + class ComputedPropertiesDefinition + { + private readonly Collection computedProperties = new Collection(); + private readonly T parent; + private readonly Action> attachCallback; + + internal ComputedPropertiesDefinition( + T parent, + Action> attachCallback) + { + this.parent = parent; + this.attachCallback = attachCallback; + } + + /// + /// Adds a computed property to the current + /// + /// Name of the computed property + /// Query for the computed property values + /// An instance of the current + public ComputedPropertiesDefinition WithComputedProperty(string name, string query) + { + this.computedProperties.Add( + new ComputedProperty + { + Name = name, + Query = query + }); + + return this; + } + + /// + /// Applies the current definition to the parent. + /// + /// An instance of the parent. + public T Attach() + { + this.attachCallback(this.computedProperties); + return this.parent; + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerDefinition.cs b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerDefinition.cs index a1141fc3f0..1678688c41 100644 --- a/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerDefinition.cs +++ b/Microsoft.Azure.Cosmos/src/Fluent/Settings/ContainerDefinition.cs @@ -4,6 +4,8 @@ namespace Microsoft.Azure.Cosmos.Fluent { using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; /// /// Azure Cosmos container fluent definition. @@ -18,6 +20,7 @@ public abstract class ContainerDefinition private IndexingPolicy indexingPolicy; private string timeToLivePropertyPath; private PartitionKeyDefinitionVersion? partitionKeyDefinitionVersion = null; + private Collection computedProperties; /// /// Creates an instance for unit-testing @@ -123,6 +126,28 @@ public IndexingPolicyDefinition WithIndexingPolicy() (indexingPolicy) => this.WithIndexingPolicy(indexingPolicy)); } + /// + /// definition for Azure Cosmos container. + /// + /// An instance of . +#if PREVIEW + public +#else + internal +#endif + ComputedPropertiesDefinition WithComputedProperties() + { + if (this.computedProperties != null) + { + // Overwrite + throw new NotSupportedException(); + } + + return new ComputedPropertiesDefinition( + (T)this, + (computedProperties) => this.WithComputedProperties(computedProperties)); + } + /// /// Applies the current Fluent definition and creates a container configuration. /// @@ -152,6 +177,11 @@ public ContainerProperties Build() containerProperties.PartitionKeyDefinitionVersion = this.partitionKeyDefinitionVersion.Value; } + if (this.computedProperties != null) + { + containerProperties.ComputedProperties = this.computedProperties; + } + containerProperties.ValidateRequiredProperties(); return containerProperties; @@ -161,5 +191,10 @@ private void WithIndexingPolicy(IndexingPolicy indexingPolicy) { this.indexingPolicy = indexingPolicy; } + + private void WithComputedProperties(Collection computedProperties) + { + this.computedProperties = computedProperties; + } } } diff --git a/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs b/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs index c779dc7855..e151ffcd94 100644 --- a/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs +++ b/Microsoft.Azure.Cosmos/src/GatewayStoreClient.cs @@ -320,6 +320,14 @@ private async ValueTask PrepareRequestMessageAsync( } } + if (request.Properties != null) + { + foreach (KeyValuePair property in request.Properties) + { + requestMessage.Properties.Add(property); + } + } + // add activityId Guid activityId = System.Diagnostics.Trace.CorrelationManager.ActivityId; Debug.Assert(activityId != Guid.Empty); diff --git a/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs b/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs index a48666f16d..0fde01afb5 100644 --- a/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs +++ b/Microsoft.Azure.Cosmos/src/HttpClient/CosmosHttpClientCore.cs @@ -5,17 +5,17 @@ namespace Microsoft.Azure.Cosmos { using System; using System.Collections.Generic; - using System.Diagnostics; using System.Linq; using System.Net; using System.Net.Http; using System.Net.Http.Headers; using System.Net.Security; + using System.Reflection; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Core.Trace; using Microsoft.Azure.Cosmos.Resource.CosmosExceptions; - using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Cosmos.Tracing.TraceData; using Microsoft.Azure.Documents; using Microsoft.Azure.Documents.Collections; @@ -99,7 +99,87 @@ public static CosmosHttpClient CreateWithConnectionPolicy( eventSource: eventSource); } - public static HttpMessageHandler CreateHttpClientHandler(int gatewayModeMaxConnectionLimit, IWebProxy webProxy, Func serverCertificateCustomValidationCallback) + public static HttpMessageHandler CreateHttpClientHandler( + int gatewayModeMaxConnectionLimit, + IWebProxy webProxy, + Func serverCertificateCustomValidationCallback) + { + // TODO: Remove type check and use #if NET6_0_OR_GREATER when multitargetting is possible + Type socketHandlerType = Type.GetType("System.Net.Http.SocketsHttpHandler, System.Net.Http"); + + if (socketHandlerType != null) + { + try + { + return CosmosHttpClientCore.CreateSocketsHttpHandlerHelper(gatewayModeMaxConnectionLimit, webProxy, serverCertificateCustomValidationCallback); + } + catch (Exception e) + { + DefaultTrace.TraceError("Failed to create SocketsHttpHandler: {0}", e); + } + } + + return CosmosHttpClientCore.CreateHttpClientHandlerHelper(gatewayModeMaxConnectionLimit, webProxy, serverCertificateCustomValidationCallback); + } + + public static HttpMessageHandler CreateSocketsHttpHandlerHelper( + int gatewayModeMaxConnectionLimit, + IWebProxy webProxy, + Func serverCertificateCustomValidationCallback) + { + // TODO: Remove Reflection when multitargetting is possible + Type socketHandlerType = Type.GetType("System.Net.Http.SocketsHttpHandler, System.Net.Http"); + + object socketHttpHandler = Activator.CreateInstance(socketHandlerType); + + PropertyInfo pooledConnectionLifetimeInfo = socketHandlerType.GetProperty("PooledConnectionLifetime"); + + //Sets the timeout for unused connections to a random time between 5 minutes and 5 minutes and 30 seconds. + //This is to avoid the issue where a large number of connections are closed at the same time. + TimeSpan connectionTimeSpan = TimeSpan.FromMinutes(5) + TimeSpan.FromSeconds(30 * CustomTypeExtensions.GetRandomNumber().NextDouble()); + pooledConnectionLifetimeInfo.SetValue(socketHttpHandler, connectionTimeSpan); + + // Proxy is only set by users and can cause not supported exception on some platforms + if (webProxy != null) + { + PropertyInfo webProxyInfo = socketHandlerType.GetProperty("Proxy"); + webProxyInfo.SetValue(socketHttpHandler, webProxy); + } + + // https://docs.microsoft.com/en-us/archive/blogs/timomta/controlling-the-number-of-outgoing-connections-from-httpclient-net-core-or-full-framework + try + { + PropertyInfo maxConnectionsPerServerInfo = socketHandlerType.GetProperty("MaxConnectionsPerServer"); + maxConnectionsPerServerInfo.SetValue(socketHttpHandler, gatewayModeMaxConnectionLimit); + } + // MaxConnectionsPerServer is not supported on some platforms. + catch (PlatformNotSupportedException) + { + } + + if (serverCertificateCustomValidationCallback != null) + { + //Get SslOptions Property + PropertyInfo sslOptionsInfo = socketHandlerType.GetProperty("SslOptions"); + object sslOptions = sslOptionsInfo.GetValue(socketHttpHandler); + + //Set SslOptions Property with custom certificate validation + PropertyInfo remoteCertificateValidationCallbackInfo = sslOptions.GetType().GetProperty("RemoteCertificateValidationCallback"); + remoteCertificateValidationCallbackInfo.SetValue( + sslOptions, + new RemoteCertificateValidationCallback((object _, X509Certificate certificate, X509Chain x509Chain, SslPolicyErrors sslPolicyErrors) => serverCertificateCustomValidationCallback( + certificate is { } ? new X509Certificate2(certificate) : null, + x509Chain, + sslPolicyErrors))); + } + + return (HttpMessageHandler)socketHttpHandler; + } + + public static HttpMessageHandler CreateHttpClientHandlerHelper( + int gatewayModeMaxConnectionLimit, + IWebProxy webProxy, + Func serverCertificateCustomValidationCallback) { HttpClientHandler httpClientHandler = new HttpClientHandler(); @@ -112,17 +192,18 @@ public static HttpMessageHandler CreateHttpClientHandler(int gatewayModeMaxConne // https://docs.microsoft.com/en-us/archive/blogs/timomta/controlling-the-number-of-outgoing-connections-from-httpclient-net-core-or-full-framework try { - httpClientHandler.MaxConnectionsPerServer = gatewayModeMaxConnectionLimit; - if (serverCertificateCustomValidationCallback != null) - { - httpClientHandler.ServerCertificateCustomValidationCallback = (_, certificate2, x509Chain, sslPolicyErrors) => serverCertificateCustomValidationCallback(certificate2, x509Chain, sslPolicyErrors); - } + httpClientHandler.MaxConnectionsPerServer = gatewayModeMaxConnectionLimit; } // MaxConnectionsPerServer is not supported on some platforms. catch (PlatformNotSupportedException) { } + if (serverCertificateCustomValidationCallback != null) + { + httpClientHandler.ServerCertificateCustomValidationCallback = (_, certificate2, x509Chain, sslPolicyErrors) => serverCertificateCustomValidationCallback(certificate2, x509Chain, sslPolicyErrors); + } + return httpClientHandler; } diff --git a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/StringBuiltinFunctions.cs b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/StringBuiltinFunctions.cs index 781eb8d20a..b04bd58c3c 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/StringBuiltinFunctions.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/StringBuiltinFunctions.cs @@ -348,6 +348,45 @@ protected override SqlScalarExpression VisitImplicit(MethodCallExpression method } } + private class StringVisitTrim : SqlBuiltinFunctionVisitor + { + public StringVisitTrim() + : base("TRIM", + false, + null) + { + } + + protected override SqlScalarExpression VisitImplicit(MethodCallExpression methodCallExpression, TranslationContext context) + { + bool validInNet = false; + bool validInNetCore = false; + + if (methodCallExpression.Arguments.Count == 1 && + methodCallExpression.Arguments[0].NodeType == ExpressionType.Constant && + methodCallExpression.Arguments[0].Type == typeof(char[])) + { + char[] argumentsExpressions = (char[])((ConstantExpression)methodCallExpression.Arguments[0]).Value; + if (argumentsExpressions.Length == 0) + { + validInNet = true; + } + } + else if (methodCallExpression.Arguments.Count == 0) + { + validInNetCore = true; + } + + if (validInNet || validInNetCore) + { + SqlScalarExpression str = ExpressionToSql.VisitScalarExpression(methodCallExpression.Object, context); + return SqlFunctionCallScalarExpression.CreateBuiltin(SqlFunctionCallScalarExpression.Names.Trim, str); + } + + return null; + } + } + static StringBuiltinFunctions() { StringBuiltinFunctionDefinitions = new Dictionary @@ -415,6 +454,10 @@ static StringBuiltinFunctions() "TrimEnd", new StringVisitTrimEnd() }, + { + "Trim", + new StringVisitTrim() + }, { "StartsWith", new SqlStringWithComparisonVisitor(SqlFunctionCallScalarExpression.Names.Startswith) diff --git a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/TypeCheckFunctions.cs b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/TypeCheckFunctions.cs index 93c09d65ab..db875f3ae0 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/TypeCheckFunctions.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/BuiltinFunctions/TypeCheckFunctions.cs @@ -18,33 +18,62 @@ static TypeCheckFunctions() { TypeCheckFunctionsDefinitions = new Dictionary { - { - "IsDefined", - new SqlBuiltinFunctionVisitor("IS_DEFINED", + [nameof(CosmosLinqExtensions.IsArray)] = new SqlBuiltinFunctionVisitor( + "IS_ARRAY", true, new List() { new Type[]{typeof(object)}, - }) - }, - { - "IsNull", - new SqlBuiltinFunctionVisitor("IS_NULL", + }), + [nameof(CosmosLinqExtensions.IsBool)] = new SqlBuiltinFunctionVisitor( + "IS_BOOL", true, new List() { new Type[]{typeof(object)}, - }) - }, - { - "IsPrimitive", - new SqlBuiltinFunctionVisitor("IS_PRIMITIVE", + }), + [nameof(CosmosLinqExtensions.IsDefined)] = new SqlBuiltinFunctionVisitor( + "IS_DEFINED", true, new List() { new Type[]{typeof(object)}, - }) - } + }), + [nameof(CosmosLinqExtensions.IsNull)] = new SqlBuiltinFunctionVisitor( + "IS_NULL", + true, + new List() + { + new Type[]{typeof(object)}, + }), + [nameof(CosmosLinqExtensions.IsNumber)] = new SqlBuiltinFunctionVisitor( + "IS_NUMBER", + true, + new List() + { + new Type[]{typeof(object)}, + }), + [nameof(CosmosLinqExtensions.IsObject)] = new SqlBuiltinFunctionVisitor( + "IS_OBJECT", + true, + new List() + { + new Type[]{typeof(object)}, + }), + [nameof(CosmosLinqExtensions.IsPrimitive)] = new SqlBuiltinFunctionVisitor( + "IS_PRIMITIVE", + true, + new List() + { + new Type[]{typeof(object)}, + }), + [nameof(CosmosLinqExtensions.IsString)] = new SqlBuiltinFunctionVisitor( + "IS_STRING", + true, + new List() + { + new Type[]{typeof(object)}, + }), }; } diff --git a/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs b/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs index dc86de0cb6..6663f52673 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/CosmosLinqExtensions.cs @@ -20,6 +20,44 @@ namespace Microsoft.Azure.Cosmos.Linq /// public static class CosmosLinqExtensions { + /// + /// Returns a Boolean value indicating if the type of the specified expression is an array. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is an array; otherwise, false. + /// + /// + /// document.Names.IsArray()); + /// ]]> + /// + /// + public static bool IsArray(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is a boolean. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is a boolean; otherwise, false. + /// + /// + /// document.IsRegistered.IsBool()); + /// ]]> + /// + /// + public static bool IsBool(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + /// /// Determines if a certain property is defined or not. /// This method is to be used in LINQ expressions only and will be evaluated on server. @@ -52,12 +90,50 @@ public static bool IsDefined(this object obj) /// var isNullQuery = documents.Where(document => document.Name.IsNull()); /// ]]> /// - /// s> + /// public static bool IsNull(this object obj) { throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); } + /// + /// Returns a Boolean value indicating if the type of the specified expression is a number. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is a number; otherwise, false. + /// + /// + /// document.Age.IsNumber()); + /// ]]> + /// + /// + public static bool IsNumber(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + + /// + /// Returns a Boolean value indicating if the type of the specified expression is an object. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is an object; otherwise, false. + /// + /// + /// document.Address.IsObject()); + /// ]]> + /// + /// + public static bool IsObject(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + /// /// Determines if a certain property is of primitive JSON type. /// This method is to be used in LINQ expressions only and will be evaluated on server. @@ -74,12 +150,31 @@ public static bool IsNull(this object obj) /// var isPrimitiveQuery = documents.Where(document => document.Name.IsPrimitive()); /// ]]> /// - /// s> + /// public static bool IsPrimitive(this object obj) { throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); } + /// + /// Returns a Boolean value indicating if the type of the specified expression is a string. + /// This method is to be used in LINQ expressions only and will be evaluated on server. + /// There's no implementation provided in the client library. + /// + /// + /// Returns true if the type of the specified expression is a string; otherwise, false. + /// + /// + /// document.Name.IsString()); + /// ]]> + /// + /// + public static bool IsString(this object obj) + { + throw new NotImplementedException(ClientResources.TypeCheckExtensionFunctionsNotImplemented); + } + /// /// This method generate query definition from LINQ query. /// diff --git a/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs b/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs index 9205052604..8fc95d8701 100644 --- a/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs +++ b/Microsoft.Azure.Cosmos/src/Linq/TranslationContext.cs @@ -119,6 +119,7 @@ public void PopParameter() { ParameterExpression last = this.lambdaParametersStack[this.lambdaParametersStack.Count - 1]; this.lambdaParametersStack.RemoveAt(this.lambdaParametersStack.Count - 1); + this.substitutions.Remove(last); } /// @@ -337,6 +338,11 @@ public Expression Lookup(ParameterExpression parameter) return null; } + internal void Remove(ParameterExpression parameter) + { + this.substitutionTable.Remove(parameter); + } + public const string InputParameterName = "root"; } diff --git a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj index da34339954..7215bd2493 100644 --- a/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj +++ b/Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj @@ -3,14 +3,15 @@ Microsoft Corporation Microsoft(R) Azure Cosmos - This client library enables client applications to connect to Azure Cosmos via the SQL API. Azure Cosmos is a globally distributed, multi-model database service. For more information, refer to http://azure.microsoft.com/services/cosmos-db/. + This client library enables client applications to connect to Azure Cosmos DB via the NoSQL API. Azure Cosmos DB is a globally distributed, multi-model database service. For more information, refer to http://azure.microsoft.com/services/cosmos-db/. © Microsoft Corporation. All rights reserved. en-US $([System.DateTime]::Now.ToString(yyyyMMdd)) $(ClientOfficialVersion) $(ClientPreviewVersion) - nightly-$(CurrentDate) $(ClientPreviewSuffixVersion) + nightly-$(CurrentDate) + $(VersionSuffix)-nightly-$(CurrentDate) $(ClientVersion) $(ClientVersion)-$(VersionSuffix) $(ClientVersion) @@ -22,7 +23,6 @@ Microsoft.Azure.Cosmos microsoft;azure;cosmos;cosmosdb;documentdb;docdb;nosql;azureofficial;dotnetcore;netcore;netstandard The change log for this SDK is made available at https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/changelog.md at the time of release. - https://aka.ms/netcoregaeula https://github.com/Azure/azure-cosmos-dotnet-v3 true http://go.microsoft.com/fwlink/?LinkID=288890 @@ -41,9 +41,15 @@ NU5125 true $(LangVersion) + LICENSE + + + + + diff --git a/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/DiagnosticScopeFactory.cs b/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/DiagnosticScopeFactory.cs deleted file mode 100644 index 2cddf70d21..0000000000 --- a/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/DiagnosticScopeFactory.cs +++ /dev/null @@ -1,61 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -// This File is copied from Azure.Core repo. i.e. https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/Shared/DiagnosticScopeFactory.cs - -#nullable enable - -namespace Azure.Core.Pipeline -{ - using System.Collections.Generic; - using System.Diagnostics; - using System.Threading; - -#pragma warning disable CA1001 // Types that own disposable fields should be disposable - internal class DiagnosticScopeFactory -#pragma warning restore CA1001 // Types that own disposable fields should be disposable - { - private static Dictionary? listeners; - private readonly string? resourceProviderNamespace; - private readonly DiagnosticListener? source; - - public DiagnosticScopeFactory(string clientNamespace, string? resourceProviderNamespace, bool isActivityEnabled) - { - this.resourceProviderNamespace = resourceProviderNamespace; - this.IsActivityEnabled = isActivityEnabled; - if (this.IsActivityEnabled) - { -#pragma warning disable CS8601 // Possible null reference assignment. - var listeners = LazyInitializer.EnsureInitialized>(ref DiagnosticScopeFactory.listeners); -#pragma warning restore CS8601 // Possible null reference assignment. - - lock (listeners!) - { - if (!listeners.TryGetValue(clientNamespace, out this.source)) - { - this.source = new DiagnosticListener(clientNamespace); - listeners[clientNamespace] = this.source; - } - } - } - } - - public bool IsActivityEnabled { get; } - - public DiagnosticScope CreateScope(string name, DiagnosticScope.ActivityKind kind = DiagnosticScope.ActivityKind.Client) - { - if (this.source == null) - { - return default; - } - var scope = new DiagnosticScope(this.source.Name, name, this.source, kind); - - if (this.resourceProviderNamespace != null) - { - scope.AddAttribute("az.namespace", this.resourceProviderNamespace); - } - return scope; - } - } -} diff --git a/Microsoft.Azure.Cosmos/src/Patch/PatchConstants.cs b/Microsoft.Azure.Cosmos/src/Patch/PatchConstants.cs index fd0cd79215..b06ad841b4 100644 --- a/Microsoft.Azure.Cosmos/src/Patch/PatchConstants.cs +++ b/Microsoft.Azure.Cosmos/src/Patch/PatchConstants.cs @@ -13,6 +13,7 @@ public static class PropertyNames public const string OperationType = "op"; public const string Path = "path"; public const string Value = "value"; + public const string From = "from"; } public static class PatchSpecAttributes @@ -28,6 +29,7 @@ public static class OperationTypeNames public const string Replace = "replace"; public const string Set = "set"; public const string Increment = "incr"; + public const string Move = "move"; } public static string ToEnumMemberString(this PatchOperationType patchOperationType) @@ -44,6 +46,8 @@ public static string ToEnumMemberString(this PatchOperationType patchOperationTy return PatchConstants.OperationTypeNames.Set; case PatchOperationType.Increment: return PatchConstants.OperationTypeNames.Increment; + case PatchOperationType.Move: + return PatchConstants.OperationTypeNames.Move; default: throw new ArgumentException($"Unknown Patch operation type '{patchOperationType}'."); } diff --git a/Microsoft.Azure.Cosmos/src/Patch/PatchOperation.cs b/Microsoft.Azure.Cosmos/src/Patch/PatchOperation.cs index 16448c7f9f..412dec2334 100644 --- a/Microsoft.Azure.Cosmos/src/Patch/PatchOperation.cs +++ b/Microsoft.Azure.Cosmos/src/Patch/PatchOperation.cs @@ -25,6 +25,12 @@ public abstract class PatchOperation [JsonProperty(PropertyName = PatchConstants.PropertyNames.Path)] public abstract string Path { get; } + /// + /// Source location reference (used in case of move) + /// + [JsonProperty(PropertyName = PatchConstants.PropertyNames.From)] + public virtual string From { get; set; } = null; + /// /// Serializes the value parameter, if specified for the PatchOperation. /// @@ -134,5 +140,21 @@ public static PatchOperation Increment( path, value); } + + /// + /// Create to move an object/value. + /// + /// The source location of the object/value. + /// Target location reference. + /// PatchOperation instance for specified input. + public static PatchOperation Move( + string from, + string path) + { + return new PatchOperationCore( + PatchOperationType.Move, + path, + from); + } } } diff --git a/Microsoft.Azure.Cosmos/src/Patch/PatchOperationCore{T}.cs b/Microsoft.Azure.Cosmos/src/Patch/PatchOperationCore{T}.cs index bb87570242..c560cbae7b 100644 --- a/Microsoft.Azure.Cosmos/src/Patch/PatchOperationCore{T}.cs +++ b/Microsoft.Azure.Cosmos/src/Patch/PatchOperationCore{T}.cs @@ -10,23 +10,40 @@ namespace Microsoft.Azure.Cosmos internal sealed class PatchOperationCore : PatchOperation { /// - /// Initializes a new instance of the class. - /// - /// Specifies the type of Patch operation. - /// Specifies the path to target location. - /// Specifies the value to be used. +        /// Initializes a new instance of the class. +        /// +        /// Specifies the type of Patch operation. +        /// Specifies the path to target location. +        /// Specifies the value to be used. In case of move operations it will be a string specifying the source +        /// location. public PatchOperationCore( - PatchOperationType operationType, - string path, - T value) + PatchOperationType operationType, + string path, + T value) { this.OperationType = operationType; - this.Path = string.IsNullOrWhiteSpace(path) - ? throw new ArgumentNullException(nameof(path)) - : path; - this.Value = value; + if (operationType == PatchOperationType.Move) + { + this.Path = string.IsNullOrWhiteSpace(path) + ? throw new ArgumentNullException(nameof(path)) + : path; + if (!(value is String valueAsString)) + { + throw new ArgumentException( + $"Parameter {nameof(value)} must be of type String for patch operation type {nameof(PatchOperationType.Move)}"); + } + this.From = string.IsNullOrWhiteSpace(valueAsString) + ? throw new ArgumentNullException(nameof(value)) + : valueAsString; + } + else + { + this.Path = string.IsNullOrWhiteSpace(path) + ? throw new ArgumentNullException(nameof(path)) + : path; + this.Value = value; + } } - public override T Value { get; } public override PatchOperationType OperationType { get; } diff --git a/Microsoft.Azure.Cosmos/src/Patch/PatchOperationType.cs b/Microsoft.Azure.Cosmos/src/Patch/PatchOperationType.cs index 7504492126..d98d35f832 100644 --- a/Microsoft.Azure.Cosmos/src/Patch/PatchOperationType.cs +++ b/Microsoft.Azure.Cosmos/src/Patch/PatchOperationType.cs @@ -9,7 +9,7 @@ namespace Microsoft.Azure.Cosmos using Newtonsoft.Json.Converters; /// - /// Type of Patch operation. + /// Describes the list of Patch supported operation types. /// /// /// For more information, see Partial document update in Azure Cosmos DB: Supported operations @@ -47,5 +47,11 @@ public enum PatchOperationType /// [EnumMember(Value = PatchConstants.OperationTypeNames.Increment)] Increment, + + /// + /// Operation to move a object/value. + /// + [EnumMember(Value = PatchConstants.OperationTypeNames.Move)] + Move, } } diff --git a/Microsoft.Azure.Cosmos/src/Patch/PatchOperationsJsonConverter.cs b/Microsoft.Azure.Cosmos/src/Patch/PatchOperationsJsonConverter.cs index 6cb9c8fa45..04419a5765 100644 --- a/Microsoft.Azure.Cosmos/src/Patch/PatchOperationsJsonConverter.cs +++ b/Microsoft.Azure.Cosmos/src/Patch/PatchOperationsJsonConverter.cs @@ -88,7 +88,12 @@ public override void WriteJson( writer.WritePropertyName(PatchConstants.PropertyNames.Path); writer.WriteValue(operation.Path); - if (operation.TrySerializeValueParameter(this.userSerializer, out Stream valueStream)) + if (operation.OperationType == PatchOperationType.Move) + { + writer.WritePropertyName(PatchConstants.PropertyNames.From); + writer.WriteValue(operation.From); + } + else if (operation.TrySerializeValueParameter(this.userSerializer, out Stream valueStream)) { string valueParam; using (valueStream) diff --git a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs index 8ba6c4fc45..7ca3a60a71 100644 --- a/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs +++ b/Microsoft.Azure.Cosmos/src/Query/Core/Parser/CstToAstVisitor.cs @@ -8,6 +8,7 @@ namespace Microsoft.Azure.Cosmos.Query.Core.Parser using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics.Contracts; + using System.Globalization; using Antlr4.Runtime.Misc; using Antlr4.Runtime.Tree; using Microsoft.Azure.Cosmos.SqlObjects; @@ -963,7 +964,7 @@ private static Number64 GetNumber64ValueFromNode(IParseTree parseTree) } else { - number64 = double.Parse(text); + number64 = double.Parse(text, CultureInfo.InvariantCulture); } return number64; diff --git a/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs b/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs index 294ed6c3ad..bdb2de33b0 100644 --- a/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs +++ b/Microsoft.Azure.Cosmos/src/RMResources.Designer.cs @@ -612,50 +612,6 @@ internal static string DeserializationError } } - /// - /// Looks up a localized string similar to The given default identity for {0} is not valid. The format for the default identity is not valid, please use 'FirstPartyIdentity'/'SystemAssignedIdentity'/'UserAssignedIdentity=<UA_resource_id>'. - /// - internal static string DefaultIdentityNotValidFormat - { - get - { - return ResourceManager.GetString("DefaultIdentityNotValidFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The given default identity for {0} is not valid. The default identity points to a delegated identity that does not exist in {0}.. - /// - internal static string DefaultIdentityWithoutCorrespondingDelegatedIdentity - { - get - { - return ResourceManager.GetString("DefaultIdentityWithoutCorrespondingDelegatedIdentity", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The given default identity for {0} is not valid. The default identity points to a system identity that does not exist in {0}.. - /// - internal static string DefaultIdentityWithoutCorrespondingSystemIdentity - { - get - { - return ResourceManager.GetString("DefaultIdentityWithoutCorrespondingSystemIdentity", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The given default identity for {0} is not valid. The default identity points to an user identity that does not exist in {0}.. - /// - internal static string DefaultIdentityWithoutCorrespondingUserIdentity - { - get - { - return ResourceManager.GetString("DefaultIdentityWithoutCorrespondingUserIdentity", resourceCulture); - } - } - /// /// Looks up a localized string similar to DNS resolution failed.. /// @@ -1387,18 +1343,6 @@ internal static string InvalidFailoverPriority } } - - /// - /// Looks up a localized string similar to Federation cap action is not currently supported. - /// - internal static string InvalidFederationCapAction - { - get - { - return ResourceManager.GetString("InvalidFederationCapAction", resourceCulture); - } - } - /// /// Looks up a localized string similar to Value '{0}' specified for the header '{1}' is invalid. . /// @@ -2803,17 +2747,6 @@ internal static string RbacMissingUserId } } - /// - /// Looks up a localized string similar to Request is blocked because ResourceId [{0}] cannot be resolved. Principal = [{1}], Action = [{2}], ResourceType = [{3}].. - /// - internal static string RbacCannotResolveResourceRid - { - get - { - return ResourceManager.GetString("RbacCannotResolveResourceRid", resourceCulture); - } - } - /// /// Looks up a localized string similar to Read Quorum size of {0} is not met for the request.. /// @@ -3386,149 +3319,6 @@ internal static string CrossTenantCMKDatabaseAccountLogstoreFeaturesNotSupported } } - /// - /// Looks up a localized string similar to The server encountered an unexpected condition that prevented it from fulfilling the Azure Key Vault resource request. - /// - internal static string UnexpectedExceptionCaughtonKeyVaultAccessClient - { - get - { - return ResourceManager.GetString("UnexpectedExceptionCaughtonKeyVaultAccessClient", resourceCulture); - } - } - - /// - /// The expected scope array should be of length 1. Instead received scope with length {0}. - /// - internal static string InvalidMSALScopeLength - { - get - { - return ResourceManager.GetString("InvalidMSALScopeLength", resourceCulture); - } - } - - /// - /// The requested scope is not a well formed URI string. - /// - internal static string InvalidRequestedScopeFormat - { - get - { - return ResourceManager.GetString("InvalidRequestedScopeFormat", resourceCulture); - } - } - - /// - /// The requested scope is not https. - /// - internal static string InvalidSchemeInScope - { - get - { - return ResourceManager.GetString("InvalidSchemeInScope", resourceCulture); - } - } - - /// - /// The requested scope contains unexpected segments. - /// - internal static string InvalildScopeSegments - { - get - { - return ResourceManager.GetString("InvalildScopeSegments", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Error contacting the Azure Key Vault resource. Please try again. - /// - internal static string KeyVaultServiceUnavailable - { - get - { - return ResourceManager.GetString("KeyVaultServiceUnavailable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The provided Azure Key Vault resource key URI is invalid. Please follow the format: https://{vault-name}.vault.azure.net/keys/{key-name} or https://{vault-name}.vault.azure.net/certificates/{certificate-name} or https://{vault-name}.vault.azure.net/secrets/{secret-name} . - /// - internal static string InvalidKeyVaultKeyAndCertURI - { - get - { - return ResourceManager.GetString("InvalidKeyVaultKeyAndCertURI", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The provided Azure Key Vault resource key URI is invalid. Please follow the format: https://{vault-name}.vault.azure.net/secrets/{secret-name} . - /// - internal static string InvalidKeyVaulSecretURI - { - get - { - return ResourceManager.GetString("InvalidKeyVaulSecretURI", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The remote name could not be resolved for the Azure Key Vault resource. Please provide a valid URI for an existing Key vault. - /// - internal static string KeyVaultDNSNotResolved - { - get - { - return ResourceManager.GetString("KeyVaultDNSNotResolved", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Could not find any secret with the.pem extension related to the provided certificate. - /// - internal static string KeyVaultCertificateException - { - get - { - return ResourceManager.GetString("KeyVaultCertificateException", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The Input provided is not a valid base 64 string. - /// - internal static string KeyVaultInvalidInputBytes - { - get - { - return ResourceManager.GetString("KeyVaultInvalidInputBytes", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Failed to acquire the access token needed to access the Azure Key Vault resource. Please verify that the tenant has all corresponding permissions assigned. - /// - internal static string KeyVaultAadClientCredentialsGrantFailure - { - get - { - return ResourceManager.GetString("KeyVaultAadClientCredentialsGrantFailure", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The Status Code for the first Azure Key Vault resource access try should be Unauthorized. - /// - internal static string FirstKeyVaultAccessAttemptShouldBeUnauthorized - { - get - { - return ResourceManager.GetString("FirstKeyVaultAccessAttemptShouldBeUnauthorized", resourceCulture); - } - } - /// /// Looks up a localized string similar to Network timeout or connectivity failure. /// @@ -4542,27 +4332,5 @@ internal static string PhysicalPartitionIdinTargetOrSourceDoesNotExist return ResourceManager.GetString("PhysicalPartitionIdinTargetOrSourceDoesNotExist", resourceCulture); } } - - /// - /// Looks up a localized string similar to Collection name '{0}' is invalid for MongoDB API.. - /// - internal static string InvalidMongoCollectionName - { - get - { - return ResourceManager.GetString("InvalidMongoCollectionName", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Database name '{0}' is invalid for MongoDB API.. - /// - internal static string InvalidMongoDatabaseName - { - get - { - return ResourceManager.GetString("InvalidMongoDatabaseName", resourceCulture); - } - } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/RMResources.resx b/Microsoft.Azure.Cosmos/src/RMResources.resx index a630919dc0..2cf687e8e4 100644 --- a/Microsoft.Azure.Cosmos/src/RMResources.resx +++ b/Microsoft.Azure.Cosmos/src/RMResources.resx @@ -1,17 +1,17 @@  - @@ -586,7 +586,7 @@ The value of offer throughput specified exceeded supported maximum throughput for Fixed size container. Please enter value less than {0}. - For containers migrated from fixed to unlimited, scale operation can be performed only if the container has documents populated with partition key. Please retry the throughput scale operation after populating documents with partition key. Please see https://aka.ms/migrate-to-partitioned-collection for more information. + For containers migrated from fixed to unlimited, scale operation can be performed only if the container has documents populated with partition key. Please retry the throughput scale operation after populating documents with partition key. The value of offer throughput specified is invalid. Please specify a value between {0} and {1} inclusive in increments of {2}. Please contact https://azure.microsoft.com/support to request limit increases beyond {1} RU/s. @@ -1033,6 +1033,9 @@ If you would like to serve this query through continuation tokens, then please r Zone Redundant Accounts are not supported in {0} Location yet. Please try other locations. + + Serverless accounts do not support analytics storage(i.e. EnableAnalyticsStorage=true). + Serverless accounts do not support multiple write locations(i.e. EnableMultipleWriteLocations=true). @@ -1226,30 +1229,12 @@ If you would like to serve this query through continuation tokens, then please r Unexpected status code for first Azure Key Vault Access. First request to get Azure Key Vault metadata should always return Unauthorized. - - The expected scope array should be of length 1. Instead received scope with length {0}. - - - The requested scope is not a well formed URI string. - - - The requested scope is not https. - - - The requested scope contains unexpected segments. - - + Cannot perform failover as it is disabled for the account. This partition key definition kind is not supported for partial partition key operations - - Collection name '{0}' is invalid for MongoDB API. - - - Database name '{0}' is invalid for MongoDB API. - There cannot be duplicate physical partition ids in x-ms-cosmos-target-partition-throughput-info header. @@ -1322,19 +1307,4 @@ If you would like to serve this query through continuation tokens, then please r Cross-tenant CMK is not supported with System Assigned identities as Default identities. Please use an User Assigned Identity instead. - - Federation cap action is not currently supported. - - - The given default identity for {0} is not valid. The format for the default identity is not valid, please use 'FirstPartyIdentity'/'SystemAssignedIdentity'/'UserAssignedIdentity=<UA_resource_id>' - - - The given default identity for {0} is not valid. The default identity points to a delegated identity that does not exist in {0}. - - - The given default identity for {0} is not valid. The default identity points to a system identity that does not exist in {0}. - - - The given default identity for {0} is not valid. The default identity points to an user identity that does not exist in {0}. - \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs b/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs index 5387a0fbac..dc02f9a248 100644 --- a/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs @@ -42,11 +42,32 @@ public class RequestOptions /// public Action AddRequestHeaders { get; set; } + /// + /// Gets or sets the priority level for a request. + /// + /// + /// Setting priority level only has an effect if Priority Based Execution is enabled. + /// If it is not enabled, the priority level is ignored by the backend. + /// Default PriorityLevel for each request is treated as High. It can be explicitly set to Low for some requests. + /// When Priority based execution is enabled, if there are more requests than the configured RU/S in a second, + /// then Cosmos DB will throttle low priority requests to allow high priority requests to execute. + /// This does not limit the throughput available to each priority level. Each priority level can consume the complete + /// provisioned throughput in absence of the other. If both priorities are present and the user goes above the + /// configured RU/s, low priority requests start getting throttled first to allow execution of mission critical workloads. + /// + /// +#if PREVIEW + public +#else + internal +#endif + PriorityLevel? PriorityLevel { get; set; } + /// /// Set Request Level Distributed Tracing Options. /// internal DistributedTracingOptions DistributedTracingOptions { get; set; } - + /// /// Gets or sets the boolean to use effective partition key routing in the cosmos db request. /// @@ -91,6 +112,11 @@ internal virtual void PopulateRequestOptions(RequestMessage request) request.Headers.Add(HttpConstants.HttpHeaders.IfNoneMatch, this.IfNoneMatchEtag); } + if (this.PriorityLevel.HasValue) + { + request.Headers.Add(HttpConstants.HttpHeaders.PriorityLevel, this.PriorityLevel.ToString()); + } + this.AddRequestHeaders?.Invoke(request.Headers); } diff --git a/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs b/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs index a9c475615a..d16d1c8bcc 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs @@ -83,7 +83,8 @@ internal static CosmosClientContext Create( handler: httpMessageHandler, sessionContainer: clientOptions.SessionContainer, cosmosClientId: cosmosClient.Id, - remoteCertificateValidationCallback: ClientContextCore.SslCustomValidationCallBack(clientOptions.ServerCertificateCustomValidationCallback)); + remoteCertificateValidationCallback: ClientContextCore.SslCustomValidationCallBack(clientOptions.ServerCertificateCustomValidationCallback), + isDistributedTracingEnabled: clientOptions.IsDistributedTracingEnabled); return ClientContextCore.Create( cosmosClient, diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs index 12db379f0c..9d0856507e 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosException.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.Cosmos using System; using System.Net; using System.Text; - using global::Azure.Core.Pipeline; + using global::Azure.Core; using Microsoft.Azure.Cosmos.Diagnostics; using Microsoft.Azure.Cosmos.Telemetry; using Microsoft.Azure.Cosmos.Tracing; diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs index 4e7aa73f54..cbee4c59ec 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosNullReferenceException.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos { using System; using System.Collections; - using global::Azure.Core.Pipeline; + using global::Azure.Core; using Microsoft.Azure.Cosmos.Diagnostics; using Microsoft.Azure.Cosmos.Telemetry; using Microsoft.Azure.Cosmos.Tracing; diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs index 64d5018f60..c6f097355d 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosObjectDisposedException.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.Cosmos using System; using System.Collections; using System.Globalization; - using global::Azure.Core.Pipeline; + using global::Azure.Core; using Microsoft.Azure.Cosmos.Diagnostics; using Microsoft.Azure.Cosmos.Telemetry; using Microsoft.Azure.Cosmos.Tracing; diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs index e21843656a..010d968bd0 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosExceptions/CosmosOperationCanceledException.cs @@ -7,7 +7,7 @@ namespace Microsoft.Azure.Cosmos using System; using System.Collections; using System.Runtime.Serialization; - using global::Azure.Core.Pipeline; + using global::Azure.Core; using Microsoft.Azure.Cosmos.Diagnostics; using Microsoft.Azure.Cosmos.Telemetry; using Microsoft.Azure.Cosmos.Tracing; diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs index 7d9e609ba3..14d405ffc6 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosResponseFactoryCore.cs @@ -276,6 +276,12 @@ public T ToObjectpublic(ResponseMessage responseMessage) return default; } + if (responseMessage.Content.Length == 0) + { + responseMessage.Content.Dispose(); + return default; + } + return this.serializerCore.FromStream(responseMessage.Content); } } diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/ComputedProperty.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/ComputedProperty.cs new file mode 100644 index 0000000000..9eaf5f806b --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/ComputedProperty.cs @@ -0,0 +1,53 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + using System.Collections.Generic; + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + /// + /// Represents a computed property definition in a Cosmos DB collection. + /// +#if PREVIEW + public +#else + internal +#endif + sealed class ComputedProperty + { + /// + /// Gets or sets the name of the computed property. + /// + /// + /// The name of the computed property. + /// + /// + /// Name of the computed property should be chosen such that it does not collide with any existing or future document properties. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the query for the computed property. + /// + /// + /// The query used to evaluate the value for the computed property. + /// + /// + /// For example: + /// SELECT VALUE LOWER(c.firstName) FROM c + /// + [JsonProperty(PropertyName = "query")] + public string Query { get; set; } + + /// + /// This contains additional values for scenarios where the SDK is not aware of new fields. + /// This ensures that if resource is read and updated none of the fields will be lost in the process. + /// + [JsonExtensionData] + internal IDictionary AdditionalProperties { get; private set; } + } +} diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs index 94cb93cff5..534f4f033d 100644 --- a/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/ContainerProperties.cs @@ -78,6 +78,9 @@ public class ContainerProperties [JsonProperty(PropertyName = "clientEncryptionPolicy", NullValueHandling = NullValueHandling.Ignore)] private ClientEncryptionPolicy clientEncryptionPolicyInternal; + [JsonProperty(PropertyName = "computedProperties", NullValueHandling = NullValueHandling.Ignore)] + private Collection computedProperties; + /// /// This contains additional values for scenarios where the SDK is not aware of new fields. /// This ensures that if resource is read and updated none of the fields will be lost in the process. @@ -286,6 +289,48 @@ public IndexingPolicy IndexingPolicy } } + /// + /// Gets or sets the collection containing objects in the container. + /// + /// + /// The collection containing objects associated with the container. + /// + + /// + /// Gets or sets the collection containing objects in the container. + /// + /// + /// The collection containing objects associated with the container. + /// + [JsonIgnore] +#if PREVIEW + public +#else + internal +#endif + Collection ComputedProperties + { + get + { + if (this.computedProperties == null) + { + this.computedProperties = new Collection(); + } + + return this.computedProperties; + } + + set + { + if (value == null) + { + throw new ArgumentException($"{nameof(value)}"); + } + + this.computedProperties = value; + } + } + /// /// Gets the associated with the container from the Azure Cosmos DB service. /// diff --git a/Microsoft.Azure.Cosmos/src/Resource/Settings/PriorityLevel.cs b/Microsoft.Azure.Cosmos/src/Resource/Settings/PriorityLevel.cs new file mode 100644 index 0000000000..6644d0931f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Resource/Settings/PriorityLevel.cs @@ -0,0 +1,39 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos +{ + /// + /// Valid values of Priority Level for a request + /// + /// + /// Setting priority level only has an effect if Priority Based Execution is enabled. + /// If it is not enabled, the priority level is ignored by the backend. + /// Default PriorityLevel for each request is treated as High. It can be explicitly set to Low for some requests. + /// When Priority based execution is enabled, if there are more requests than the configured RU/S in a second, + /// then Cosmos DB will throttle low priority requests to allow high priority requests to execute. + /// This does not limit the throughput available to each priority level. Each priority level can consume the complete + /// provisioned throughput in absence of the other. If both priorities are present and the user goes above the + /// configured RU/s, low priority requests start getting throttled first to allow execution of mission critical workloads. + /// + /// + +#if PREVIEW + public +#else + internal +#endif + enum PriorityLevel + { + /// + /// High Priority + /// + High = 1, + + /// + /// Low Priority + /// + Low = 2, + } +} diff --git a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs index eba425fb0d..d99be609ea 100644 --- a/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs +++ b/Microsoft.Azure.Cosmos/src/Routing/GatewayAddressCache.cs @@ -549,7 +549,7 @@ await this.GetServerAddressesViaGatewayAsync(request, collectionRid, new[] { par } } - this.ValidateUnhealthyPendingReplicas(transportAddressUris); + this.ValidateReplicaAddresses(transportAddressUris); return mergedAddresses; } @@ -840,12 +840,12 @@ await this.GetServerAddressesViaGatewayAsync( } /// - /// Validates the unhealthy pending replicas by attempting to open the Rntbd connection. This operation - /// will eventually marks the unhealthy pending replicas to healthy, if the rntbd connection attempt made was + /// Validates the unknown or unhealthy-pending replicas by attempting to open the Rntbd connection. This operation + /// will eventually marks the unknown or unhealthy-pending replicas to healthy, if the rntbd connection attempt made was /// successful or unhealthy otherwise. /// /// A read-only list of needs to be validated. - private void ValidateUnhealthyPendingReplicas( + private void ValidateReplicaAddresses( IReadOnlyList addresses) { if (addresses == null) @@ -853,15 +853,13 @@ private void ValidateUnhealthyPendingReplicas( throw new ArgumentNullException(nameof(addresses)); } - IEnumerable addressesNeedToValidation = addresses - .Where(address => address - .GetCurrentHealthState() - .GetHealthStatus() == TransportAddressHealthState.HealthStatus.UnhealthyPending); + IEnumerable addressesNeedToValidateStatus = this.GetAddressesNeededToValidateStatus( + transportAddresses: addresses); - if (addressesNeedToValidation.Any()) + if (addressesNeedToValidateStatus.Any()) { Task openConnectionsInBackgroundTask = Task.Run(async () => await this.openConnectionsHandler.TryOpenRntbdChannelsAsync( - addresses: addressesNeedToValidation.ToList())); + addresses: addressesNeedToValidateStatus)); } } @@ -919,6 +917,25 @@ private static PartitionAddressInformation MergeAddresses( return newAddresses; } + /// + /// Returns a list of needed to validate their health status. Validating + /// a uri is done by opening Rntbd connection to the backend replica, which is a costly operation by nature. Therefore + /// vaidating both Unhealthy and Unknown replicas at the same time could impose a high CPU utilization. To avoid this + /// situation, the RntbdOpenConnectionHandler has good concurrency control mechanism to open the connections gracefully/>. + /// + /// A read only list of s. + /// A list of that needs to validate their status. + private IEnumerable GetAddressesNeededToValidateStatus( + IReadOnlyList transportAddresses) + { + return transportAddresses + .Where(address => address + .GetCurrentHealthState() + .GetHealthStatus() is + TransportAddressHealthState.HealthStatus.Unknown or + TransportAddressHealthState.HealthStatus.UnhealthyPending); + } + protected virtual void Dispose(bool disposing) { if (this.disposedValue) diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs index d0ca7d8ac8..dde7d5a7c5 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetry.cs @@ -19,7 +19,6 @@ namespace Microsoft.Azure.Cosmos.Telemetry using Microsoft.Azure.Cosmos.Tracing.TraceData; using Microsoft.Azure.Documents; using Util; - using static Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum; /// /// This class collects and send all the telemetry information. @@ -29,16 +28,14 @@ namespace Microsoft.Azure.Cosmos.Telemetry /// internal class ClientTelemetry : IDisposable { - private const int allowedNumberOfFailures = 3; - private static readonly TimeSpan observingWindow = ClientTelemetryOptions.GetScheduledTimeSpan(); private readonly ClientTelemetryProperties clientTelemetryInfo; private readonly ClientTelemetryProcessor processor; private readonly DiagnosticsHandlerHelper diagnosticsHelper; - + private readonly NetworkDataRecorder networkDataRecorder; + private readonly CancellationTokenSource cancellationTokenSource; - private readonly GlobalEndpointManager globalEndpointManager; private Task telemetryTask; @@ -49,11 +46,6 @@ internal class ClientTelemetry : IDisposable private ConcurrentDictionary cacheRefreshInfoMap = new ConcurrentDictionary(); - private ConcurrentDictionary requestInfoMap - = new ConcurrentDictionary(); - - private int numberOfFailures = 0; - /// /// Only for Mocking in tests /// @@ -112,6 +104,8 @@ internal ClientTelemetry( GlobalEndpointManager globalEndpointManager) { this.diagnosticsHelper = diagnosticsHelper ?? throw new ArgumentNullException(nameof(diagnosticsHelper)); + this.globalEndpointManager = globalEndpointManager; + this.processor = new ClientTelemetryProcessor(httpClient, authorizationTokenProvider); this.clientTelemetryInfo = new ClientTelemetryProperties( @@ -122,8 +116,8 @@ internal ClientTelemetry( preferredRegions: preferredRegions, aggregationIntervalInSec: (int)observingWindow.TotalSeconds); + this.networkDataRecorder = new NetworkDataRecorder(); this.cancellationTokenSource = new CancellationTokenSource(); - this.globalEndpointManager = globalEndpointManager; } /// @@ -136,9 +130,9 @@ private void StartObserverTask() /// /// Task which does below operations , periodically - /// 1. Set Account information (one time at the time of initialization) - /// 2. Load VM metedata information (one time at the time of initialization) - /// 3. Calculate and Send telemetry Information to juno service (never ending task)/// + /// 1. Set Account information (one time during initialization) + /// 2. Load VM metedata information (one time during initialization) + /// 3. Calculate and Send telemetry Information to Client Telemetry Service (never ending task)/// /// Async Task private async Task EnrichAndSendAsync() { @@ -148,18 +142,12 @@ private async Task EnrichAndSendAsync() { while (!this.cancellationTokenSource.IsCancellationRequested) { - if (this.numberOfFailures == allowedNumberOfFailures) - { - this.Dispose(); - break; - } - if (string.IsNullOrEmpty(this.clientTelemetryInfo.GlobalDatabaseAccountName)) { AccountProperties accountProperties = await ClientTelemetryHelper.SetAccountNameAsync(this.globalEndpointManager); this.clientTelemetryInfo.GlobalDatabaseAccountName = accountProperties.Id; } - + await Task.Delay(observingWindow, this.cancellationTokenSource.Token); this.clientTelemetryInfo.DateTimeUtc = DateTime.UtcNow.ToString(ClientTelemetryOptions.DateFormat); @@ -180,26 +168,27 @@ private async Task EnrichAndSendAsync() ConcurrentDictionary cacheRefreshInfoSnapshot = Interlocked.Exchange(ref this.cacheRefreshInfoMap, new ConcurrentDictionary()); - ConcurrentDictionary requestInfoSnapshot - = Interlocked.Exchange(ref this.requestInfoMap, new ConcurrentDictionary()); + List requestInfoSnapshot = this.networkDataRecorder.GetRequests(); try { - await this.processor - .ProcessAndSendAsync( - clientTelemetryInfo: this.clientTelemetryInfo, - operationInfoSnapshot: operationInfoSnapshot, - cacheRefreshInfoSnapshot: cacheRefreshInfoSnapshot, - requestInfoSnapshot: requestInfoSnapshot, - cancellationToken: this.cancellationTokenSource.Token); - - this.numberOfFailures = 0; + CancellationTokenSource cancellationToken = new CancellationTokenSource(ClientTelemetryOptions.ClientTelemetryProcessorTimeOut); + Task processorTask = Task.Run(() => this.processor + .ProcessAndSendAsync( + clientTelemetryInfo: this.clientTelemetryInfo, + operationInfoSnapshot: operationInfoSnapshot, + cacheRefreshInfoSnapshot: cacheRefreshInfoSnapshot, + requestInfoSnapshot: requestInfoSnapshot, + cancellationToken: cancellationToken.Token), cancellationToken.Token); + + // Initiating Telemetry Data Processor task which will serialize and send telemetry information to Client Telemetry Service + // Not disposing this task. If we dispose a client then, telemetry job(telemetryTask) should stop but processor task(processorTask) should make best effort to finish the job in background. + _ = ClientTelemetry.RunProcessorTaskAsync(this.clientTelemetryInfo.DateTimeUtc, processorTask, ClientTelemetryOptions.ClientTelemetryProcessorTimeOut); + } catch (Exception ex) { - this.numberOfFailures++; - - DefaultTrace.TraceError("Telemetry Job Processor failed with error : {0}", ex); + DefaultTrace.TraceError("Exception while initiating processing task : {0} with telemetry date as {1}", ex.Message, this.clientTelemetryInfo.DateTimeUtc); } } } @@ -211,6 +200,33 @@ await this.processor DefaultTrace.TraceInformation("Telemetry Job Stopped."); } + /// + /// This Task makes sure, processing task is timing out after 5 minute of timeout + /// + /// + /// + /// + internal static async Task RunProcessorTaskAsync(string telemetryDate, Task processingTask, TimeSpan timeout) + { + using (CancellationTokenSource tokenForDelayTask = new CancellationTokenSource()) + { + Task delayTask = Task.Delay(timeout, tokenForDelayTask.Token); + + Task resultTask = await Task.WhenAny(processingTask, delayTask); + if (resultTask == delayTask) + { + DefaultTrace.TraceVerbose($"Processor task with date as {telemetryDate} is canceled as it did not finish in {timeout}"); + // Operation cancelled + throw new OperationCanceledException($"Processor task with date as {telemetryDate} is canceled as it did not finish in {timeout}"); + } + else + { + // Cancel the timer task so that it does not fire + tokenForDelayTask.Cancel(); + } + } + } + /// /// Collects Cache Telemetry Information. /// @@ -296,7 +312,7 @@ internal void CollectOperationInfo(CosmosDiagnostics cosmosDiagnostics, // Record Network/Replica Information SummaryDiagnostics summaryDiagnostics = new SummaryDiagnostics(trace); - this.RecordRntbdResponses(containerId, databaseId, summaryDiagnostics.StoreResponseStatistics.Value); + this.networkDataRecorder.Record(summaryDiagnostics.StoreResponseStatistics.Value, databaseId, containerId); string regionsContacted = ClientTelemetryHelper.GetContactedRegions(cosmosDiagnostics.GetContactedRegions()); @@ -338,37 +354,6 @@ internal void CollectOperationInfo(CosmosDiagnostics cosmosDiagnostics, } } - /// - /// Records RNTBD calls statistics - /// - /// - /// - /// - private void RecordRntbdResponses(string containerId, string databaseId, List storeResponseStatistics) - { - foreach (StoreResponseStatistics storetatistics in storeResponseStatistics) - { - if (ClientTelemetryOptions.IsEligible((int)storetatistics.StoreResult.StatusCode, (int)storetatistics.StoreResult.SubStatusCode, storetatistics.RequestLatency)) - { - RequestInfo requestInfo = new RequestInfo() - { - DatabaseName = databaseId, - ContainerName = containerId, - Uri = storetatistics.StoreResult.StorePhysicalAddress.ToString(), - StatusCode = (int)storetatistics.StoreResult.StatusCode, - SubStatusCode = (int)storetatistics.StoreResult.SubStatusCode, - Resource = storetatistics.RequestResourceType.ToString(), - Operation = storetatistics.RequestOperationType.ToString(), - }; - - LongConcurrentHistogram latencyHist = this.requestInfoMap.GetOrAdd(requestInfo, x => new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, - ClientTelemetryOptions.RequestLatencyMax, - ClientTelemetryOptions.RequestLatencyPrecision)); - latencyHist.RecordValue(storetatistics.RequestLatency.Ticks); - } - } - } - /// /// Dispose of cosmos client.It will get disposed with client so not making it thread safe. /// diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryOptions.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryOptions.cs index f2caaf50d5..2aeaadca63 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryOptions.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryOptions.cs @@ -79,26 +79,29 @@ internal static class ClientTelemetryOptions internal const double Percentile99 = 99.0; internal const double Percentile999 = 99.9; internal const string DateFormat = "yyyy-MM-ddTHH:mm:ssZ"; - internal const string EnvPropsClientTelemetrySchedulingInSeconds = "COSMOS.CLIENT_TELEMETRY_SCHEDULING_IN_SECONDS"; internal const string EnvPropsClientTelemetryEnabled = "COSMOS.CLIENT_TELEMETRY_ENABLED"; internal const string EnvPropsClientTelemetryVmMetadataUrl = "COSMOS.VM_METADATA_URL"; internal const string EnvPropsClientTelemetryEndpoint = "COSMOS.CLIENT_TELEMETRY_ENDPOINT"; internal const string EnvPropsClientTelemetryEnvironmentName = "COSMOS.ENVIRONMENT_NAME"; - + internal static readonly ResourceType AllowedResourceTypes = ResourceType.Document; // Why 5 sec? As of now, if any network request is taking more than 5 millisecond sec, we will consider it slow request this value can be revisited in future - private static readonly TimeSpan NetworkLatencyThreshold = TimeSpan.FromMilliseconds(5); + internal static readonly TimeSpan NetworkLatencyThreshold = TimeSpan.FromMilliseconds(5); + internal static readonly int NetworkRequestsSampleSizeThreshold = 10; + internal static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, MaxDepth = 64, // https://github.com/advisories/GHSA-5crp-9r3c-p9vr }; - private static readonly List ExcludedStatusCodes = new List { 404, 409 }; + internal static readonly List ExcludedStatusCodes = new List { 404, 409, 412 }; + internal static readonly int NetworkTelemetrySampleSize = 200; internal static int PayloadSizeThreshold = 1024 * 1024 * 2; // 2MB - + internal static TimeSpan ClientTelemetryProcessorTimeOut = TimeSpan.FromMinutes(5); + private static Uri clientTelemetryEndpoint; private static string environmentName; private static TimeSpan scheduledTimeSpan = TimeSpan.Zero; @@ -180,32 +183,5 @@ internal static string GetEnvironmentName() } return environmentName; } - - /// - /// This method will return true if the request is failed with User or Server Exception and not excluded from telemetry. - /// This method will return true if the request latency is more than the threshold. - /// otherwise return false - /// - /// - /// - /// - /// true/false - internal static bool IsEligible(int statusCode, int subStatusCode, TimeSpan latencyInMs) - { - return - ClientTelemetryOptions.IsStatusCodeNotExcluded(statusCode, subStatusCode) && - (ClientTelemetryOptions.IsUserOrServerError(statusCode) || latencyInMs >= ClientTelemetryOptions.NetworkLatencyThreshold); - } - - private static bool IsUserOrServerError(int statusCode) - { - return statusCode >= 400 && statusCode <= 599; - } - - private static bool IsStatusCodeNotExcluded(int statusCode, int subStatusCode) - { - return !(ClientTelemetryOptions.ExcludedStatusCodes.Contains(statusCode) && subStatusCode == 0); - } - } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryPayloadWriter.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryPayloadWriter.cs index 1158c7d639..370d576fcc 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryPayloadWriter.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryPayloadWriter.cs @@ -21,7 +21,7 @@ public static async Task SerializedPayloadChunksAsync( ClientTelemetryProperties properties, ConcurrentDictionary operationInfoSnapshot, ConcurrentDictionary cacheRefreshInfoSnapshot, - ConcurrentDictionary requestInfoSnapshot, + IReadOnlyList sampledRequestInfo, Func callback) { if (properties == null) @@ -46,11 +46,12 @@ public static async Task SerializedPayloadChunksAsync( OperationInfo payloadForRequestCharge = payloadForLatency.Copy(); payloadForRequestCharge.MetricInfo = new MetricInfo(ClientTelemetryOptions.RequestChargeName, ClientTelemetryOptions.RequestChargeUnit); payloadForRequestCharge.SetAggregators(entry.Value.requestcharge, ClientTelemetryOptions.HistogramPrecisionFactor); - + string latencyMetrics = JsonConvert.SerializeObject(payloadForLatency); string requestChargeMetrics = JsonConvert.SerializeObject(payloadForRequestCharge); - - if (lengthNow + latencyMetrics.Length + requestChargeMetrics.Length > ClientTelemetryOptions.PayloadSizeThreshold) + + int thisSectionLength = latencyMetrics.Length + requestChargeMetrics.Length; + if (lengthNow + thisSectionLength > ClientTelemetryOptions.PayloadSizeThreshold) { writer.WriteEndArray(); writer.WriteEndObject(); @@ -98,21 +99,16 @@ public static async Task SerializedPayloadChunksAsync( } - if (requestInfoSnapshot?.Any() == true) + if (sampledRequestInfo?.Any() == true) { writer.WritePropertyName("requestInfo"); writer.WriteStartArray(); - foreach (KeyValuePair entry in requestInfoSnapshot) + foreach (RequestInfo entry in sampledRequestInfo) { long lengthNow = stringBuilder.Length; - - MetricInfo metricInfo = new MetricInfo(ClientTelemetryOptions.RequestLatencyName, ClientTelemetryOptions.RequestLatencyUnit); - metricInfo.SetAggregators(entry.Value, ClientTelemetryOptions.TicksToMsFactor); - - RequestInfo payloadForLatency = entry.Key; - payloadForLatency.Metrics.Add(metricInfo); - string latencyMetrics = JsonConvert.SerializeObject(payloadForLatency); + + string latencyMetrics = JsonConvert.SerializeObject(entry); if (lengthNow + latencyMetrics.Length > ClientTelemetryOptions.PayloadSizeThreshold) { diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs index b91eb96832..c9511cb4e4 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/ClientTelemetryProcessor.cs @@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos.Telemetry { using System; using System.Collections.Concurrent; + using System.Collections.Generic; using System.Net.Http; using System.Text; using System.Threading; @@ -22,7 +23,7 @@ internal class ClientTelemetryProcessor private readonly AuthorizationTokenProvider tokenProvider; private readonly CosmosHttpClient httpClient; - + internal ClientTelemetryProcessor(CosmosHttpClient httpClient, AuthorizationTokenProvider tokenProvider) { this.httpClient = httpClient ?? throw new ArgumentNullException(nameof(httpClient)); @@ -32,17 +33,12 @@ internal ClientTelemetryProcessor(CosmosHttpClient httpClient, AuthorizationToke /// /// It will create Task to process and send client telemetry payload to Client Telemetry Service. /// - /// - /// - /// - /// - /// /// Task internal async Task ProcessAndSendAsync( ClientTelemetryProperties clientTelemetryInfo, - ConcurrentDictionary operationInfoSnapshot, + ConcurrentDictionary operationInfoSnapshot, ConcurrentDictionary cacheRefreshInfoSnapshot, - ConcurrentDictionary requestInfoSnapshot, + IReadOnlyList requestInfoSnapshot, CancellationToken cancellationToken) { try @@ -51,7 +47,7 @@ await ClientTelemetryPayloadWriter.SerializedPayloadChunksAsync( properties: clientTelemetryInfo, operationInfoSnapshot: operationInfoSnapshot, cacheRefreshInfoSnapshot: cacheRefreshInfoSnapshot, - requestInfoSnapshot: requestInfoSnapshot, + sampledRequestInfo: requestInfoSnapshot, callback: async (payload) => await this.SendAsync(clientTelemetryInfo.GlobalDatabaseAccountName, payload, cancellationToken)); } catch (Exception ex) diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/Models/RequestInfo.cs b/Microsoft.Azure.Cosmos/src/Telemetry/Models/RequestInfo.cs index d71f0fa446..382f37260d 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/Models/RequestInfo.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/Models/RequestInfo.cs @@ -37,8 +37,14 @@ internal sealed class RequestInfo public override int GetHashCode() { - int hash = 3; + int hash = this.GetHashCodeForSampler(); hash = (hash * 7) ^ (this.Uri == null ? 0 : this.Uri.GetHashCode()); + return hash; + } + + public int GetHashCodeForSampler() + { + int hash = 3; hash = (hash * 7) ^ (this.DatabaseName == null ? 0 : this.DatabaseName.GetHashCode()); hash = (hash * 7) ^ (this.ContainerName == null ? 0 : this.ContainerName.GetHashCode()); hash = (hash * 7) ^ (this.Operation == null ? 0 : this.Operation.GetHashCode()); @@ -47,7 +53,7 @@ public override int GetHashCode() hash = (hash * 7) ^ (this.SubStatusCode.GetHashCode()); return hash; } - + public override bool Equals(object obj) { bool isequal = obj is RequestInfo payload && @@ -62,5 +68,26 @@ public override bool Equals(object obj) return isequal; } + public double GetP99Latency() + { + foreach (MetricInfo metric in this.Metrics) + { + if (metric.MetricsName.Equals(ClientTelemetryOptions.RequestLatencyName, StringComparison.OrdinalIgnoreCase)) + { + return metric.Percentiles[ClientTelemetryOptions.Percentile99]; + } + } + return Double.MinValue; // least prioity for request info w/o latency info + } + + public double GetSampleCount() + { + return (double)this.Metrics[0].Count; + } + + public override string ToString() + { + return "Latency : " + this.GetP99Latency() + ", SampleCount : " + this.GetSampleCount(); + } } } diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/NetworkDataRecorder.cs b/Microsoft.Azure.Cosmos/src/Telemetry/NetworkDataRecorder.cs new file mode 100644 index 0000000000..20e6f975da --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Telemetry/NetworkDataRecorder.cs @@ -0,0 +1,139 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Telemetry +{ + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Threading; + using HdrHistogram; + using Microsoft.Azure.Cosmos.Telemetry.Models; + using static Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum; + + internal class NetworkDataRecorder + { + private ConcurrentDictionary RequestInfoHighLatencyBucket + = new ConcurrentDictionary(); + private ConcurrentDictionary RequestInfoErrorBucket + = new ConcurrentDictionary(); + + public void Record(List storeResponseStatistics, string databaseId, string containerId) + { + foreach (StoreResponseStatistics storeStatistics in storeResponseStatistics) + { + if (NetworkDataRecorder.IsStatusCodeNotExcluded((int)storeStatistics.StoreResult.StatusCode, (int)storeStatistics.StoreResult.SubStatusCode)) + { + if (NetworkDataRecorder.IsUserOrServerError((int)storeStatistics.StoreResult.StatusCode)) + { + RequestInfo requestInfo = this.CreateRequestInfo(storeStatistics, databaseId, containerId); + LongConcurrentHistogram latencyHist = this.RequestInfoErrorBucket.GetOrAdd(requestInfo, x => new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, + ClientTelemetryOptions.RequestLatencyMax, + ClientTelemetryOptions.RequestLatencyPrecision)); + latencyHist.RecordValue(storeStatistics.RequestLatency.Ticks); + + } + else + { + RequestInfo requestInfo = this.CreateRequestInfo(storeStatistics, databaseId, containerId); + LongConcurrentHistogram latencyHist = this.RequestInfoHighLatencyBucket.GetOrAdd(requestInfo, x => new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, + ClientTelemetryOptions.RequestLatencyMax, + ClientTelemetryOptions.RequestLatencyPrecision)); + latencyHist.RecordValue(storeStatistics.RequestLatency.Ticks); + } + } + } + } + + internal void GetErroredRequests(List requestInfoList) + { + ConcurrentDictionary requestInfoErrorList + = Interlocked.Exchange(ref this.RequestInfoErrorBucket, new ConcurrentDictionary()); + + List allRequests = new List(); + foreach (KeyValuePair entry in requestInfoErrorList) + { + MetricInfo metricInfo = new MetricInfo(ClientTelemetryOptions.RequestLatencyName, ClientTelemetryOptions.RequestLatencyUnit); + metricInfo.SetAggregators(entry.Value, ClientTelemetryOptions.TicksToMsFactor); + + RequestInfo payloadForLatency = entry.Key; + payloadForLatency.Metrics.Add(metricInfo); + + allRequests.Add(payloadForLatency); + } + + requestInfoList.AddRange(DataSampler.OrderAndSample(allRequests, DataSampleCountComparer.Instance)); + } + + internal void GetHighLatencyRequests(List requestInfoList) + { + ConcurrentDictionary requestInfoHighLatencyList + = Interlocked.Exchange(ref this.RequestInfoHighLatencyBucket, new ConcurrentDictionary()); + + List allRequests = new List(); + foreach (KeyValuePair entry in requestInfoHighLatencyList) + { + MetricInfo metricInfo = new MetricInfo(ClientTelemetryOptions.RequestLatencyName, ClientTelemetryOptions.RequestLatencyUnit); + metricInfo.SetAggregators(entry.Value, ClientTelemetryOptions.TicksToMsFactor); + + // Don't record if p99 latency is less than threshold + if (!NetworkDataRecorder.IsHighLatency(metricInfo.Percentiles[ClientTelemetryOptions.Percentile99])) + { + continue; + } + + RequestInfo payloadForLatency = entry.Key; + payloadForLatency.Metrics.Add(metricInfo); + + allRequests.Add(payloadForLatency); + } + + requestInfoList.AddRange(DataSampler.OrderAndSample(allRequests, DataLatencyComparer.Instance)); + } + + internal RequestInfo CreateRequestInfo(StoreResponseStatistics storeResponseStatistic, string databaseId, string containerId) + { + return new RequestInfo() + { + DatabaseName = databaseId, + ContainerName = containerId, + Uri = storeResponseStatistic.StoreResult?.StorePhysicalAddress?.ToString(), + StatusCode = (int)storeResponseStatistic.StoreResult?.StatusCode, + SubStatusCode = (int)storeResponseStatistic.StoreResult?.SubStatusCode, + Resource = storeResponseStatistic.RequestResourceType.ToString(), + Operation = storeResponseStatistic.RequestOperationType.ToString(), + }; + + } + + public List GetRequests() + { + List requestInfoList = new List(); + this.GetErroredRequests(requestInfoList); + this.GetHighLatencyRequests(requestInfoList); + + return requestInfoList; + } + + internal static bool IsHighLatency(double latency) + { + return + latency >= ClientTelemetryOptions.NetworkLatencyThreshold.TotalMilliseconds; + } + + /// + /// This method will return true if the request is failed with User or Server Exception and not excluded from telemetry. + /// otherwise return false + /// + /// true/false + internal static bool IsUserOrServerError(int statusCode) + { + return statusCode >= 400 && statusCode <= 599; + } + + internal static bool IsStatusCodeNotExcluded(int statusCode, int subStatusCode) + { + return !(ClientTelemetryOptions.ExcludedStatusCodes.Contains(statusCode) && subStatusCode == 0); + } + } +} diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs index e7c4d96cc2..755e1e3a66 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryAttributeKeys.cs @@ -20,7 +20,7 @@ internal sealed class OpenTelemetryAttributeKeys // Cosmos Db Specific public const string ClientId = "db.cosmosdb.client_id"; public const string MachineId = "db.cosmosdb.machine_id"; - public const string UserAgent = "db.cosmosdb.user_agent"; + public const string UserAgent = "user_agent.original"; // Compliant with open telemetry conventions public const string ConnectionMode = "db.cosmosdb.connection_mode"; public const string OperationType = "db.cosmosdb.operation_type"; diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryCoreRecorder.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryCoreRecorder.cs index 51aa1ee794..c199c0727c 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryCoreRecorder.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryCoreRecorder.cs @@ -6,7 +6,7 @@ namespace Microsoft.Azure.Cosmos.Telemetry { using System; using System.Collections.Generic; - using global::Azure.Core.Pipeline; + using global::Azure.Core; /// /// This class is used to add information in an Activity tags ref. https://github.com/Azure/azure-cosmos-dotnet-v3/issues/3058 diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryRecorderFactory.cs b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryRecorderFactory.cs index 6c88b3d5db..51b4666b6f 100644 --- a/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryRecorderFactory.cs +++ b/Microsoft.Azure.Cosmos/src/Telemetry/OpenTelemetry/OpenTelemetryRecorderFactory.cs @@ -5,7 +5,7 @@ namespace Microsoft.Azure.Cosmos.Telemetry { using System; - using global::Azure.Core.Pipeline; + using global::Azure.Core; /// /// This class is used to generate Activities with Azure.Cosmos.Operation Source Name @@ -28,7 +28,8 @@ public static OpenTelemetryCoreRecorder CreateRecorder(string operationName, { OpenTelemetryRecorderFactory.ScopeFactory ??= new DiagnosticScopeFactory(clientNamespace: OpenTelemetryAttributeKeys.DiagnosticNamespace, resourceProviderNamespace: OpenTelemetryAttributeKeys.ResourceProviderNamespace, - isActivityEnabled: true); + isActivityEnabled: true, + suppressNestedClientActivities: true); // If there is no source then it will return default otherwise a valid diagnostic scope DiagnosticScope scope = OpenTelemetryRecorderFactory diff --git a/Microsoft.Azure.Cosmos/src/Telemetry/Sampler/DataSampler.cs b/Microsoft.Azure.Cosmos/src/Telemetry/Sampler/DataSampler.cs new file mode 100644 index 0000000000..b01e723365 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/Telemetry/Sampler/DataSampler.cs @@ -0,0 +1,84 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Telemetry +{ + using System; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using Microsoft.Azure.Cosmos.Query.Core.Pipeline.CrossPartition.OrderBy; + using Microsoft.Azure.Cosmos.Telemetry.Models; + using Newtonsoft.Json.Linq; + + /// + /// Sampler to select top N unique records and return true/false on the basis of elements already selected. + /// + internal sealed class DataSampler + { + public static List OrderAndSample(List requestInfoList, IComparer comparer) + { + // It will store final result + List sampledData = new List(capacity: requestInfoList.Count); + + // Processing (Grouping, Sorting will happen in this collection) + IDictionary> sampledRawData = new Dictionary>(); + + foreach (RequestInfo requestInfo in requestInfoList) + { + // Get a unique key identifier for an object + int key = requestInfo.GetHashCodeForSampler(); + + // Check if similar object is already present otherwise create a new list and add + if (sampledRawData.TryGetValue(key, out List groupedData)) + { + groupedData.Add(requestInfo); + sampledRawData[key] = groupedData; + } + else + { + sampledRawData.Add(key, new List() { requestInfo }); + } + } + + // If list is greater than threshold then sort it and get top N objects otherwise add list as it is + foreach (List sampledRequestInfo in sampledRawData.Values) + { + if (sampledRequestInfo.Count > ClientTelemetryOptions.NetworkRequestsSampleSizeThreshold) + { + sampledRequestInfo.Sort(comparer); + sampledData.AddRange(sampledRequestInfo.GetRange( + index: 0, + count: ClientTelemetryOptions.NetworkRequestsSampleSizeThreshold)); + } + else + { + sampledData.AddRange(sampledRequestInfo); + } + } + + return sampledData; + } + + } + + internal class DataLatencyComparer : IComparer + { + public static DataLatencyComparer Instance = new DataLatencyComparer(); + public int Compare(RequestInfo a, RequestInfo b) + { + return b.GetP99Latency().CompareTo(a.GetP99Latency()); + } + } + + internal class DataSampleCountComparer : IComparer + { + public static DataSampleCountComparer Instance = new DataSampleCountComparer(); + public int Compare(RequestInfo a, RequestInfo b) + { + return b.GetSampleCount().CompareTo(a.GetSampleCount()); + } + } + +} diff --git a/Microsoft.Azure.Cosmos/src/Tracing/TraceData/SummaryDiagnostics.cs b/Microsoft.Azure.Cosmos/src/Tracing/TraceData/SummaryDiagnostics.cs index 1838cb72c5..3a50b96841 100644 --- a/Microsoft.Azure.Cosmos/src/Tracing/TraceData/SummaryDiagnostics.cs +++ b/Microsoft.Azure.Cosmos/src/Tracing/TraceData/SummaryDiagnostics.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.Tracing.TraceData using System; using System.Collections.Generic; using System.Globalization; + using System.Linq; using Microsoft.Azure.Cosmos.Json; using static Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum; @@ -73,10 +74,7 @@ private void AggregateGatewayStatistics(IReadOnlyList + /// Gets the sub status code as a comma separated value from the http response message headers. + /// If the sub status code header is not found, then returns null. + /// + /// An instance of . + /// A string containing the sub status code. + private static string GetSubStatusCodes( + HttpResponseStatistics httpResponseStatistics) + { + return httpResponseStatistics + .HttpResponseMessage + .Headers + .TryGetValues( + name: Documents.WFConstants.BackendHeaders.SubStatus, + values: out IEnumerable httpResponseHeaderValues) ? + httpResponseHeaderValues.FirstOrDefault() : + null; + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs b/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs index 6c52eac07c..132b000d10 100644 --- a/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs +++ b/Microsoft.Azure.Cosmos/src/direct/AddressEnumerator.cs @@ -45,7 +45,7 @@ public IEnumerable GetTransportAddresses(IReadOnlyList UnhealthyPending > Unhealthy. + // Connected > Unknown > UnhealthyPending > Unhealthy. // Scenario 2: When replica validation is disabled, the replicas will be reordered by the preference of // Connected/Unknown/UnhealthyPending > Unhealthy. return AddressEnumerator.ReorderReplicasByHealthStatus( @@ -194,7 +194,7 @@ private static void Swap( /// /// Reorders the replica set to prefer the healthy replicas over the unhealthy ones. When replica address validation - /// is enabled, the address enumerator will pick the replicas in the order of their health statuses: Connected/ + /// is enabled, the address enumerator will pick the replicas in the order of their health statuses: Connected > /// Unknown > UnhealthyPending > Unhealthy. When replica address validation is disabled, the address enumerator will /// transition away Unknown/UnhealthyPending replicas and pick the replicas by preferring any of the Connected/ Unknown /// / UnhealthyPending over the Unhealthy ones. @@ -232,7 +232,7 @@ private static IEnumerable ReorderReplicasByHealthStatus( /// /// When replica address validation is enabled, the address enumerator will pick the replicas in the order of their health statuses: - /// Connected/Unknown > UnhealthyPending > Unhealthy. The open connection handler will be used to transit away unknown/unhealthy pending status. + /// Connected >> Unknown >> UnhealthyPending >> Unhealthy. The open connection handler will be used to transit away unknown/unhealthy pending status. /// But in case open connection request can not happen/ finish due to any reason, then after some extended time (for example 1 minute), /// the address enumerator will mark Unknown/ Unhealthy pending into Healthy category (please check details of TransportAddressUri.GetEffectiveHealthStatus()) /// @@ -243,18 +243,22 @@ private static IEnumerable ReorderAddressesWhenReplicaValid IEnumerable addresses, HashSet failedReplicasPerRequest) { - List failedReplicas = null, pendingReplicas = null; - foreach(TransportAddressUri transportAddressUri in addresses) + List unknownReplicas = null, failedReplicas = null, pendingReplicas = null; + foreach (TransportAddressUri transportAddressUri in addresses) { TransportAddressHealthState.HealthStatus status = AddressEnumerator.GetEffectiveStatus( addressUri: transportAddressUri, failedEndpoints: failedReplicasPerRequest); - if (status == TransportAddressHealthState.HealthStatus.Connected || - status == TransportAddressHealthState.HealthStatus.Unknown) + if (status == TransportAddressHealthState.HealthStatus.Connected) { yield return transportAddressUri; } + else if (status == TransportAddressHealthState.HealthStatus.Unknown) + { + unknownReplicas ??= new (); + unknownReplicas.Add(transportAddressUri); + } else if (status == TransportAddressHealthState.HealthStatus.UnhealthyPending) { pendingReplicas ??= new (); @@ -267,6 +271,14 @@ private static IEnumerable ReorderAddressesWhenReplicaValid } } + if (unknownReplicas != null) + { + foreach (TransportAddressUri transportAddressUri in unknownReplicas) + { + yield return transportAddressUri; + } + } + if (pendingReplicas != null) { foreach (TransportAddressUri transportAddressUri in pendingReplicas) @@ -275,7 +287,7 @@ private static IEnumerable ReorderAddressesWhenReplicaValid } } - if(failedReplicas != null) + if (failedReplicas != null) { foreach (TransportAddressUri transportAddressUri in failedReplicas) { diff --git a/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/AppContextSwitchHelper.cs b/Microsoft.Azure.Cosmos/src/direct/Azure.Core/AppContextSwitchHelper.cs similarity index 89% rename from Microsoft.Azure.Cosmos/src/OSS/Azure.Core/AppContextSwitchHelper.cs rename to Microsoft.Azure.Cosmos/src/direct/Azure.Core/AppContextSwitchHelper.cs index d7e25b35c3..58c75dd5b9 100644 --- a/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/AppContextSwitchHelper.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Azure.Core/AppContextSwitchHelper.cs @@ -5,7 +5,7 @@ // This File is copied from Azure.Core repo i.e. https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/Shared/AppContextSwitchHelper.cs #nullable enable - +#if NETSTANDARD2_0_OR_GREATER namespace Azure.Core { using System; @@ -32,7 +32,9 @@ public static bool GetConfigValue(string appContexSwitchName, string environment } // AppContext switch wasn't used. Check the environment variable. string? envVar = Environment.GetEnvironmentVariable(environmentVariableName); - if (envVar != null && (envVar.Equals("true", StringComparison.OrdinalIgnoreCase) || envVar.Equals("1"))) + if (envVar != null + && (envVar.Equals("true", StringComparison.OrdinalIgnoreCase) + || envVar.Equals("1", StringComparison.OrdinalIgnoreCase))) { return true; } @@ -42,3 +44,4 @@ public static bool GetConfigValue(string appContexSwitchName, string environment } } } +#endif \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/DiagnosticScope.cs b/Microsoft.Azure.Cosmos/src/direct/Azure.Core/DiagnosticScope.cs similarity index 55% rename from Microsoft.Azure.Cosmos/src/OSS/Azure.Core/DiagnosticScope.cs rename to Microsoft.Azure.Cosmos/src/direct/Azure.Core/DiagnosticScope.cs index ca05f6cabb..38d58158ce 100644 --- a/Microsoft.Azure.Cosmos/src/OSS/Azure.Core/DiagnosticScope.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Azure.Core/DiagnosticScope.cs @@ -1,42 +1,52 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. // This File is copied from Azure.Core repo. i.e. https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/Shared/DiagnosticScope.cs +#nullable enable +#if NETSTANDARD2_0_OR_GREATER #nullable enable -namespace Azure.Core.Pipeline +using System; +using System.Collections; +using System.Collections.Concurrent; +using System.Collections.Generic; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Linq.Expressions; +using System.Reflection; + +namespace Azure.Core { - using System; - using System.Collections; - using System.Collections.Concurrent; - using System.Collections.Generic; - using System.Diagnostics; - using System.Globalization; - using System.Linq.Expressions; - using System.Reflection; - internal readonly struct DiagnosticScope : IDisposable { - private static readonly ConcurrentDictionary ActivitySources = new (); + private const string AzureSdkScopeLabel = "az.sdk.scope"; + internal const string OpenTelemetrySchemaAttribute = "az.schema_url"; + internal const string OpenTelemetrySchemaVersion = "https://opentelemetry.io/schemas/1.17.0"; + private static readonly object AzureSdkScopeValue = bool.TrueString; + private static readonly ConcurrentDictionary ActivitySources = new(); - private readonly ActivityAdapter? activityAdapter; + private readonly ActivityAdapter? _activityAdapter; + private readonly bool _suppressNestedClientActivities; - internal DiagnosticScope(string ns, string scopeName, DiagnosticListener source, ActivityKind kind) + internal DiagnosticScope(string ns, string scopeName, DiagnosticListener source, ActivityKind kind, bool suppressNestedClientActivities) : + this(scopeName, source, null, GetActivitySource(ns, scopeName), kind, suppressNestedClientActivities) { - object? activitySource = GetActivitySource(ns, scopeName); - - this.IsEnabled = source.IsEnabled() || ActivityExtensions.ActivitySourceHasListeners(activitySource); - - this.activityAdapter = this.IsEnabled ? new ActivityAdapter(activitySource, source, scopeName, kind, null) : null; } - internal DiagnosticScope(string scopeName, DiagnosticListener source, object? diagnosticSourceArgs, object? activitySource, ActivityKind kind) + internal DiagnosticScope(string scopeName, DiagnosticListener source, object? diagnosticSourceArgs, object? activitySource, ActivityKind kind, bool suppressNestedClientActivities) { - this.IsEnabled = source.IsEnabled() || ActivityExtensions.ActivitySourceHasListeners(activitySource); + // ActivityKind.Internal and Client both can represent public API calls depending on the SDK + _suppressNestedClientActivities = (kind == ActivityKind.Client || kind == ActivityKind.Internal) ? suppressNestedClientActivities : false; + + // outer scope presence is enough to suppress any inner scope, regardless of inner scope configuation. + IsEnabled = source.IsEnabled() || ActivityExtensions.ActivitySourceHasListeners(activitySource); - this.activityAdapter = this.IsEnabled ? new ActivityAdapter(activitySource, source, scopeName, kind, diagnosticSourceArgs) : null; + if (_suppressNestedClientActivities) + { + IsEnabled &= !AzureSdkScopeValue.Equals(Activity.Current?.GetCustomProperty(AzureSdkScopeLabel)); + } + _activityAdapter = IsEnabled ? new ActivityAdapter(activitySource, source, scopeName, kind, diagnosticSourceArgs) : null; } public bool IsEnabled { get; } @@ -54,21 +64,23 @@ internal DiagnosticScope(string scopeName, DiagnosticListener source, object? di { return null; } - + string clientName = ns; int indexOfDot = name.IndexOf(".", StringComparison.OrdinalIgnoreCase); - if (indexOfDot == -1) + if (indexOfDot != -1) { - return null; + clientName += "." + name.Substring(0, indexOfDot); } - - string clientName = ns + "." + name.Substring(0, indexOfDot); - return ActivitySources.GetOrAdd(clientName, static n => ActivityExtensions.CreateActivitySource(n)); } - public void AddAttribute(string name, string? value) + public void AddAttribute(string name, string value) { - this.activityAdapter?.AddTag(name, value); + _activityAdapter?.AddTag(name, value); + } + + public void AddIntegerAttribute(string name, int value) + { + _activityAdapter?.AddTag(name, value); } public void AddAttribute(string name, @@ -77,42 +89,55 @@ public void AddAttribute(string name, #endif T value) { - this.AddAttribute(name, value, static v => Convert.ToString(v, CultureInfo.InvariantCulture) ?? string.Empty); + AddAttribute(name, value, static v => Convert.ToString(v, CultureInfo.InvariantCulture) ?? string.Empty); } public void AddAttribute(string name, T value, Func format) { - if (this.activityAdapter != null) + if (_activityAdapter != null) { var formattedValue = format(value); - this.activityAdapter.AddTag(name, formattedValue); + _activityAdapter.AddTag(name, formattedValue); } } - public void AddLink(string traceparent, string tracestate, IDictionary? attributes = null) + /// + /// Adds a link to the scope. This must be called before has been called for the DiagnosticScope. + /// + /// The traceparent for the link. + /// The tracestate for the link. + /// Optional attributes to associate with the link. + public void AddLink(string traceparent, string? tracestate, IDictionary? attributes = null) { - this.activityAdapter?.AddLink(traceparent, tracestate, attributes); + _activityAdapter?.AddLink(traceparent, tracestate, attributes); } - public void Start() { - this.activityAdapter?.Start(); + Activity? started = _activityAdapter?.Start(); + started?.SetCustomProperty(AzureSdkScopeLabel, AzureSdkScopeValue); } - public void SetStartTime(DateTime dateTime) { - this.activityAdapter?.SetStartTime(dateTime); + _activityAdapter?.SetStartTime(dateTime); } + /// + /// Sets the trace context for the current scope. + /// + /// The trace parent to set for the current scope. + /// The trace state to set for the current scope. + public void SetTraceContext(string traceparent, string? tracestate = default) + { + _activityAdapter?.SetTraceContext(traceparent, tracestate); + } public void Dispose() { // Reverse the Start order - this.activityAdapter?.Dispose(); + _activityAdapter?.Dispose(); } - public void Failed(Exception e) { - this.activityAdapter?.MarkFailed(e); + _activityAdapter?.MarkFailed(e); } /// @@ -153,71 +178,49 @@ private class DiagnosticActivity : Activity public new IEnumerable Links { get; set; } = Array.Empty(); #pragma warning restore 109 - public DiagnosticActivity(string operationName) - : base(operationName) + public DiagnosticActivity(string operationName) : base(operationName) { } } - private class ActivityAdapter : IDisposable { - private readonly DiagnosticSource diagnosticSource; - private readonly object? activitySource; - private readonly string activityName; - private readonly ActivityKind kind; - private object? diagnosticSourceArgs; - - private Activity? currentActivity; - private ICollection>? tagCollection; - private DateTimeOffset startTime; - private List? links; - + private readonly object? _activitySource; + private readonly DiagnosticSource _diagnosticSource; + private readonly string _activityName; + private readonly ActivityKind _kind; + private readonly object? _diagnosticSourceArgs; + + private Activity? _currentActivity; + private ICollection>? _tagCollection; + private DateTimeOffset _startTime; + private List? _links; + private string? _traceparent; + private string? _tracestate; public ActivityAdapter(object? activitySource, DiagnosticSource diagnosticSource, string activityName, ActivityKind kind, object? diagnosticSourceArgs) { - this.activitySource = activitySource; - this.diagnosticSource = diagnosticSource; - this.activityName = activityName; - this.kind = kind; - this.diagnosticSourceArgs = diagnosticSourceArgs; - - switch (this.kind) - { - case ActivityKind.Internal: - this.AddTag("kind", "internal"); - break; - case ActivityKind.Server: - this.AddTag("kind", "server"); - break; - case ActivityKind.Client: - this.AddTag("kind", "client"); - break; - case ActivityKind.Producer: - this.AddTag("kind", "producer"); - break; - case ActivityKind.Consumer: - this.AddTag("kind", "consumer"); - break; - } + _activitySource = activitySource; + _diagnosticSource = diagnosticSource; + _activityName = activityName; + _kind = kind; + _diagnosticSourceArgs = diagnosticSourceArgs; } - - public void AddTag(string name, string? value) + public void AddTag(string name, object value) { - if (this.currentActivity == null) + if (_currentActivity == null) { // Activity is not started yet, add the value to the collection // that is going to be passed to StartActivity - this.tagCollection ??= ActivityExtensions.CreateTagsCollection() ?? new List>(); - this.tagCollection?.Add(new KeyValuePair(name, value!)); + _tagCollection ??= ActivityExtensions.CreateTagsCollection() ?? new List>(); + _tagCollection?.Add(new KeyValuePair(name, value!)); } else { - this.currentActivity?.AddTag(name, value!); + _currentActivity?.AddObjectTag(name, value); } } - private IList? GetActivitySourceLinkCollection() { - if (this.links == null) + if (_links == null) { return null; } @@ -228,7 +231,7 @@ public void AddTag(string name, string? value) return null; } - foreach (var activity in this.links) + foreach (var activity in _links) { ICollection>? linkTagsCollection = ActivityExtensions.CreateTagsCollection(); if (linkTagsCollection != null) @@ -239,7 +242,7 @@ public void AddTag(string name, string? value) } } - var link = ActivityExtensions.CreateActivityLink(activity.ParentId!, activity.TraceStateString, linkTagsCollection); + var link = ActivityExtensions.CreateActivityLink(activity.ParentId!, activity.GetTraceState(), linkTagsCollection); if (link != null) { linkCollection.Add(link); @@ -248,13 +251,12 @@ public void AddTag(string name, string? value) return linkCollection; } - - public void AddLink(string traceparent, string tracestate, IDictionary? attributes) + public void AddLink(string traceparent, string? tracestate, IDictionary? attributes) { var linkedActivity = new Activity("LinkedActivity"); linkedActivity.SetW3CFormat(); linkedActivity.SetParentId(traceparent); - linkedActivity.TraceStateString = tracestate; + linkedActivity.SetTraceState(tracestate); if (attributes != null) { @@ -264,83 +266,126 @@ public void AddLink(string traceparent, string tracestate, IDictionary(); - this.links.Add(linkedActivity); + _links ??= new List(); + _links.Add(linkedActivity); } - - public void Start() + public Activity? Start() { - this.currentActivity = this.StartActivitySourceActivity(); - - if (this.currentActivity == null) + _currentActivity = StartActivitySourceActivity(); + if (_currentActivity != null) + { + _currentActivity.AddTag(OpenTelemetrySchemaAttribute, OpenTelemetrySchemaVersion); + } + else { - if (!this.diagnosticSource.IsEnabled(this.activityName, this.diagnosticSourceArgs)) + if (!_diagnosticSource.IsEnabled(_activityName, _diagnosticSourceArgs)) { - return; + return null; } - this.currentActivity = new DiagnosticActivity(this.activityName) + switch (_kind) { - Links = (IEnumerable?)this.links ?? Array.Empty(), + case ActivityKind.Internal: + AddTag("kind", "internal"); + break; + case ActivityKind.Server: + AddTag("kind", "server"); + break; + case ActivityKind.Client: + AddTag("kind", "client"); + break; + case ActivityKind.Producer: + AddTag("kind", "producer"); + break; + case ActivityKind.Consumer: + AddTag("kind", "consumer"); + break; + } + + _currentActivity = new DiagnosticActivity(_activityName) + { + Links = (IEnumerable?)_links ?? Array.Empty(), }; - this.currentActivity.SetW3CFormat(); + _currentActivity.SetW3CFormat(); - if (this.startTime != default) + if (_startTime != default) { - this.currentActivity.SetStartTime(this.startTime.DateTime); + _currentActivity.SetStartTime(_startTime.UtcDateTime); } - if (this.tagCollection != null) + if (_tagCollection != null) { - foreach (var tag in this.tagCollection) + foreach (var tag in _tagCollection) { - this.currentActivity.AddTag(tag.Key, (string)tag.Value); + _currentActivity.AddObjectTag(tag.Key, tag.Value); } } - this.currentActivity.Start(); + if (_traceparent != null) + { + _currentActivity.SetParentId(_traceparent); + } + + if (_tracestate != null) + { + _currentActivity.SetTraceState(_tracestate); + } + + _currentActivity.Start(); } - this.diagnosticSource.Write(this.activityName + ".Start", this.diagnosticSourceArgs ?? this.currentActivity); - } + _diagnosticSource.Write(_activityName + ".Start", _diagnosticSourceArgs ?? _currentActivity); + return _currentActivity; + } private Activity? StartActivitySourceActivity() { return ActivityExtensions.ActivitySourceStartActivity( - this.activitySource, - this.activityName, - (int)this.kind, - startTime: this.startTime, - tags: this.tagCollection, - links: this.GetActivitySourceLinkCollection()); + _activitySource, + _activityName, + (int)_kind, + startTime: _startTime, + tags: _tagCollection, + links: GetActivitySourceLinkCollection(), + traceparent: _traceparent, + tracestate: _tracestate); } public void SetStartTime(DateTime startTime) { - this.startTime = startTime; - this.currentActivity?.SetStartTime(startTime); + _startTime = startTime; + _currentActivity?.SetStartTime(startTime); } public void MarkFailed(Exception exception) { - this.diagnosticSource?.Write(this.activityName + ".Exception", exception); + _diagnosticSource?.Write(_activityName + ".Exception", exception); } + public void SetTraceContext(string traceparent, string? tracestate) + { + if (_currentActivity != null) + { + throw new InvalidOperationException("Traceparent can not be set after the activity is started."); + } + _traceparent = traceparent; + _tracestate = tracestate; + } public void Dispose() { - if (this.currentActivity == null) + if (_currentActivity == null) { return; } - if (this.currentActivity.Duration == TimeSpan.Zero) - this.currentActivity.SetEndTime(DateTime.UtcNow); + if (_currentActivity.Duration == TimeSpan.Zero) + _currentActivity.SetEndTime(DateTime.UtcNow); - this.diagnosticSource.Write(this.activityName + ".Stop", this.diagnosticSourceArgs); + _diagnosticSource.Write(_activityName + ".Stop", _diagnosticSourceArgs); - if (!this.currentActivity.TryDispose()) + if (!_currentActivity.TryDispose()) { - this.currentActivity.Stop(); + _currentActivity.Stop(); } } } @@ -357,25 +402,71 @@ static ActivityExtensions() ResetFeatureSwitch(); } + private static bool SupportsActivitySourceSwitch; + private static readonly Type? ActivitySourceType = Type.GetType("System.Diagnostics.ActivitySource, System.Diagnostics.DiagnosticSource"); private static readonly Type? ActivityKindType = Type.GetType("System.Diagnostics.ActivityKind, System.Diagnostics.DiagnosticSource"); private static readonly Type? ActivityTagsCollectionType = Type.GetType("System.Diagnostics.ActivityTagsCollection, System.Diagnostics.DiagnosticSource"); private static readonly Type? ActivityLinkType = Type.GetType("System.Diagnostics.ActivityLink, System.Diagnostics.DiagnosticSource"); private static readonly Type? ActivityContextType = Type.GetType("System.Diagnostics.ActivityContext, System.Diagnostics.DiagnosticSource"); - - private static readonly ParameterExpression ActivityParameter = Expression.Parameter(typeof(Activity)); - - private static bool SupportsActivitySourceSwitch; private static Action? SetIdFormatMethod; private static Func? GetTraceStateStringMethod; + private static Action? SetTraceStateStringMethod; private static Func? GetIdFormatMethod; private static Action? ActivityAddTagMethod; - private static Func>?, IList?, DateTimeOffset, Activity?>? ActivitySourceStartActivityMethod; + private static Func>?, IList?, DateTimeOffset, Activity?>? ActivitySourceStartActivityMethod; private static Func? ActivitySourceHasListenersMethod; private static Func>?, object?>? CreateActivityLinkMethod; private static Func>?>? CreateTagsCollectionMethod; + private static Func? GetCustomPropertyMethod; + private static Action? SetCustomPropertyMethod; + private static readonly ParameterExpression ActivityParameter = Expression.Parameter(typeof(Activity)); + private static MethodInfo? ParseActivityContextMethod; + + public static object? GetCustomProperty(this Activity activity, string propertyName) + { + if (GetCustomPropertyMethod == null) + { + var method = typeof(Activity).GetMethod("GetCustomProperty"); + if (method == null) + { + GetCustomPropertyMethod = (_, _) => null; + } + else + { + var nameParameter = Expression.Parameter(typeof(string)); + + GetCustomPropertyMethod = Expression.Lambda>( + Expression.Convert(Expression.Call(ActivityParameter, method, nameParameter), typeof(object)), + ActivityParameter, nameParameter).Compile(); + } + } + + return GetCustomPropertyMethod(activity, propertyName); + } + public static void SetCustomProperty(this Activity activity, string propertyName, object propertyValue) + { + if (SetCustomPropertyMethod == null) + { + var method = typeof(Activity).GetMethod("SetCustomProperty"); + if (method == null) + { + SetCustomPropertyMethod = (_, _, _) => { }; + } + else + { + var nameParameter = Expression.Parameter(typeof(string)); + var valueParameter = Expression.Parameter(typeof(object)); + + SetCustomPropertyMethod = Expression.Lambda>( + Expression.Call(ActivityParameter, method, nameParameter, valueParameter), + ActivityParameter, nameParameter, valueParameter).Compile(); + } + } + SetCustomPropertyMethod(activity, propertyName, propertyValue); + } public static void SetW3CFormat(this Activity activity) { if (SetIdFormatMethod == null) @@ -442,6 +533,28 @@ public static bool IsW3CFormat(this Activity activity) return GetTraceStateStringMethod(activity); } + public static void SetTraceState(this Activity activity, string? tracestate) + { + if (SetTraceStateStringMethod == null) + { + var method = typeof(Activity).GetProperty("TraceStateString")?.SetMethod; + if (method == null) + { + SetTraceStateStringMethod = (_, _) => { }; + } + else + { + var tracestateParameter = Expression.Parameter(typeof(string)); + var convertedParameter = Expression.Convert(tracestateParameter, method.GetParameters()[0].ParameterType); + SetTraceStateStringMethod = Expression.Lambda>( + Expression.Call(ActivityParameter, method, convertedParameter), + ActivityParameter, tracestateParameter).Compile(); + } + } + + SetTraceStateStringMethod(activity, tracestate); + } + public static void AddObjectTag(this Activity activity, string name, object value) { if (ActivityAddTagMethod == null) @@ -454,7 +567,13 @@ public static void AddObjectTag(this Activity activity, string name, object valu if (method == null) { - ActivityAddTagMethod = (_, _, _) => { }; + // If the object overload is not available, fall back to the string overload. The assumption is that the object overload + // not being available means that we cannot be using activity source, so the string cast should never fail because we will always + // be passing a string value. + ActivityAddTagMethod = (activityParameter, nameParameter, valueParameter) => activityParameter.AddTag( + nameParameter, + // null check is required to keep nullable reference compilation happy + valueParameter == null ? null : (string)valueParameter); } else { @@ -474,7 +593,6 @@ public static bool SupportsActivitySource() { return SupportsActivitySourceSwitch && ActivitySourceType != null; } - public static ICollection>? CreateTagsCollection() { if (CreateTagsCollectionMethod == null) @@ -523,9 +641,9 @@ public static bool SupportsActivitySource() Expression.TryCatch( Expression.Convert(Expression.New(ctor, Expression.Call(parseMethod, traceparentParameter, tracestateParameter), - Expression.Convert(tagsParameter, ActivityTagsCollectionType)), typeof(object)), - Expression.Catch(typeof(Exception), Expression.Default(typeof(object)))), - traceparentParameter, tracestateParameter, tagsParameter).Compile(); + Expression.Convert(tagsParameter, ActivityTagsCollectionType)), typeof(object)), + Expression.Catch(typeof(Exception), Expression.Default(typeof(object)))), + traceparentParameter, tracestateParameter, tagsParameter).Compile(); } } @@ -564,13 +682,23 @@ public static bool ActivitySourceHasListeners(object? activitySource) return ActivitySourceHasListenersMethod.Invoke(activitySource); } - public static Activity? ActivitySourceStartActivity(object? activitySource, string activityName, int kind, DateTimeOffset startTime, ICollection>? tags, IList? links) + public static Activity? ActivitySourceStartActivity( + object? activitySource, + string activityName, + int kind, + DateTimeOffset startTime, + ICollection>? tags, + IList? links, + string? traceparent, + string? tracestate) { if (activitySource == null) { return null; } + object? activityContext = default; + if (ActivitySourceStartActivityMethod == null) { if (ActivityLinkType == null || @@ -578,7 +706,7 @@ public static bool ActivitySourceHasListeners(object? activitySource) ActivityContextType == null || ActivityKindType == null) { - ActivitySourceStartActivityMethod = (_, _, _, _, _, _) => null; + ActivitySourceStartActivityMethod = (_, _, _, _, _, _, _) => null; } else { @@ -594,35 +722,46 @@ public static bool ActivitySourceHasListeners(object? activitySource) if (method == null) { - ActivitySourceStartActivityMethod = (_, _, _, _, _, _) => null; + ActivitySourceStartActivityMethod = (_, _, _, _, _, _, _) => null; } else { var sourceParameter = Expression.Parameter(typeof(object)); var nameParameter = Expression.Parameter(typeof(string)); var kindParameter = Expression.Parameter(typeof(int)); + var contextParameter = Expression.Parameter(typeof(object)); var startTimeParameter = Expression.Parameter(typeof(DateTimeOffset)); var tagsParameter = Expression.Parameter(typeof(ICollection>)); var linksParameter = Expression.Parameter(typeof(IList)); var methodParameter = method.GetParameters(); - ActivitySourceStartActivityMethod = Expression.Lambda>?, IList?, DateTimeOffset, Activity?>>( + ParseActivityContextMethod = ActivityContextType.GetMethod("Parse", BindingFlags.Static | BindingFlags.Public); + + ActivitySourceStartActivityMethod = Expression.Lambda>?, IList?, DateTimeOffset, Activity?>>( Expression.Call( Expression.Convert(sourceParameter, method.DeclaringType!), method, nameParameter, - Expression.Convert(kindParameter, methodParameter[1].ParameterType), - Expression.Default(ActivityContextType), - Expression.Convert(tagsParameter, methodParameter[3].ParameterType), - Expression.Convert(linksParameter, methodParameter[4].ParameterType), - Expression.Convert(startTimeParameter, methodParameter[5].ParameterType)), - sourceParameter, nameParameter, kindParameter, tagsParameter, linksParameter, startTimeParameter).Compile(); + Expression.Convert(kindParameter, methodParameter[1].ParameterType), + Expression.Convert(contextParameter, methodParameter[2].ParameterType), + Expression.Convert(tagsParameter, methodParameter[3].ParameterType), + Expression.Convert(linksParameter, methodParameter[4].ParameterType), + Expression.Convert(startTimeParameter, methodParameter[5].ParameterType)), + sourceParameter, nameParameter, kindParameter, contextParameter, tagsParameter, linksParameter, startTimeParameter).Compile(); } } } - return ActivitySourceStartActivityMethod.Invoke(activitySource, activityName, kind, tags, links, startTime); - } + if (ActivityContextType != null && ParseActivityContextMethod != null) + { + if (traceparent != null) + activityContext = ParseActivityContextMethod.Invoke(null, new[] { traceparent, tracestate })!; + else + // because ActivityContext is a struct, we need to create a default instance rather than allowing the argument to be null + activityContext = Activator.CreateInstance(ActivityContextType); + } + return ActivitySourceStartActivityMethod.Invoke(activitySource, activityName, kind, activityContext, tags, links, startTime); + } public static object? CreateActivitySource(string name) { if (ActivitySourceType == null) @@ -631,9 +770,9 @@ public static bool ActivitySourceHasListeners(object? activitySource) } return Activator.CreateInstance(ActivitySourceType, name, // name - null); // version + null // version + ); } - public static IList? CreateLinkCollection() { if (ActivityLinkType == null) @@ -662,3 +801,4 @@ public static void ResetFeatureSwitch() } } } +#endif \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/Azure.Core/DiagnosticScopeFactory.cs b/Microsoft.Azure.Cosmos/src/direct/Azure.Core/DiagnosticScopeFactory.cs new file mode 100644 index 0000000000..986cb2d92f --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/Azure.Core/DiagnosticScopeFactory.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// This File is copied from Azure.Core repo. i.e. https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/src/Shared/DiagnosticScopeFactory.cs + +#nullable enable +#if NETSTANDARD2_0_OR_GREATER +using System.Collections.Generic; +using System.Diagnostics; +using System.Threading; + +namespace Azure.Core +{ +#pragma warning disable CA1001 // Types that own disposable fields should be disposable + internal class DiagnosticScopeFactory +#pragma warning restore CA1001 // Types that own disposable fields should be disposable + { + private static Dictionary? _listeners; + private readonly string? _resourceProviderNamespace; + private readonly DiagnosticListener? _source; + private readonly bool _suppressNestedClientActivities; + + public DiagnosticScopeFactory(string clientNamespace, string? resourceProviderNamespace, bool isActivityEnabled, bool suppressNestedClientActivities) + { + _resourceProviderNamespace = resourceProviderNamespace; + IsActivityEnabled = isActivityEnabled; + _suppressNestedClientActivities = suppressNestedClientActivities; + + if (IsActivityEnabled) + { + var listeners = LazyInitializer.EnsureInitialized(ref _listeners); + + lock (listeners!) + { + if (!listeners.TryGetValue(clientNamespace, out _source)) + { + _source = new DiagnosticListener(clientNamespace); + listeners[clientNamespace] = _source; + } + } + } + } + + public bool IsActivityEnabled { get; } + + public DiagnosticScope CreateScope(string name, DiagnosticScope.ActivityKind kind = DiagnosticScope.ActivityKind.Internal) + { + if (_source == null) + { + return default; + } + var scope = new DiagnosticScope(_source.Name, name, _source, kind, _suppressNestedClientActivities); + + if (_resourceProviderNamespace != null) + { + scope.AddAttribute("az.namespace", _resourceProviderNamespace); + } + return scope; + } + } +} +#endif \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/BytesDeserializer.cs b/Microsoft.Azure.Cosmos/src/direct/BytesDeserializer.cs index 0ca1fe1975..d31f593a21 100644 --- a/Microsoft.Azure.Cosmos/src/direct/BytesDeserializer.cs +++ b/Microsoft.Azure.Cosmos/src/direct/BytesDeserializer.cs @@ -15,11 +15,12 @@ public BytesDeserializer(byte[] metadata, int length) : this() { this.metadata = new Memory(metadata, 0, length); this.Position = 0; + this.Length = length; } public int Position { get; private set; } - public int Length => this.metadata.Length; + public int Length { get; } public ushort ReadUInt16() { @@ -28,8 +29,6 @@ public ushort ReadUInt16() return value; } - public void AdvancePositionByUInt16() => this.Position += 2; - public byte ReadByte() { byte value = this.metadata.Span[this.Position]; @@ -44,8 +43,6 @@ public uint ReadUInt32() return value; } - public void AdvancePositionByUInt32() => this.Position += 4; - public int ReadInt32() { int value = MemoryMarshal.Read(this.metadata.Span.Slice(this.Position)); @@ -53,8 +50,6 @@ public int ReadInt32() return value; } - public void AdvancePositionByInt32() => this.Position += 4; - public ulong ReadUInt64() { ulong value = MemoryMarshal.Read(this.metadata.Span.Slice(this.Position)); @@ -62,8 +57,6 @@ public ulong ReadUInt64() return value; } - public void AdvancePositionByUInt64() => this.Position += 8; - public long ReadInt64() { long value = MemoryMarshal.Read(this.metadata.Span.Slice(this.Position)); @@ -71,8 +64,6 @@ public long ReadInt64() return value; } - public void AdvancePositionByInt64() => this.Position += 8; - public float ReadSingle() { float value = MemoryMarshal.Read(this.metadata.Span.Slice(this.Position)); @@ -80,8 +71,6 @@ public float ReadSingle() return value; } - public void AdvancePositionBySingle() => this.Position += 4; - public double ReadDouble() { double value = MemoryMarshal.Read(this.metadata.Span.Slice(this.Position)); @@ -89,8 +78,6 @@ public double ReadDouble() return value; } - public void AdvancePositionByDouble() => this.Position += 8; - public Guid ReadGuid() { Guid value = MemoryMarshal.Read(this.metadata.Span.Slice(this.Position)); @@ -98,15 +85,11 @@ public Guid ReadGuid() return value; } - public void AdvancePositionByGuid() => this.Position += 16; - public ReadOnlyMemory ReadBytes(int length) { ReadOnlyMemory value = this.metadata.Slice(this.Position, length); this.Position += length; return value; } - - public void AdvancePositionByBytes(int count) => this.Position += count; } } diff --git a/Microsoft.Azure.Cosmos/src/direct/BytesSerializer.cs b/Microsoft.Azure.Cosmos/src/direct/BytesSerializer.cs index 7211ba6b58..56cf19abfa 100644 --- a/Microsoft.Azure.Cosmos/src/direct/BytesSerializer.cs +++ b/Microsoft.Azure.Cosmos/src/direct/BytesSerializer.cs @@ -53,8 +53,6 @@ public static ReadOnlyMemory GetBytesForString(string toConvert, RntbdCons return new ReadOnlyMemory(stringBuffer, 0, length); } - internal int GetPosition() => this.position; - /// /// Separate out getting the size of GUID into a separate method to keep unsafe contexts isolated. /// diff --git a/Microsoft.Azure.Cosmos/src/direct/CloneableStream.cs b/Microsoft.Azure.Cosmos/src/direct/CloneableStream.cs index 426c7cc6fa..aac270dba0 100644 --- a/Microsoft.Azure.Cosmos/src/direct/CloneableStream.cs +++ b/Microsoft.Azure.Cosmos/src/direct/CloneableStream.cs @@ -7,7 +7,6 @@ namespace Microsoft.Azure.Documents using System.IO; using System.Threading; using System.Threading.Tasks; - using Microsoft.Azure.Cosmos.Core.Trace; internal sealed class CloneableStream : Stream, ICloneable { @@ -43,7 +42,7 @@ private MemoryStream CloneStream() public CloneableStream(MemoryStream internalStream, bool allowUnsafeDataAccess = true) { - this.internalStream = CloneableStream.ConvertToExportableMemoryStream(internalStream); + this.internalStream = internalStream; this.allowUnsafeDataAccess = allowUnsafeDataAccess; } @@ -213,8 +212,6 @@ public override void WriteByte(byte value) protected override void Dispose(bool disposing) { this.internalStream.Dispose(); - - base.Dispose(disposing); } public void WriteTo(Stream target) @@ -244,36 +241,5 @@ public override Task CopyToAsync(Stream destination, int bufferSize, Cancellatio { return this.internalStream.CopyToAsync(destination, bufferSize, cancellationToken); } - -#if NETFX45 || NETSTANDARD15 || NETSTANDARD16 - private static MemoryStream ConvertToExportableMemoryStream(MemoryStream mediaStream) - { - // This code path does not change now so we can assume that we always get exportable MemoryStream from existing clients - return mediaStream; - } -#else - private static MemoryStream ConvertToExportableMemoryStream(MemoryStream mediaStream) - { - if (mediaStream != null) - { - if (!(mediaStream is ICloneable || mediaStream.TryGetBuffer(out _))) - { - MemoryStream exportableMemoryStream; - int length = (int)mediaStream.Length; - long mediaStreamPosition = mediaStream.Position; - byte[] buffer = new byte[length]; - mediaStream.Read(buffer, offset: 0, count: length); - exportableMemoryStream = new(buffer, index: 0, count: length, writable: false, publiclyVisible: true); - mediaStream.Position = mediaStreamPosition; - mediaStream = exportableMemoryStream; - - // We could not dispose original stream as the application might still be using it - DefaultTrace.TraceWarning("Change the code to prevent the need for convertion into exportable MemoryStream by using streams with publicly visible buffers"); - } - } - - return mediaStream; - } -#endif } } diff --git a/Microsoft.Azure.Cosmos/src/direct/Constants.cs b/Microsoft.Azure.Cosmos/src/direct/Constants.cs index f8d0555866..d4c8955705 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Constants.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Constants.cs @@ -273,11 +273,8 @@ public static class Properties public const string SupportedCapabilities = "supportedCapabilities"; public const string PlacementHints = "placementHints"; public const string IsMasterService = "isMasterService"; - public const string CapUncapMetadata = "capUncapMetadata"; public const string IsCappedForServer = "isCappedForServer"; - public const string CapUncapMetadataForServer = "capUncapMetadataForServer"; public const string IsCappedForMaster = "isCappedForMaster"; - public const string CapUncapMetadataForMaster = "capUncapMetadataForMaster"; public const string CapabilityResource = "capabilityResource"; public const string DocumentType = "documentType"; public const string SystemDatabaseAccountStoreType = "systemDatabaseAccountStoreType"; @@ -440,11 +437,6 @@ public static class Properties public const string EnableIndexingSchemeV2 = "enableIndexingSchemeV2"; - // CapUncapMetadata - public const string Source = "source"; - public const string Reason = "reason"; - public const string IncidentId = "incidentId"; - // GeospatialConfig public const string GeospatialType = "type"; public const string GeospatialConfig = "geospatialConfig"; @@ -457,9 +449,6 @@ public static class Properties public const string LastDocumentGLSN = "lastDocumentGLSN"; public const string UniqueIndexNameEncodingMode = "uniqueIndexNameEncodingMode"; - // ReIndexer - public const string EnableReIndexerProgressCalc = "enableReIndexerProgressCalc"; - // ChangeFeed policy public const string ChangeFeedPolicy = "changeFeedPolicy"; public const string LogRetentionDuration = "retentionDuration"; @@ -604,8 +593,6 @@ public static class Properties public const string RestoreTimestampInUtc = "restoreTimestampInUtc"; public const string RestoreSource = "restoreSource"; public const string IsInAccountRestoreCapabilityEnabled = "isInAccountRestoreCapabilityEnabled"; - public const string CanUndelete = "CanUndelete"; - public const string CanUndeleteReason = "CanUndeleteReason"; // Backup Hold public const string BackupHoldTimeInDays = "backupHoldTimeInDays"; @@ -636,9 +623,6 @@ public static class Properties public const string Message = "message"; public const string ErrorDetails = "errorDetails"; public const string AdditionalErrorInfo = "additionalErrorInfo"; - - //CassandraErrorResource. - public const string Target = "target"; // AddressResource public const string IsPrimary = "isPrimary"; @@ -696,12 +680,7 @@ public static class Properties public const string IsInBitLockerRotation = "IsInBitLockerRotation"; public const string PrimaryBitLockerKeyVersion = "PrimaryBitLockerKeyVersion"; public const string SecondaryBitLockerKeyVersion = "SecondaryBitLockerKeyVersion"; - public const string BitLockerKeysSettingType = "BitLockerKeysSettingType"; public const string BitLockerKeysRotationState = "BitLockerKeysRotationState"; - public const string InfrastructureServices = "InfrastructureServices"; - - // Federation settings - public const string AllowReutilizationOfComputeResources = "AllowReutilizationOfComputeResources"; //Deployment Constants public const string FabricApplicationName = "fabricApplicationName"; @@ -752,7 +731,6 @@ public static class Properties public const string ManagedServiceIdentityInfo = "managedServiceIdentityInfo"; public const string IdentityName = "identity"; public const string MsiSystemAssignedType = "SystemAssigned"; - public const string MsiFirstPartyType = "FirstParty"; public const string MsiNoneType = "None"; public const string MsiUserAssignedType = "UserAssigned"; public const string MsiSystemAndUserAssignedType = "SystemAssigned,UserAssigned"; @@ -845,7 +823,6 @@ public static class Properties public const string MaxCountOfSharedThroughputCollectionsEverCreated = "maxCountOfSharedThroughputCollectionsEverCreated"; public const string OfferLastReplaceTimestamp = "offerLastReplaceTimestamp"; public const string AutopilotSettings = "offerAutopilotSettings"; - public const string IsOfferRestorePending = "isOfferRestorePending"; public const string AutopilotTier = "tier"; public const string AutopilotTargetTier = "targetTier"; @@ -978,13 +955,6 @@ public static class Properties public const string SupportedTimeGrainTypes = "supportedTimeGrainTypes"; public const string SupportedAggregationTypes = "supportedAggregationTypes"; - // Metric ID Mapping Dimension names (Multi-Resource Metrics) - public const string MicrosoftSubscriptionId = "Microsoft.subscriptionId"; - public const string MicrosoftResourceGroupName = "Microsoft.resourceGroupName"; - public const string MicrosoftResourceType = "Microsoft.resourceType"; - public const string MicrosoftResourceName = "Microsoft.resourceName"; - public const string MicrosoftResourceId = "Microsoft.resourceId"; - // IP Range resource public const string IpRangeFilter = "ipRangeFilter"; public const string IpRules = "ipRules"; @@ -993,7 +963,6 @@ public static class Properties // Property to check if point in time restore is enabled for a global database account public const string PitrEnabled = "pitrEnabled"; public const string PitrSku = "pitrSku"; - public const string ReservedInstanceType = "reservedInstanceType"; public const string ContinuousBackupTier = "tier"; public const string EnablePitrMigration = "enablePITRMigration"; public const string EnableLogstoreHeadStartSequenceVector = "enableLogStoreHeadStartSequenceVector"; @@ -1011,7 +980,6 @@ public static class Properties // property to enable full fidelity change feed (change feed with retention from remote+local storage). public const string EnableFullFidelityChangeFeed = "enableFullFidelityChangeFeed"; - public const string EnableFFCFWithPITR = "enableFFCFWithPITR"; // Enable API type check public const string EnableApiTypeCheck = "enableApiTypeCheck"; @@ -1027,8 +995,6 @@ public static class Properties public const string FabricUri = "fabricUri"; public const string ResourcePartitionKey = "resourcePartitionKey"; public const string CanaryLocationSurffix = "euap"; - public const string IsSubscriptionRegionAccessAllowedForRegular = "isSubscriptionRegionAccessAllowedForRegular"; - public const string IsSubscriptionRegionAccessAllowedForAz = "isSubscriptionRegionAccessAllowedForAz"; // Topology Resource public const string Topology = "topology"; @@ -1103,9 +1069,7 @@ public static class Properties public const string QueryRanges = "queryRanges"; // Arm resource type - public const string CosmosResourceProvider = "microsoft.documentdb"; - public const string DatabaseAccounts = "databaseaccounts"; - public const string CosmosArmResouceType = CosmosResourceProvider + "/" + DatabaseAccounts; + public const string DatabaseAccounts = "databaseAccounts"; // SchemaDiscoveryPolicy public const string SchemaDiscoveryPolicy = "schemaDiscoveryPolicy"; @@ -1187,6 +1151,7 @@ public static class Properties public const string NspProfileProxyResources = "nspProfileProxyResources"; public const string NspAssociationProxyResource = "nspAssociationProxyResource"; public const string EnableNetworkSecurityPerimeter = "enableNetworkSecurityPerimeter"; + public const string PrototypeAdditionalEndpointsForPrivateEndpoint = "prototypeAdditionalEndpointsForPrivateEndpoint"; // VNET/Subnet Resource(Network Resource Provider) public const string IgnoreMissingVNetServiceEndpoint = "ignoreMissingVNetServiceEndpoint"; @@ -1401,7 +1366,6 @@ public static class Properties public const string IsOwnedByExternalProvider = "isOwnedByExternalProvider"; public const string ConnectionInformation = "connectionInformation"; public const string CrossSubRegionMigrationInProgress = "CrossSubRegionMigrationInProgress"; - public const string AzMigrationInProgress = "AzMigrationInProgress"; // Data Plane Operation Policy public const string DisableKeyBasedMetadataWriteAccess = "disableKeyBasedMetadataWriteAccess"; @@ -1613,20 +1577,6 @@ public static class FederationCapActions public const string Cap = "Cap"; public const string Uncap = "Uncap"; } - - public static class InAccountUnDeleteNotAllowedReasons - { - // Database UnDelete Failure - public const string DatabaseLive = "Database already exists. Only deleted resources can be restored within same account."; - public const string DatabaseWithSameNameLive = "Database with same name already exist as live database."; - - // Collection UnDelete Failure - public const string DatabaseDoesNotExist = "Could not find the database associated with the collection. Please restore the database before restoring the collection."; - public const string DatabaseWithSameNameExist = "Could not find the database associated with the collection. Another database with same name exist"; - public const string CollectionLive = "Collection already exists. Only deleted resources can be restored within same account."; - public const string CollectionWithSamenNameLive = "Collection with same name already exist as live collection."; - public const string SharedCollectionNotAllowed = "Individual shared database collections restore is not supported. Please restore shared database to restore its collections that share the throughput."; - } public static class DocumentResourceExtendedProperties { @@ -1658,7 +1608,6 @@ public static class SnapshotProperties public const string Table = "table"; public const string Keyspace = "keyspace"; public const string LSN = "lsn"; - public const string IsMasterResourcesDeletionPending = "isMasterResourcesDeletionPending"; } public static class RestoreMetadataResourceProperties @@ -1982,7 +1931,6 @@ public static class LogStoreConstants public const string CollectionGLSN = "CollectionGLSN"; public const string IsValidTimeStamp = "IsValidTimeStamp"; public const string CollectionTS = "CollectionTS"; - public const string CollectionInstanceId = "CollectionInstanceId"; } public static class RestoreConstants @@ -2031,7 +1979,6 @@ public static class SystemStoreConstants public const int SMSDefaultBackupIntervalInMinute = 30; public const int DefaultBackupRetentionInHour = 720; public const string ResourceGroupSuffix = "-rg"; - public const string IsDataTransferStateStoreAccount = "IsDataTransferStateStoreAccount"; } public static class TransportControlCommandOperations @@ -2111,7 +2058,6 @@ public static class MigratePartitionCallerSource public static string ACIS_MitigateMasterMigrationFailure = "ACIS_MitigateMasterMigrationFailure"; public static string ACIS_MitigateServerMigrationFailure = "ACIS_MitigateServerMigrationFailure"; public static string FederationBuildout_CanaryAccountMigration = "FederationBuildout_CanaryAccountMigration"; - public static string USER_InPlaceAZMigration = "FederationBuildout_CanaryAccountMigration"; } public static class EnvironmentVariables diff --git a/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs b/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs index d077813a92..45c90e5ae4 100644 --- a/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs +++ b/Microsoft.Azure.Cosmos/src/direct/CpuMonitor.cs @@ -46,7 +46,6 @@ public void Start() this.rwLock.EnterWriteLock(); try { - this.ThrowIfDisposed(); if (this.periodicTask != null) { throw new InvalidOperationException("CpuMonitor already started"); @@ -81,33 +80,6 @@ public void Start() DefaultTrace.TraceInformation("CpuMonitor started"); } - private void StopCoreUnderWriteLock(ref CancellationTokenSource cancel, ref Task backgroundTask) - { - if (this.periodicTask == null) - { - throw new InvalidOperationException("CpuMonitor not started or has been stopped or disposed already."); - } - - cancel = this.cancellation; - backgroundTask = this.periodicTask; - - this.cancellation = null; - this.currentReading = null; - this.periodicTask = null; - } - - private static void StopCoreAfterReleasingWriteLock(CancellationTokenSource cancel, Task backgroundTask) - { - cancel.Cancel(); - try - { - backgroundTask.Wait(); - } - catch (AggregateException) - { } - cancel.Dispose(); - } - public void Stop() { this.ThrowIfDisposed(); @@ -116,15 +88,31 @@ public void Stop() this.rwLock.EnterWriteLock(); try { - this.ThrowIfDisposed(); - this.StopCoreUnderWriteLock(ref cancel, ref backgroundTask); + if (this.periodicTask == null) + { + throw new InvalidOperationException("CpuMonitor not started"); + } + + cancel = this.cancellation; + backgroundTask = this.periodicTask; + + this.cancellation = null; + this.currentReading = null; + this.periodicTask = null; } finally { this.rwLock.ExitWriteLock(); } - StopCoreAfterReleasingWriteLock(cancel, backgroundTask); + cancel.Cancel(); + try + { + backgroundTask.Wait(); + } + catch (AggregateException) + { } + cancel.Dispose(); DefaultTrace.TraceInformation("CpuMonitor stopped"); } @@ -139,7 +127,7 @@ public CpuLoadHistory GetCpuLoad() { if (this.periodicTask == null) { - throw new InvalidOperationException("CpuMonitor was not started or has been stopped or disposed already."); + throw new InvalidOperationException("CpuMonitor was not started"); } return this.currentReading; } @@ -151,40 +139,22 @@ public CpuLoadHistory GetCpuLoad() public void Dispose() { - Interlocked.MemoryBarrier(); - if (this.disposed) - { - return; - } - - CancellationTokenSource cancel = null; - Task backgroundTask = null; - this.rwLock.EnterWriteLock(); + this.ThrowIfDisposed(); + this.rwLock.EnterReadLock(); try { - Interlocked.MemoryBarrier(); - if (this.disposed) - { - return; - } - if (this.periodicTask != null) { - this.StopCoreUnderWriteLock(ref cancel, ref backgroundTask); + throw new InvalidOperationException( + "CpuMonitor must be stopped before Dispose"); } } finally { - this.MarkDisposed(); - this.rwLock.ExitWriteLock(); - } - - if (backgroundTask != null) - { - StopCoreAfterReleasingWriteLock(cancel, backgroundTask); + this.rwLock.ExitReadLock(); } - this.rwLock.Dispose(); + this.MarkDisposed(); } private void MarkDisposed() diff --git a/Microsoft.Azure.Cosmos/src/direct/CustomTypeExtensions.cs b/Microsoft.Azure.Cosmos/src/direct/CustomTypeExtensions.cs index 78c9ec74ec..ffa9bc4901 100644 --- a/Microsoft.Azure.Cosmos/src/direct/CustomTypeExtensions.cs +++ b/Microsoft.Azure.Cosmos/src/direct/CustomTypeExtensions.cs @@ -35,7 +35,7 @@ internal static class CustomTypeExtensions #if COSMOSCLIENT public const string SDKName = "cosmos-netstandard-sdk"; - public const string SDKVersion = "3.18.0"; + public const string SDKVersion = "3.30.8"; #else public const string SDKName = "documentdb-netcore-sdk"; public const string SDKVersion = "2.14.0"; diff --git a/Microsoft.Azure.Cosmos/src/direct/DefaultTrace.cs b/Microsoft.Azure.Cosmos/src/direct/DefaultTrace.cs index 81aca07371..daf0dce468 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DefaultTrace.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DefaultTrace.cs @@ -14,7 +14,7 @@ internal static class DefaultTrace { public static readonly Guid ProviderId = new Guid("{B30ABF1C-6A50-4F2B-85C4-61823ED6CF24}"); - private static TraceSource TraceSourceInternal; + private static readonly TraceSource TraceSourceInternal; private static bool IsListenerAdded; @@ -38,7 +38,6 @@ static DefaultTrace() public static TraceSource TraceSource { get { return DefaultTrace.TraceSourceInternal; } - set { DefaultTrace.TraceSourceInternal = value; } } /// diff --git a/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs b/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs index 5167dba6b9..701ae540e4 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Dispatcher.cs @@ -21,6 +21,8 @@ namespace Microsoft.Azure.Documents.Rntbd using Trace = Microsoft.Azure.Documents.Trace; #endif + using ResponsePool = RntbdConstants.RntbdEntityPool; + // Dispatcher encapsulates the state and logic needed to dispatch multiple requests through // a single connection. internal sealed class Dispatcher : IDisposable @@ -694,13 +696,14 @@ private async Task ReceiveLoopAsync() CancellationToken cancellationToken = this.cancellation.Token; ChannelCommonArguments args = new ChannelCommonArguments( Guid.Empty, TransportErrorCode.ReceiveTimeout, true); + ResponsePool.EntityOwner response = default; Connection.ResponseMetadata responseMd = null; try { - bool hasTransportErrors = false; - while (!hasTransportErrors && !cancellationToken.IsCancellationRequested) + while (!cancellationToken.IsCancellationRequested) { args.ActivityId = Guid.Empty; + response = ResponsePool.Instance.Get(); responseMd = await this.connection.ReadResponseMetadataAsync(args); ArraySegment metadata = responseMd.Metadata; @@ -709,38 +712,35 @@ private async Task ReceiveLoopAsync() args.ActivityId = header.ActivityId; BytesDeserializer deserializer = new BytesDeserializer(metadata.Array, metadata.Count); + Debug.Assert(response.Entity != null); + response.Entity.ParseFrom(ref deserializer); MemoryStream bodyStream = null; - if (HeadersTransportSerialization.TryParseMandatoryResponseHeaders(ref deserializer, out bool payloadPresent, out uint transportRequestId)) - { - if (payloadPresent) - { - bodyStream = await this.connection.ReadResponseBodyAsync(args); - } - this.DispatchRntbdResponse(responseMd, header, bodyStream, metadata.Array, metadata.Count, transportRequestId); - } - else + if (response.Entity.payloadPresent.value.valueByte != (byte) 0x00) { - hasTransportErrors = true; - this.DispatchChannelFailureException(TransportExceptions.GetInternalServerErrorException(this.serverUri, RMResources.MissingRequiredHeader)); + bodyStream = await this.connection.ReadResponseBodyAsync(args); } + this.DispatchRntbdResponse(responseMd, response, header, bodyStream); responseMd = null; } this.DispatchCancellation(); } catch (OperationCanceledException) { + response.Dispose(); responseMd?.Dispose(); this.DispatchCancellation(); } catch (ObjectDisposedException) { + response.Dispose(); responseMd?.Dispose(); this.DispatchCancellation(); } catch (Exception e) { + response.Dispose(); responseMd?.Dispose(); this.DispatchChannelFailureException(e); } @@ -769,13 +769,22 @@ private Dictionary StopCalls() private void DispatchRntbdResponse( Connection.ResponseMetadata responseMd, + ResponsePool.EntityOwner rntbdResponse, TransportSerialization.RntbdHeader responseHeader, - MemoryStream responseBody, - byte[] metadata, - int metadataLength, - uint transportRequestId) + MemoryStream responseBody) { - CallInfo call = this.RemoveCall(transportRequestId); + if (!rntbdResponse.Entity.transportRequestID.isPresent || + (rntbdResponse.Entity.transportRequestID.GetTokenType() != RntbdTokenTypes.ULong)) + { + responseBody?.Dispose(); + rntbdResponse.Dispose(); + responseMd.Dispose(); + throw TransportExceptions.GetInternalServerErrorException( + this.serverUri, + RMResources.ServerResponseTransportRequestIdMissingError); + } + + CallInfo call = this.RemoveCall(rntbdResponse.Entity.transportRequestID.value.valueULong); if (call != null) { Debug.Assert(this.serverProperties != null); @@ -783,12 +792,13 @@ private void DispatchRntbdResponse( call.TransportRequestStats.RecordState(TransportRequestStats.RequestStage.Received); call.TransportRequestStats.ResponseMetadataSizeInBytes = responseMd.Metadata.Count; call.TransportRequestStats.ResponseBodySizeInBytes = responseBody?.Length; - call.SetResponse(responseMd, responseHeader, responseBody, this.serverProperties.Version, metadata, metadataLength); + call.SetResponse(responseMd, rntbdResponse, responseHeader, responseBody, this.serverProperties.Version); } else { responseBody?.Dispose(); responseMd.Dispose(); + rntbdResponse.Dispose(); } } @@ -949,11 +959,10 @@ public void SendFailed() public void SetResponse( Connection.ResponseMetadata responseMd, + ResponsePool.EntityOwner rntbdResponse, TransportSerialization.RntbdHeader responseHeader, MemoryStream responseBody, - string serverVersion, - byte[] metadata, - int metadataLength) + string serverVersion) { this.ThrowIfDisposed(); // Call SetResult asynchronously. Otherwise, the tasks awaiting on @@ -972,13 +981,12 @@ public void SetResponse( Trace.CorrelationManager.ActivityId = this.activityId; try { - BytesDeserializer bytesDeserializer = new BytesDeserializer(metadata, metadataLength); StoreResponse storeResponse = TransportSerialization.MakeStoreResponse( responseHeader.Status, responseHeader.ActivityId, + rntbdResponse.Entity, responseBody, - serverVersion, - ref bytesDeserializer); + serverVersion); this.completion.SetResult(storeResponse); } catch (Exception e) @@ -988,6 +996,7 @@ public void SetResponse( } finally { + rntbdResponse.Dispose(); responseMd.Dispose(); } }); @@ -1112,4 +1121,4 @@ private enum State } } } -} \ No newline at end of file +} diff --git a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs index 86a4ab53b4..cfd2188512 100644 --- a/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs +++ b/Microsoft.Azure.Cosmos/src/direct/DocumentServiceRequest.cs @@ -541,14 +541,10 @@ public string HttpMethod case OperationType.MasterInitiatedProgressCoordination: case OperationType.MetadataCheckAccess: case OperationType.CreateSystemSnapshot: - case OperationType.CreateRidRangeResources: case OperationType.GetAadGroups: case OperationType.UpdateFailoverPriorityList: case OperationType.GetStorageAccountSas: case OperationType.GetBatchCustomerManagedKeyStatus: - case OperationType.UpdatePartitionThroughput: - case OperationType.XPDatabaseAccountMetaData: - case OperationType.Truncate: return HttpConstants.HttpMethods.Post; case OperationType.EnsureSnapshotOperation: diff --git a/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs b/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs index f85a722255..6661d64d5a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs +++ b/Microsoft.Azure.Cosmos/src/direct/GoneAndRetryWithRetryPolicy.cs @@ -15,9 +15,9 @@ namespace Microsoft.Azure.Documents /// TArg1: Perform force refresh. /// TArg2: TimeSpan for completing the work in the callback /// - internal sealed class GoneAndRetryWithRetryPolicy : - IRetryPolicy, - IRetryPolicy>, + internal sealed class GoneAndRetryWithRetryPolicy : + IRetryPolicy, + IRetryPolicy>, IRetryPolicy> { private const int defaultWaitTimeInSeconds = 30; @@ -47,9 +47,9 @@ internal sealed class GoneAndRetryWithRetryPolicy : private DocumentServiceRequest request; public GoneAndRetryWithRetryPolicy( - DocumentServiceRequest request = null, - int? waitTimeInSecondsOverride = null, - TimeSpan minBackoffForRegionReroute = default(TimeSpan), + DocumentServiceRequest request = null, + int? waitTimeInSecondsOverride = null, + TimeSpan minBackoffForRegionReroute = default(TimeSpan), bool detectConnectivityIssues = false) { if (waitTimeInSecondsOverride.HasValue) @@ -60,7 +60,7 @@ public GoneAndRetryWithRetryPolicy( { this.waitTimeInSeconds = GoneAndRetryWithRetryPolicy.defaultWaitTimeInSeconds; } - + this.request = request; this.detectConnectivityIssues = detectConnectivityIssues; this.minBackoffForRegionReroute = minBackoffForRegionReroute; @@ -134,9 +134,8 @@ async Task>> IRetryPolicyException thrown by callback /// /// Is the retry helper should retry - [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "Roslyn Baseline 12/12/2022 16:40")] Task>> IRetryPolicy>.ShouldRetryAsync( - Exception exception, + Exception exception, CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -222,10 +221,10 @@ exception is PartitionKeyRangeGoneException || exceptionToThrow = new ServiceUnavailableException( string.Format( - RMResources.ClientUnavailable, - this.request.RequestContext.ClientRequestStatistics.FailedReplicas.Count, + RMResources.ClientUnavailable, + this.request.RequestContext.ClientRequestStatistics.FailedReplicas.Count, this.request.RequestContext.ClientRequestStatistics.RegionsContacted.Count == 0 ? - 1 : this.request.RequestContext.ClientRequestStatistics.RegionsContacted.Count), + 1 : this.request.RequestContext.ClientRequestStatistics.RegionsContacted.Count), exception, exceptionSubStatus); } @@ -289,7 +288,7 @@ exception is PartitionKeyRangeGoneException || } else { - DefaultTrace.TraceCritical("Received unexpected invalid collection exception, request should be non-null. {0}", exception.ToStringWithData()); + DefaultTrace.TraceCritical("Received unexpected invalid collection exception, request should be non-null.", exception.ToStringWithData()); return Task.FromResult(ShouldRetryResult>.NoRetry(new InternalServerErrorException(exception))); } // prevent the caller from refreshing fabric caches. @@ -309,14 +308,14 @@ exception is PartitionKeyRangeGoneException || } DefaultTrace.TraceWarning( - "GoneAndRetryWithRetryPolicy Received exception, will retry, attempt: {0}, regionRerouteAttempt: {1}, backoffTime: {2}, Timeout: {3}, Exception: {4}", - this.attemptCount, - this.regionRerouteAttemptCount, - backoffTime, + "GoneAndRetryWithRetryPolicy Received exception, will retry, attempt: {0}, regionRerouteAttempt: {1}, backoffTime: {2}, Timeout: {3}, Exception: {4}", + this.attemptCount, + this.regionRerouteAttemptCount, + backoffTime, timeout, exception.ToStringWithData()); return Task.FromResult(ShouldRetryResult>.RetryAfter( - backoffTime, + backoffTime, Tuple.Create(forceRefreshAddressCache, true, timeout, currentAttemptCount, this.regionRerouteAttemptCount, backoffTime))); } diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs b/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs index f995a6cf51..8adec1d049 100644 Binary files a/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs and b/Microsoft.Azure.Cosmos/src/direct/HttpConstants.cs differ diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpException.cs b/Microsoft.Azure.Cosmos/src/direct/HttpException.cs index c59d3051c3..bfca0b00df 100644 --- a/Microsoft.Azure.Cosmos/src/direct/HttpException.cs +++ b/Microsoft.Azure.Cosmos/src/direct/HttpException.cs @@ -51,14 +51,12 @@ internal DocumentClientException(Error errorResource, } // Stamp the activity ID if present. Exception throwers can override this if need be. -#pragma warning disable CS8073 // Result of ActivityId (Guid) compared to null here is always true. Fixing the condition can cause unexpected behavior. if ((Trace.CorrelationManager.ActivityId != null) && (this.responseHeaders.Get(HttpConstants.HttpHeaders.ActivityId) == null)) { this.responseHeaders.Set(HttpConstants.HttpHeaders.ActivityId, Trace.CorrelationManager.ActivityId.ToString()); } -#pragma warning restore CS8073 // Result of ActivityId (Guid) compared to null here is always true. Fixing the condition can cause unexpected behavior. this.LSN = -1; this.PartitionKeyRangeId = null; @@ -108,13 +106,11 @@ internal DocumentClientException(string message, } // Stamp the ambient activity ID (if present) over the server's response ActivityId (if present). -#pragma warning disable CS8073 // Result of ActivityId (Guid) compared to null here is always true. Fixing the condition can cause unexpected behavior. if (Trace.CorrelationManager.ActivityId != null) { this.responseHeaders.Set(HttpConstants.HttpHeaders.ActivityId, Trace.CorrelationManager.ActivityId.ToString()); } -#pragma warning restore CS8073 // Result of ActivityId (Guid) compared to null here is always true. Fixing the condition can cause unexpected behavior. this.RequestUri = requestUri; this.LSN = -1; @@ -170,13 +166,11 @@ internal DocumentClientException(string message, } // Stamp the ambient activity ID (if present) over the server's response ActivityId (if present). -#pragma warning disable CS8073 // Result of ActivityId (Guid) compared to null here is always true. Fixing the condition can cause unexpected behavior. if (Trace.CorrelationManager.ActivityId != null) { this.responseHeaders.Set(HttpConstants.HttpHeaders.ActivityId, Trace.CorrelationManager.ActivityId.ToString()); } -#pragma warning restore CS8073 // Result of ActivityId (Guid) compared to null here is always true. Fixing the condition can cause unexpected behavior. this.RequestUri = requestUri; this.LSN = -1; diff --git a/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs b/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs index 09529b14c6..88ebf1f0b6 100644 --- a/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/HttpTransportClient.cs @@ -317,7 +317,6 @@ private HttpRequestMessage PrepareHttpMessage( HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.EnableLogging, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.IsReadOnlyScript, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.ContentSerializationFormat, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.SupportedSerializationFormats, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.Continuation, request.Continuation); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.ActivityId, activityId.ToString()); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PartitionKey, request); @@ -406,7 +405,6 @@ private HttpRequestMessage PrepareHttpMessage( HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PopulateIndexMetricsText, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.CorrelatedActivityId, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.ForceQueryScan, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.OptimisticDirectExecute, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.ResponseContinuationTokenLimitInKB, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, WFConstants.BackendHeaders.RemoteStorageType, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, WFConstants.BackendHeaders.ShareThroughput, request); @@ -459,18 +457,12 @@ private HttpRequestMessage PrepareHttpMessage( HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PopulateByokEncryptionProgress, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.IncludePhysicalPartitionThroughputInfo, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.UpdateOfferStateToPending, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.UpdateOfferStateToRestorePending, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PopulateOldestActiveSchemaId, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.OfferReplaceRURedistribution, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.ForceDatabaseAccountUpdate, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PriorityLevel, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.AllowRestoreParamsUpdate, request); HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.IsRecreate, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.PruneCollectionSchemas, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.IsMigratedFixedCollection, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending, request); - HttpTransportClient.AddHeader(httpRequestMessage.Headers, HttpConstants.HttpHeaders.HighPriorityForcedBackup, request); Stream clonedStream = null; if (request.Body != null) @@ -594,7 +586,6 @@ private HttpRequestMessage PrepareHttpMessage( case OperationType.ServiceReservation: case OperationType.GetFederationConfigurations: case OperationType.GetStorageServiceConfigurations: - case OperationType.XPDatabaseAccountMetaData: httpRequestMessage.RequestUri = physicalAddress; httpRequestMessage.Method = HttpMethod.Post; Debug.Assert(clonedStream != null); diff --git a/Microsoft.Azure.Cosmos/src/direct/InAccountRestoreParameters.cs b/Microsoft.Azure.Cosmos/src/direct/InAccountRestoreParameters.cs index cee6bb8c83..4a06d15be9 100644 --- a/Microsoft.Azure.Cosmos/src/direct/InAccountRestoreParameters.cs +++ b/Microsoft.Azure.Cosmos/src/direct/InAccountRestoreParameters.cs @@ -14,19 +14,6 @@ public InAccountRestoreParameters() { } - /// - /// Gets or sets the after triggering the InAccount Restore as part of RestoreParameters - /// - /// - /// A valid value should have unique InstanceId in restore parameters. - /// - [JsonProperty(PropertyName = Constants.Properties.InstanceId)] - public string InstanceId - { - get { return base.GetValue(Constants.Properties.InstanceId); } - set { base.SetValue(Constants.Properties.InstanceId, value); } - } - /// /// Gets or sets the for triggering the InAccount Restore as part of RestoreParameters /// @@ -70,8 +57,7 @@ public string SourceBackupLocation internal override void Validate() { base.Validate(); - - if (this.RestoreTimestampInUtc == default) + if (this.RestoreTimestampInUtc == null) { throw new BadRequestException($"{Constants.Properties.RestoreTimestampInUtc} is a required input for in account restore request"); } diff --git a/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs b/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs index 4190b1095b..40e4495b82 100644 --- a/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs +++ b/Microsoft.Azure.Cosmos/src/direct/LocationNames.cs @@ -369,4 +369,5 @@ static class LocationNames /// internal const string ItalyNorth = "Italy North"; } -} \ No newline at end of file +} + diff --git a/Microsoft.Azure.Cosmos/src/direct/OperationType.cs b/Microsoft.Azure.Cosmos/src/direct/OperationType.cs index fb4fedfff4..c5eb03192e 100644 --- a/Microsoft.Azure.Cosmos/src/direct/OperationType.cs +++ b/Microsoft.Azure.Cosmos/src/direct/OperationType.cs @@ -105,11 +105,6 @@ internal enum OperationType GetStorageAuthToken = 59, CreateClientEncryptionKey = 60, ReplaceClientEncryptionKey = 61, - UpdatePartitionThroughput = 62, - - // Operation type for recreating RidRange resources during the pitr restore of a multi master partition - CreateRidRangeResources = 64, - Truncate = 65, #endif // These names make it unclear what they map to in RequestOperationType. @@ -134,7 +129,6 @@ internal enum OperationType GetGraphDatabaseAccountConfiguration = -19, GetCustomerManagedKeyStatus = -20, GetBatchCustomerManagedKeyStatus = -21, - XPDatabaseAccountMetaData = -22, #endif } @@ -190,12 +184,9 @@ public static bool IsWriteOperation(this OperationType type) type == OperationType.GetSplitPoints || type == OperationType.ForcePartitionBackup || type == OperationType.CreateSystemSnapshot || - type == OperationType.CreateRidRangeResources || type == OperationType.UpdateFailoverPriorityList || type == OperationType.Pause || - type == OperationType.Resume || - type == OperationType.UpdatePartitionThroughput || - type == OperationType.Truncate + type == OperationType.Resume #endif ; } diff --git a/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternalJsonConverter.cs b/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternalJsonConverter.cs index 9985e6177f..db63575fcd 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternalJsonConverter.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PartitionKeyInternalJsonConverter.cs @@ -32,8 +32,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s writer.WriteStartArray(); - IEnumerable components = partitionKey.Components ?? Enumerable.Empty(); - foreach (IPartitionKeyComponent componentValue in components) + foreach (IPartitionKeyComponent componentValue in partitionKey.Components) { componentValue.JsonEncode(writer); } diff --git a/Microsoft.Azure.Cosmos/src/direct/Paths.cs b/Microsoft.Azure.Cosmos/src/direct/Paths.cs index f42c54bfcd..b89a92861e 100644 --- a/Microsoft.Azure.Cosmos/src/direct/Paths.cs +++ b/Microsoft.Azure.Cosmos/src/direct/Paths.cs @@ -31,7 +31,6 @@ internal static class Paths public const string Operations_ReadReplicaFromServerPartition = "readreplicafromserverpartition"; public const string Operations_MasterInitiatedProgressCoordination = "masterinitiatedprogresscoordination"; public const string Operations_GetAadGroups = "getaadgroups"; - public const string Operations_XPDatabaseAccountMetaData = "xpmetadata"; public const string Operations_MetadataCheckAccess = "metadatacheckaccess"; //databases namespace off of root------------------- @@ -72,11 +71,6 @@ internal static class Paths public const string DatabaseId = "dbId"; public const string Database_Root = Databases_Root + "{" + DatabaseId + "}"; - // FedURL/accounts/{id}/dbs - public const string FederationEndpoint_Databases_Root = FederationEndpoint_Root + "/" + Databases_Root; - // FedURL/accounts/{id}/dbs/{id} - public const string FederationEndpoint_Database_Root = FederationEndpoint_Databases_Root + "{" + DatabaseId + "}"; - // /dbs/{id}/users public const string UsersPathSegment = "users"; public const string Users_Root = Database_Root + "/" + UsersPathSegment + "/"; @@ -117,11 +111,6 @@ internal static class Paths public const string CollectionId = "collId"; public const string Collection_Root = Collections_Root + "{" + CollectionId + "}"; - // FedURL/accounts/{id}/dbs/{id}/colls - public const string FederationEndpoint_Collections_Root = FederationEndpoint_Root + "/" + Collections_Root; - // FedURL/accounts/{id}/dbs/{id}/colls/{id} - public const string FederationEndpoint_Collection_Root = FederationEndpoint_Collections_Root + "{" + CollectionId + "}"; - // /dbs/{id}/colls/{id}/sprocs public const string StoredProceduresPathSegment = "sprocs"; public const string StoredProcedures_Root = Collection_Root + "/" + StoredProceduresPathSegment + "/"; @@ -130,11 +119,6 @@ internal static class Paths public const string StoredProcedureId = "sprocId"; public const string StoredProcedure_Root = StoredProcedures_Root + "{" + StoredProcedureId + "}"; - // FedURL/accounts/{id}/dbs/{id}/colls/{id}/sprocs - public const string FederationEndpoint_StoredProcedures_Root = FederationEndpoint_Root + "/" + StoredProcedures_Root; - // FedURL/accounts/{id}/dbs/{id}/colls/{id}/sprocs/{id} - public const string FederationEndpoint_StoredProcedure_Root = FederationEndpoint_StoredProcedures_Root + "{" + StoredProcedureId + "}"; - // /dbs/{id}/colls/{id}/triggers public const string TriggersPathSegment = "triggers"; public const string Triggers_Root = Collection_Root + "/" + TriggersPathSegment + "/"; @@ -191,11 +175,6 @@ internal static class Paths public const string AttachmentId = "attachmentId"; public const string Attachment_Root = Attachments_Root + "{" + AttachmentId + "}"; - // FedURL/accounts/{id}/dbs/{id}/colls/{id}/docs/{id}/attachments - public const string FederationEndpoint_Attachments_Root = FederationEndpoint_Root + "/" + Attachments_Root; - // FedURL/accounts/{id}/dbs/{id}/colls/{id}/docs/{id}/attachments/{id} - public const string FederationEndpoint_Attachment_Root = FederationEndpoint_Attachments_Root + "{" + AttachmentId + "}"; - // /dbs/{id}/colls/{id}/pkranges public const string PartitionKeyRangesPathSegment = "pkranges"; public const string PartitionKeyRanges_Root = Collection_Root + "/" + PartitionKeyRangesPathSegment + "/"; @@ -204,9 +183,6 @@ internal static class Paths public const string PartitionKeyRangeId = "pkrangeId"; public const string PartitionKeyRange_Root = PartitionKeyRanges_Root + "{" + PartitionKeyRangeId + "}"; - // FedURL/accounts/{id}/dbs/{id}/colls/{id}/pkranges - public const string FederationEndpoint_PartitionKeyRanges_Root = FederationEndpoint_Root + "/" + PartitionKeyRanges_Root; - // /dbs/{id}/colls/{id}/pkranges/{id}/presplitaction public const string PartitionKeyRangePreSplitSegment = "presplitaction"; public const string PartitionKeyRangePreSplit_Root = PartitionKeyRange_Root + "/" + PartitionKeyRangePreSplitSegment + "/"; @@ -260,11 +236,6 @@ internal static class Paths public const string OfferId = "offerId"; public const string Offer_Root = Offers_Root + "{" + OfferId + "}"; - // FedURL/accounts/{id}/offers - public const string FederationEndpoint_Offers_Root = FederationEndpoint_Root + "/" + Offers_Root; - // FedURL/accounts/{id}/offers/{id} - public const string FederationEndpoint_Offer_Root = FederationEndpoint_Offers_Root + "{" + OfferId + "}"; - // /topology public const string TopologyPathSegment = "topology"; public const string Topology_Root = Root + "/" + TopologyPathSegment + "/"; @@ -379,7 +350,7 @@ internal static class Paths // /accounts/{id}/ public const string AccountsPathSegment = "accounts"; public const string AccountId = "accountId"; - public const string FederationEndpoint_Root = Root + "/" + AccountsPathSegment + "/{" + AccountId + "}"; + public const string FederationEndpoint_Root = Root + "/" + AccountsPathSegment + "/{" + AccountId + "}/"; // /accounts/{id}/address public const string FederationEndpoint_Address_Root = FederationEndpoint_Root + "/" + AddressPathSegment + "/"; @@ -391,8 +362,6 @@ internal static class Paths // /clientconfigs public const string ClientConfigPathSegment = "clientconfigs"; public const string ClientConfig_Root = Root + ClientConfigPathSegment; - public const string FederationEndpoint_ClientConfig_Root = FederationEndpoint_Root + ClientConfig_Root; - // /encryptionscopes/{id} public const string EncryptionScopeId = "encryptionscopeid"; diff --git a/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs b/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs index 02c3c758c5..551bcccb24 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PathsHelper.cs @@ -41,8 +41,6 @@ public static bool TryParsePathSegments( string databaseName = string.Empty; string collectionName = string.Empty; - resourceUrl = PathsHelper.RemoveAccountsSegment(resourceUrl); - if (!string.IsNullOrEmpty(resourceUrl) && resourceUrl.Contains(Paths.OperationsPathSegment) && (resourceUrl.Contains(Paths.PartitionKeyDeletePathSegment) || resourceUrl.Contains(Paths.CollectionTruncatePathsegment))) { @@ -143,8 +141,6 @@ public static bool TryParsePathSegmentsWithDatabaseAndCollectionAndDocumentNames return false; } - resourceUrl = PathsHelper.RemoveAccountsSegment(resourceUrl); - string[] segments = resourceUrl.Split(PathsHelper.PathSeparatorArray, StringSplitOptions.RemoveEmptyEntries); if (segments == null || segments.Length < 1) @@ -368,8 +364,6 @@ public static bool TryParsePathSegmentsWithDatabaseAndCollectionAndOperationName return false; } - resourceUrl = PathsHelper.RemoveAccountsSegment(resourceUrl); - string[] segments = resourceUrl.Split(PathsHelper.PathSeparatorArray, StringSplitOptions.RemoveEmptyEntries); if (segments == null || segments.Length != 6) @@ -1453,8 +1447,6 @@ public static string GenerateRootOperationPath(OperationType operationType) return Paths.OperationsPathSegment + "/" + Paths.Operations_GetFederationConfigurations; case OperationType.GetDatabaseAccountConfigurations: return Paths.OperationsPathSegment + "/" + Paths.Operations_GetDatabaseAccountConfigurations; - case OperationType.XPDatabaseAccountMetaData: - return Paths.OperationsPathSegment + "/" + Paths.Operations_XPDatabaseAccountMetaData; case OperationType.GetGraphDatabaseAccountConfiguration: return Paths.OperationsPathSegment + "/" + Paths.Operations_GetGraphDatabaseAccountConfiguration; case OperationType.GetStorageServiceConfigurations: @@ -1562,7 +1554,6 @@ private static bool IsRootOperation(in StringSegment operationSegment, in String operationTypeSegment.Equals(Paths.Operations_GetStorageAccountKey, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetStorageAccountSas, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetDatabaseAccountConfigurations, StringComparison.OrdinalIgnoreCase) || - operationTypeSegment.Equals(Paths.Operations_XPDatabaseAccountMetaData, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetUnwrappedDek, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_GetCustomerManagedKeyStatus, StringComparison.OrdinalIgnoreCase) || operationTypeSegment.Equals(Paths.Operations_ReadReplicaFromMasterPartition, StringComparison.OrdinalIgnoreCase) || @@ -1584,17 +1575,6 @@ private static bool IsTopLevelOperationOperation(in StringSegment replicaSegment return false; } - public static string RemoveAccountsSegment(string resourceUrl) - { - if (!string.IsNullOrEmpty(resourceUrl) && resourceUrl.StartsWith("/accounts/", StringComparison.OrdinalIgnoreCase)) - { - int index = resourceUrl.IndexOfNth('/', 3); - resourceUrl = resourceUrl.Substring(index, resourceUrl.Length - index); - } - - return resourceUrl; - } - internal static bool IsNameBased(string resourceIdOrFullName) { // quick way to tell whether it is resourceId nor not, non conclusively. diff --git a/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs b/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs index d2f409bc3b..bddf45a278 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PerfCounters.cs @@ -5,13 +5,14 @@ namespace Microsoft.Azure.Documents { using System; using System.Diagnostics; - using Microsoft.Azure.Cosmos.ServiceFramework.Core; internal sealed class PerfCounters : IDisposable { - private readonly string performanceCategory; + public static PerfCounters Counters = new PerfCounters("DocDB Gateway", "Counters for DocDB Gateway"); - private readonly string performanceCategoryHelp; + private string performanceCategory; + + private string performanceCategoryHelp; private PerformanceCounter frontendRequestsPerSec; @@ -57,12 +58,10 @@ internal sealed class PerfCounters : IDisposable private PerfCounters(string category, string categoryHelp) { - this.performanceCategory = category; - this.performanceCategoryHelp = categoryHelp; + performanceCategory = category; + performanceCategoryHelp = categoryHelp; } - public static PerfCounters Counters { get; } = new PerfCounters("DocDB Gateway", "Counters for DocDB Gateway"); - public PerformanceCounter FrontendRequestsPerSec { get @@ -78,7 +77,6 @@ public PerformanceCounter FrontendActiveRequests return this.frontendActiveRequests; } } - public PerformanceCounter BackendRequestsPerSec { get @@ -231,68 +229,6 @@ public PerformanceCounter BackendConnectionOpenFailuresDueToSynRetransmitPerSeco } } - /// - /// Creates the given performance counter category. - /// - /// Name of the category. - /// Help description. - /// Category type. - /// Counters in the category. - /// - /// Indicates whether machine-wide synchronization should be used to avoid races between different entry-points attempting to create the same category. - /// - /// If the category already exists then it is checked to ensure that the given counters are present. If not, the category is recreated. - internal static void CreatePerfCounterCategory(string category, - string categoryHelp, - PerformanceCounterCategoryType categoryType, - CounterCreationDataCollection counters, - bool useSystemMutex = true) - { - SystemSynchronizationScope syncScope = useSystemMutex ? SystemSynchronizationScope.CreateSynchronizationScope($"CDBPerfCategory-{category}") : default; - - try - { - // If the performance counter category already exists, check if any counters have changed. - if (PerformanceCounterCategory.Exists(category)) - { - PerformanceCounterCategory perfCategory = new PerformanceCounterCategory(category); - bool shouldReturn = true; - foreach (CounterCreationData counter in counters) - { - try - { - if (!perfCategory.CounterExists(counter.CounterName)) - { - shouldReturn = false; - break; - } - } - catch - { - shouldReturn = false; - break; - } - } - - if (shouldReturn) - { - return; - } - else - { - PerformanceCounterCategory.Delete(category); - } - } - - // Create the category. - PerformanceCounterCategory.Create(category, categoryHelp, categoryType, counters); - } - finally - { - syncScope?.Dispose(); - } - } - /// /// Creating performance counter category is a privileged operation and /// hence done in the WinFab service setup entrypoint that is invoked before @@ -344,80 +280,127 @@ public void InstallCounters() counters.Add(new CounterCreationData("Backend Connection Open Failures Due To Syn Retransmit Timeout/sec", "Number of failures per second when connecting to a backend node which failed with WSAETIMEDOUT", PerformanceCounterType.RateOfCountsPerSecond32)); - PerfCounters.CreatePerfCounterCategory(this.performanceCategory, this.performanceCategoryHelp, PerformanceCounterCategoryType.SingleInstance, counters); + CreatePerfCounterCategory(performanceCategory, performanceCategoryHelp, PerformanceCounterCategoryType.SingleInstance, counters); + } + + /// + /// Create a perf counter category with the provided name and creates the provided list of perf counters inside + /// the category. + /// + public static void CreatePerfCounterCategory(string category, string categoryHelp, + PerformanceCounterCategoryType categoryType, + CounterCreationDataCollection counters) + { + // If the performance counter category already exists, check if any counters have changed. + if (PerformanceCounterCategory.Exists(category)) + { + PerformanceCounterCategory perfCategory = new PerformanceCounterCategory(category); + bool shouldReturn = true; + foreach (CounterCreationData counter in counters) + { + try + { + if (!perfCategory.CounterExists(counter.CounterName)) + { + shouldReturn = false; + break; + } + } + catch + { + shouldReturn = false; + break; + } + } + + if (shouldReturn) + { + return; + } + else + { + PerformanceCounterCategory.Delete(category); + } + } + + // Create the category. + PerformanceCounterCategory.Create(category, categoryHelp, categoryType, counters); } public void InitializePerfCounters() { - this.frontendRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Frontend Requests/sec", false); + this.frontendRequestsPerSec = new PerformanceCounter(performanceCategory, "Frontend Requests/sec", false); this.frontendRequestsPerSec.RawValue = 0; - this.frontendActiveRequests = new PerformanceCounter(this.performanceCategory, "Frontend Active Requests", false); + this.frontendActiveRequests = new PerformanceCounter(performanceCategory, "Frontend Active Requests", false); this.frontendActiveRequests.RawValue = 0; - this.admissionControlledRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Admission Controlled Requests/sec", false); + this.admissionControlledRequestsPerSec = new PerformanceCounter(performanceCategory, "Admission Controlled Requests/sec", false); this.admissionControlledRequestsPerSec.RawValue = 0; - this.admissionControlledRequests = new PerformanceCounter(this.performanceCategory, "Admission Controlled Requests", false); + this.admissionControlledRequests = new PerformanceCounter(performanceCategory, "Admission Controlled Requests", false); this.admissionControlledRequests.RawValue = 0; - this.backendRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Backend Requests/sec", false); + this.backendRequestsPerSec = new PerformanceCounter(performanceCategory, "Backend Requests/sec", false); this.backendRequestsPerSec.RawValue = 0; - this.backendActiveRequests = new PerformanceCounter(this.performanceCategory, "Backend Active Requests", false); + this.backendActiveRequests = new PerformanceCounter(performanceCategory, "Backend Active Requests", false); this.backendActiveRequests.RawValue = 0; - this.currentFrontendConnections = new PerformanceCounter(this.performanceCategory, "Current Frontend Connections", false); + this.currentFrontendConnections = new PerformanceCounter(performanceCategory, "Current Frontend Connections", false); this.currentFrontendConnections.RawValue = 0; - this.fabricResolveServiceFailures = new PerformanceCounter(this.performanceCategory, "Fabric Resolve Service Failures", false); + this.fabricResolveServiceFailures = new PerformanceCounter(performanceCategory, "Fabric Resolve Service Failures", false); this.fabricResolveServiceFailures.RawValue = 0; - this.queryRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Query Requests/sec", false); + this.queryRequestsPerSec = new PerformanceCounter(performanceCategory, "Query Requests/sec", false); this.queryRequestsPerSec.RawValue = 0; - this.triggerRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Trigger Requests/sec", false); + this.triggerRequestsPerSec = new PerformanceCounter(performanceCategory, "Trigger Requests/sec", false); this.triggerRequestsPerSec.RawValue = 0; - this.procedureRequestsPerSec = new PerformanceCounter(this.performanceCategory, "Procedure Requests/sec", false); + this.procedureRequestsPerSec = new PerformanceCounter(performanceCategory, "Procedure Requests/sec", false); this.procedureRequestsPerSec.RawValue = 0; - this.averageProcedureRequestsDuration = new PerformanceCounter(this.performanceCategory, "Average Procedure Requests Duration", false); + this.averageProcedureRequestsDuration = new PerformanceCounter(performanceCategory, "Average Procedure Requests Duration", false); this.averageProcedureRequestsDuration.RawValue = 0; - this.averageProcedureRequestsDurationBase = new PerformanceCounter(this.performanceCategory, "Average Procedure Requests Duration Base", false); + this.averageProcedureRequestsDurationBase = new PerformanceCounter(performanceCategory, "Average Procedure Requests Duration Base", false); this.averageProcedureRequestsDurationBase.RawValue = 0; - this.averageQueryRequestsDuration = new PerformanceCounter(this.performanceCategory, "Average Query Requests Duration", false); + this.averageQueryRequestsDuration = new PerformanceCounter(performanceCategory, "Average Query Requests Duration", false); this.averageQueryRequestsDuration.RawValue = 0; - this.averageQueryRequestsDurationBase = new PerformanceCounter(this.performanceCategory, "Average Query Requests Duration Base", false); + this.averageQueryRequestsDurationBase = new PerformanceCounter(performanceCategory, "Average Query Requests Duration Base", false); this.averageQueryRequestsDurationBase.RawValue = 0; - this.backendConnectionOpenAverageLatency = new PerformanceCounter(this.performanceCategory, "Backend Connection Open Average Latency", false); + this.backendConnectionOpenAverageLatency = new PerformanceCounter(performanceCategory, "Backend Connection Open Average Latency", false); this.backendConnectionOpenAverageLatency.RawValue = 0; - this.backendConnectionOpenAverageLatencyBase = new PerformanceCounter(this.performanceCategory, "Backend Connection Open Average Latency Base", false); + this.backendConnectionOpenAverageLatencyBase = new PerformanceCounter(performanceCategory, "Backend Connection Open Average Latency Base", false); this.backendConnectionOpenAverageLatencyBase.RawValue = 0; - this.fabricResolveServiceAverageLatency = new PerformanceCounter(this.performanceCategory, "Fabric Resolve Service Average Latency", false); + this.fabricResolveServiceAverageLatency = new PerformanceCounter(performanceCategory, "Fabric Resolve Service Average Latency", false); this.fabricResolveServiceAverageLatency.RawValue = 0; - this.fabricResolveServiceAverageLatencyBase = new PerformanceCounter(this.performanceCategory, "Fabric Resolve Service Average Latency Base", false); + this.fabricResolveServiceAverageLatencyBase = new PerformanceCounter(performanceCategory, "Fabric Resolve Service Average Latency Base", false); this.fabricResolveServiceAverageLatencyBase.RawValue = 0; - this.routingFailures = new PerformanceCounter(this.performanceCategory, "Routing Failures", false); + this.routingFailures = new PerformanceCounter(performanceCategory, "Routing Failures", false); this.routingFailures.RawValue = 0; - this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond = new PerformanceCounter(this.performanceCategory, "Backend Connection Open Failures Due To Syn Retransmit Timeout/sec", false); + this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond = new PerformanceCounter(performanceCategory, "Backend Connection Open Failures Due To Syn Retransmit Timeout/sec", false); this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond.RawValue = 0; } #region IDisposable Members + // Implement the dispose pattern. The pattern is detailed at: + // + // http://www.bluebytesoftware.com/blog/CategoryView,category,DesignGuideline.aspx + // public void Dispose() { -#pragma warning disable SA1501 using (this.frontendActiveRequests) { } using (this.frontendRequestsPerSec) { } @@ -459,7 +442,6 @@ public void Dispose() using (this.routingFailures) { } using (this.backendConnectionOpenFailuresDueToSynRetransmitPerSecond) { } -#pragma warning restore SA1501 } #endregion diff --git a/Microsoft.Azure.Cosmos/src/direct/PriorityLevel.cs b/Microsoft.Azure.Cosmos/src/direct/PriorityLevel.cs index e0a7967cf3..811679e214 100644 --- a/Microsoft.Azure.Cosmos/src/direct/PriorityLevel.cs +++ b/Microsoft.Azure.Cosmos/src/direct/PriorityLevel.cs @@ -4,7 +4,12 @@ namespace Microsoft.Azure.Documents { - internal enum PriorityLevel +#if COSMOSCLIENT + internal +#else + public +#endif + enum PriorityLevel { High = 1, Low = 2, diff --git a/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs b/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs index f96a560b1d..78fd02ceac 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RegionProximityUtil.cs @@ -2341,7 +2341,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.BrazilSoutheast, 302 }, { LocationNames.CanadaCentral, 208 }, { LocationNames.CanadaEast, 218 }, - { LocationNames.CentralIndia, 30 }, + { LocationNames.CentralIndia, 100 }, { LocationNames.CentralUS, 222 }, { LocationNames.ChinaEast, long.MaxValue }, { LocationNames.ChinaEast2, long.MaxValue }, @@ -2372,7 +2372,7 @@ public static List GeneratePreferredRegionList(string sourceRegion) { LocationNames.NorwayEast, 146 }, { LocationNames.NorwayWest, 136 }, { LocationNames.PolandCentral, 126 }, - { LocationNames.QatarCentral, 100 }, + { LocationNames.QatarCentral, 30 }, { LocationNames.SouthAfricaNorth, 264 }, { LocationNames.SouthAfricaWest, 267 }, { LocationNames.SouthCentralUS, 224 }, @@ -5580,4 +5580,4 @@ private static long GetLinkTypeThresholdInMs(GeoLinkTypes geoLinkType) } } } -} +} \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs index 933cc95553..73cd7b7a5b 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RequestNameValueCollection.cs @@ -81,7 +81,6 @@ internal class RequestNameValueCollection : INameValueCollection public string ForceSideBySideIndexMigration { get; set; } public string GatewaySignature { get; set; } public string GetAllPartitionKeyStatistics { get; set; } - public string HighPriorityForcedBackup { get; set; } public string HttpDate { get; set; } public string IfMatch { get; set; } public string IfModifiedSince { get; set; } @@ -100,7 +99,6 @@ internal class RequestNameValueCollection : INameValueCollection public string IsInternalServerlessRequest { get; set; } public string IsMaterializedViewBuild { get; set; } public string IsMaterializedViewSourceSchemaReplaceBatchRequest { get; set; } - public string IsMigratedFixedCollection { get; set; } public string IsOfferStorageRefreshRequest { get; set; } public string IsReadOnlyScript { get; set; } public string IsRetriedWriteRequest { get; set; } @@ -114,9 +112,7 @@ internal class RequestNameValueCollection : INameValueCollection public string MigrateCollectionDirective { get; set; } public string MigrateOfferToAutopilot { get; set; } public string MigrateOfferToManualThroughput { get; set; } - public string NoRetryOn449StatusCode { get; set; } public string OfferReplaceRURedistribution { get; set; } - public string OptimisticDirectExecute { get; set; } public string PageSize { get; set; } public string PartitionCount { get; set; } public string PartitionKey { get; set; } @@ -128,7 +124,6 @@ internal class RequestNameValueCollection : INameValueCollection public string PopulateIndexMetrics { get; set; } public string PopulateIndexMetricsText { get; set; } public string PopulateLogStoreInfo { get; set; } - public string PopulateMinGLSNForDocumentOperations { get; set; } public string PopulateOldestActiveSchemaId { get; set; } public string PopulatePartitionStatistics { get; set; } public string PopulateQueryMetrics { get; set; } @@ -170,16 +165,13 @@ internal class RequestNameValueCollection : INameValueCollection public string SecondaryMasterKey { get; set; } public string SecondaryReadonlyKey { get; set; } public string SessionToken { get; set; } - public string SetMasterResourcesDeletionPending { get; set; } public string ShareThroughput { get; set; } public string ShouldBatchContinueOnError { get; set; } public string ShouldReturnCurrentServerDateTime { get; set; } - public string SkipAdjustThroughputFractionsForOfferReplace { get; set; } public string SkipRefreshDatabaseAccountConfigs { get; set; } public string SourceCollectionIfMatch { get; set; } public string StartEpk { get; set; } public string StartId { get; set; } - public string SupportedSerializationFormats { get; set; } public string SupportSpatialLegacyCoordinates { get; set; } public string SystemDocumentType { get; set; } public string SystemRestoreOperation { get; set; } @@ -195,7 +187,6 @@ internal class RequestNameValueCollection : INameValueCollection public string UniqueIndexReIndexingState { get; set; } public string UpdateMaxThroughputEverProvisioned { get; set; } public string UpdateOfferStateToPending { get; set; } - public string UpdateOfferStateToRestorePending { get; set; } public string UseArchivalPartition { get; set; } public string UsePolygonsSmallerThanAHemisphere { get; set; } public string UseSystemBudget { get; set; } @@ -215,14 +206,6 @@ public RequestNameValueCollection(INameValueCollection nameValueCollection) } } - public RequestNameValueCollection(IDictionary requestHeaders) - { - foreach (KeyValuePair keyValuePair in requestHeaders) - { - this.UpdateHelper(key: keyValuePair.Key, value: keyValuePair.Value, throwIfAlreadyExists: false, ignoreNotCommonHeaders: false); - } - } - /// /// Only process known headers. Ignores nameValueCollection changes by switching to per field assignment if InvalidOperationException happens while iterating over the keys. /// @@ -398,16 +381,7 @@ public static RequestNameValueCollection BuildRequestNameValueCollectionWithKnow requestNameValueCollection.AllowRestoreParamsUpdate = nameValueCollection[HttpConstants.HttpHeaders.AllowRestoreParamsUpdate]; requestNameValueCollection.PruneCollectionSchemas = nameValueCollection[HttpConstants.HttpHeaders.PruneCollectionSchemas]; requestNameValueCollection.PopulateIndexMetricsText = nameValueCollection[HttpConstants.HttpHeaders.PopulateIndexMetricsText]; - requestNameValueCollection.IsMigratedFixedCollection = nameValueCollection[HttpConstants.HttpHeaders.IsMigratedFixedCollection]; - requestNameValueCollection.SupportedSerializationFormats = nameValueCollection[HttpConstants.HttpHeaders.SupportedSerializationFormats]; - requestNameValueCollection.UpdateOfferStateToRestorePending = nameValueCollection[HttpConstants.HttpHeaders.UpdateOfferStateToRestorePending]; - requestNameValueCollection.SetMasterResourcesDeletionPending = nameValueCollection[HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending]; - requestNameValueCollection.HighPriorityForcedBackup = nameValueCollection[HttpConstants.HttpHeaders.HighPriorityForcedBackup]; - requestNameValueCollection.OptimisticDirectExecute = nameValueCollection[HttpConstants.HttpHeaders.OptimisticDirectExecute]; - requestNameValueCollection.PopulateMinGLSNForDocumentOperations = nameValueCollection[WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations]; requestNameValueCollection.IfMatch = nameValueCollection[HttpConstants.HttpHeaders.IfMatch]; - requestNameValueCollection.NoRetryOn449StatusCode = nameValueCollection[HttpConstants.HttpHeaders.NoRetryOn449StatusCode]; - requestNameValueCollection.SkipAdjustThroughputFractionsForOfferReplace = nameValueCollection[HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace]; } return requestNameValueCollection; @@ -489,7 +463,6 @@ public void Clear() this.ForceSideBySideIndexMigration = null; this.GatewaySignature = null; this.GetAllPartitionKeyStatistics = null; - this.HighPriorityForcedBackup = null; this.HttpDate = null; this.IfMatch = null; this.IfModifiedSince = null; @@ -508,7 +481,6 @@ public void Clear() this.IsInternalServerlessRequest = null; this.IsMaterializedViewBuild = null; this.IsMaterializedViewSourceSchemaReplaceBatchRequest = null; - this.IsMigratedFixedCollection = null; this.IsOfferStorageRefreshRequest = null; this.IsReadOnlyScript = null; this.IsRetriedWriteRequest = null; @@ -522,9 +494,7 @@ public void Clear() this.MigrateCollectionDirective = null; this.MigrateOfferToAutopilot = null; this.MigrateOfferToManualThroughput = null; - this.NoRetryOn449StatusCode = null; this.OfferReplaceRURedistribution = null; - this.OptimisticDirectExecute = null; this.PageSize = null; this.PartitionCount = null; this.PartitionKey = null; @@ -536,7 +506,6 @@ public void Clear() this.PopulateIndexMetrics = null; this.PopulateIndexMetricsText = null; this.PopulateLogStoreInfo = null; - this.PopulateMinGLSNForDocumentOperations = null; this.PopulateOldestActiveSchemaId = null; this.PopulatePartitionStatistics = null; this.PopulateQueryMetrics = null; @@ -578,16 +547,13 @@ public void Clear() this.SecondaryMasterKey = null; this.SecondaryReadonlyKey = null; this.SessionToken = null; - this.SetMasterResourcesDeletionPending = null; this.ShareThroughput = null; this.ShouldBatchContinueOnError = null; this.ShouldReturnCurrentServerDateTime = null; - this.SkipAdjustThroughputFractionsForOfferReplace = null; this.SkipRefreshDatabaseAccountConfigs = null; this.SourceCollectionIfMatch = null; this.StartEpk = null; this.StartId = null; - this.SupportedSerializationFormats = null; this.SupportSpatialLegacyCoordinates = null; this.SystemDocumentType = null; this.SystemRestoreOperation = null; @@ -603,7 +569,6 @@ public void Clear() this.UniqueIndexReIndexingState = null; this.UpdateMaxThroughputEverProvisioned = null; this.UpdateOfferStateToPending = null; - this.UpdateOfferStateToRestorePending = null; this.UseArchivalPartition = null; this.UsePolygonsSmallerThanAHemisphere = null; this.UseSystemBudget = null; @@ -662,7 +627,6 @@ public INameValueCollection Clone() ForceSideBySideIndexMigration = this.ForceSideBySideIndexMigration, GatewaySignature = this.GatewaySignature, GetAllPartitionKeyStatistics = this.GetAllPartitionKeyStatistics, - HighPriorityForcedBackup = this.HighPriorityForcedBackup, HttpDate = this.HttpDate, IfMatch = this.IfMatch, IfModifiedSince = this.IfModifiedSince, @@ -681,7 +645,6 @@ public INameValueCollection Clone() IsInternalServerlessRequest = this.IsInternalServerlessRequest, IsMaterializedViewBuild = this.IsMaterializedViewBuild, IsMaterializedViewSourceSchemaReplaceBatchRequest = this.IsMaterializedViewSourceSchemaReplaceBatchRequest, - IsMigratedFixedCollection = this.IsMigratedFixedCollection, IsOfferStorageRefreshRequest = this.IsOfferStorageRefreshRequest, IsReadOnlyScript = this.IsReadOnlyScript, IsRetriedWriteRequest = this.IsRetriedWriteRequest, @@ -695,9 +658,7 @@ public INameValueCollection Clone() MigrateCollectionDirective = this.MigrateCollectionDirective, MigrateOfferToAutopilot = this.MigrateOfferToAutopilot, MigrateOfferToManualThroughput = this.MigrateOfferToManualThroughput, - NoRetryOn449StatusCode = this.NoRetryOn449StatusCode, OfferReplaceRURedistribution = this.OfferReplaceRURedistribution, - OptimisticDirectExecute = this.OptimisticDirectExecute, PageSize = this.PageSize, PartitionCount = this.PartitionCount, PartitionKey = this.PartitionKey, @@ -709,7 +670,6 @@ public INameValueCollection Clone() PopulateIndexMetrics = this.PopulateIndexMetrics, PopulateIndexMetricsText = this.PopulateIndexMetricsText, PopulateLogStoreInfo = this.PopulateLogStoreInfo, - PopulateMinGLSNForDocumentOperations = this.PopulateMinGLSNForDocumentOperations, PopulateOldestActiveSchemaId = this.PopulateOldestActiveSchemaId, PopulatePartitionStatistics = this.PopulatePartitionStatistics, PopulateQueryMetrics = this.PopulateQueryMetrics, @@ -751,16 +711,13 @@ public INameValueCollection Clone() SecondaryMasterKey = this.SecondaryMasterKey, SecondaryReadonlyKey = this.SecondaryReadonlyKey, SessionToken = this.SessionToken, - SetMasterResourcesDeletionPending = this.SetMasterResourcesDeletionPending, ShareThroughput = this.ShareThroughput, ShouldBatchContinueOnError = this.ShouldBatchContinueOnError, ShouldReturnCurrentServerDateTime = this.ShouldReturnCurrentServerDateTime, - SkipAdjustThroughputFractionsForOfferReplace = this.SkipAdjustThroughputFractionsForOfferReplace, SkipRefreshDatabaseAccountConfigs = this.SkipRefreshDatabaseAccountConfigs, SourceCollectionIfMatch = this.SourceCollectionIfMatch, StartEpk = this.StartEpk, StartId = this.StartId, - SupportedSerializationFormats = this.SupportedSerializationFormats, SupportSpatialLegacyCoordinates = this.SupportSpatialLegacyCoordinates, SystemDocumentType = this.SystemDocumentType, SystemRestoreOperation = this.SystemRestoreOperation, @@ -776,7 +733,6 @@ public INameValueCollection Clone() UniqueIndexReIndexingState = this.UniqueIndexReIndexingState, UpdateMaxThroughputEverProvisioned = this.UpdateMaxThroughputEverProvisioned, UpdateOfferStateToPending = this.UpdateOfferStateToPending, - UpdateOfferStateToRestorePending = this.UpdateOfferStateToRestorePending, UseArchivalPartition = this.UseArchivalPartition, UsePolygonsSmallerThanAHemisphere = this.UsePolygonsSmallerThanAHemisphere, UseSystemBudget = this.UseSystemBudget, @@ -1440,48 +1396,12 @@ public IEnumerable Keys() { yield return HttpConstants.HttpHeaders.PopulateIndexMetricsText; } - if (this.IsMigratedFixedCollection != null) - { - yield return HttpConstants.HttpHeaders.IsMigratedFixedCollection; - } - if (this.SupportedSerializationFormats != null) - { - yield return HttpConstants.HttpHeaders.SupportedSerializationFormats; - } - if (this.UpdateOfferStateToRestorePending != null) - { - yield return HttpConstants.HttpHeaders.UpdateOfferStateToRestorePending; - } - if (this.SetMasterResourcesDeletionPending != null) - { - yield return HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending; - } - if (this.HighPriorityForcedBackup != null) - { - yield return HttpConstants.HttpHeaders.HighPriorityForcedBackup; - } - if (this.OptimisticDirectExecute != null) - { - yield return HttpConstants.HttpHeaders.OptimisticDirectExecute; - } - if (this.PopulateMinGLSNForDocumentOperations != null) - { - yield return WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations; - } if (this.IfMatch != null) { yield return HttpConstants.HttpHeaders.IfMatch; } - if (this.NoRetryOn449StatusCode != null) - { - yield return HttpConstants.HttpHeaders.NoRetryOn449StatusCode; - } - if (this.SkipAdjustThroughputFractionsForOfferReplace != null) - { - yield return HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace; - } - if (this.notCommonHeaders != null) + if(this.notCommonHeaders != null) { foreach (string key in this.notCommonHeaders.Keys) { @@ -2126,47 +2046,11 @@ public NameValueCollection ToNameValueCollection() { this.nameValueCollection.Add(HttpConstants.HttpHeaders.PopulateIndexMetricsText, this.PopulateIndexMetricsText); } - if (this.IsMigratedFixedCollection != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.IsMigratedFixedCollection, this.IsMigratedFixedCollection); - } - if (this.SupportedSerializationFormats != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.SupportedSerializationFormats, this.SupportedSerializationFormats); - } - if (this.UpdateOfferStateToRestorePending != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.UpdateOfferStateToRestorePending, this.UpdateOfferStateToRestorePending); - } - if (this.SetMasterResourcesDeletionPending != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending, this.SetMasterResourcesDeletionPending); - } - if (this.HighPriorityForcedBackup != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.HighPriorityForcedBackup, this.HighPriorityForcedBackup); - } - if (this.OptimisticDirectExecute != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.OptimisticDirectExecute, this.OptimisticDirectExecute); - } - if (this.PopulateMinGLSNForDocumentOperations != null) - { - this.nameValueCollection.Add(WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations, this.PopulateMinGLSNForDocumentOperations); - } if (this.IfMatch != null) { this.nameValueCollection.Add(HttpConstants.HttpHeaders.IfMatch, this.IfMatch); } - if (this.NoRetryOn449StatusCode != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.NoRetryOn449StatusCode, this.NoRetryOn449StatusCode); - } - if (this.SkipAdjustThroughputFractionsForOfferReplace != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace, this.SkipAdjustThroughputFractionsForOfferReplace); - } - if (this.notCommonHeaders != null) + if(this.notCommonHeaders != null) { foreach (KeyValuePair keyValuePair in this.notCommonHeaders) { @@ -2358,10 +2242,6 @@ public string Get(string key) { return this.RbacAction; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.NoRetryOn449StatusCode, key)) - { - return this.NoRetryOn449StatusCode; - } if (string.Equals(HttpConstants.HttpHeaders.CanThrottle, key, StringComparison.OrdinalIgnoreCase)) { return this.CanThrottle; @@ -2377,11 +2257,6 @@ public string Get(string key) return this.RbacAction; } - if (string.Equals(HttpConstants.HttpHeaders.NoRetryOn449StatusCode, key, StringComparison.OrdinalIgnoreCase)) - { - return this.NoRetryOn449StatusCode; - } - break; case 17: if (object.ReferenceEquals(HttpConstants.HttpHeaders.Continuation, key)) @@ -3308,24 +3183,11 @@ public string Get(string key) break; case 41: - if (object.ReferenceEquals(HttpConstants.HttpHeaders.ForceDatabaseAccountUpdate, key)) - { - return this.ForceDatabaseAccountUpdate; - } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.OptimisticDirectExecute, key)) - { - return this.OptimisticDirectExecute; - } if (string.Equals(HttpConstants.HttpHeaders.ForceDatabaseAccountUpdate, key, StringComparison.OrdinalIgnoreCase)) { return this.ForceDatabaseAccountUpdate; } - if (string.Equals(HttpConstants.HttpHeaders.OptimisticDirectExecute, key, StringComparison.OrdinalIgnoreCase)) - { - return this.OptimisticDirectExecute; - } - break; case 42: if (object.ReferenceEquals(WFConstants.BackendHeaders.MergeCheckPointGLSN, key)) @@ -3373,10 +3235,6 @@ public string Get(string key) { return this.UniqueIndexNameEncodingMode; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.SupportedSerializationFormats, key)) - { - return this.SupportedSerializationFormats; - } if (string.Equals(HttpConstants.HttpHeaders.DisableRUPerMinuteUsage, key, StringComparison.OrdinalIgnoreCase)) { return this.DisableRUPerMinuteUsage; @@ -3397,11 +3255,6 @@ public string Get(string key) return this.UniqueIndexNameEncodingMode; } - if (string.Equals(HttpConstants.HttpHeaders.SupportedSerializationFormats, key, StringComparison.OrdinalIgnoreCase)) - { - return this.SupportedSerializationFormats; - } - break; case 44: if (object.ReferenceEquals(HttpConstants.HttpHeaders.ContentSerializationFormat, key)) @@ -3470,10 +3323,6 @@ public string Get(string key) { return this.SkipRefreshDatabaseAccountConfigs; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.IsMigratedFixedCollection, key)) - { - return this.IsMigratedFixedCollection; - } if (string.Equals(HttpConstants.HttpHeaders.MigrateOfferToManualThroughput, key, StringComparison.OrdinalIgnoreCase)) { return this.MigrateOfferToManualThroughput; @@ -3484,11 +3333,6 @@ public string Get(string key) return this.SkipRefreshDatabaseAccountConfigs; } - if (string.Equals(HttpConstants.HttpHeaders.IsMigratedFixedCollection, key, StringComparison.OrdinalIgnoreCase)) - { - return this.IsMigratedFixedCollection; - } - break; case 47: if (object.ReferenceEquals(HttpConstants.HttpHeaders.SupportSpatialLegacyCoordinates, key)) @@ -3545,10 +3389,6 @@ public string Get(string key) { return this.AllowRestoreParamsUpdate; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.HighPriorityForcedBackup, key)) - { - return this.HighPriorityForcedBackup; - } if (string.Equals(HttpConstants.HttpHeaders.PopulateCollectionThroughputInfo, key, StringComparison.OrdinalIgnoreCase)) { return this.PopulateCollectionThroughputInfo; @@ -3569,11 +3409,6 @@ public string Get(string key) return this.AllowRestoreParamsUpdate; } - if (string.Equals(HttpConstants.HttpHeaders.HighPriorityForcedBackup, key, StringComparison.OrdinalIgnoreCase)) - { - return this.HighPriorityForcedBackup; - } - break; case 49: if (string.Equals(HttpConstants.HttpHeaders.UsePolygonsSmallerThanAHemisphere, key, StringComparison.OrdinalIgnoreCase)) @@ -3647,10 +3482,6 @@ public string Get(string key) { return this.IsOfferStorageRefreshRequest; } - if (object.ReferenceEquals(WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations, key)) - { - return this.PopulateMinGLSNForDocumentOperations; - } if (string.Equals(HttpConstants.HttpHeaders.IsRUPerGBEnforcementRequest, key, StringComparison.OrdinalIgnoreCase)) { return this.IsRUPerGBEnforcementRequest; @@ -3661,11 +3492,6 @@ public string Get(string key) return this.IsOfferStorageRefreshRequest; } - if (string.Equals(WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations, key, StringComparison.OrdinalIgnoreCase)) - { - return this.PopulateMinGLSNForDocumentOperations; - } - break; case 54: if (object.ReferenceEquals(HttpConstants.HttpHeaders.IncludePhysicalPartitionThroughputInfo, key)) @@ -3686,13 +3512,6 @@ public string Get(string key) return this.IsMaterializedViewSourceSchemaReplaceBatchRequest; } - break; - case 55: - if (string.Equals(HttpConstants.HttpHeaders.UpdateOfferStateToRestorePending, key, StringComparison.OrdinalIgnoreCase)) - { - return this.UpdateOfferStateToRestorePending; - } - break; case 56: if (string.Equals(WFConstants.BackendHeaders.CollectionChildResourceContentLimitInKB, key, StringComparison.OrdinalIgnoreCase)) @@ -3709,24 +3528,11 @@ public string Get(string key) break; case 58: - if (object.ReferenceEquals(HttpConstants.HttpHeaders.IgnoreSystemLoweringMaxThroughput, key)) - { - return this.IgnoreSystemLoweringMaxThroughput; - } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending, key)) - { - return this.SetMasterResourcesDeletionPending; - } if (string.Equals(HttpConstants.HttpHeaders.IgnoreSystemLoweringMaxThroughput, key, StringComparison.OrdinalIgnoreCase)) { return this.IgnoreSystemLoweringMaxThroughput; } - if (string.Equals(HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending, key, StringComparison.OrdinalIgnoreCase)) - { - return this.SetMasterResourcesDeletionPending; - } - break; case 59: if (string.Equals(HttpConstants.HttpHeaders.UpdateMaxThroughputEverProvisioned, key, StringComparison.OrdinalIgnoreCase)) @@ -3741,13 +3547,6 @@ public string Get(string key) return this.IsServerlessStorageRefreshRequest; } - break; - case 62: - if (string.Equals(HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace, key, StringComparison.OrdinalIgnoreCase)) - { - return this.SkipAdjustThroughputFractionsForOfferReplace; - } - break; default: break; @@ -4127,16 +3926,6 @@ public void UpdateHelper( this.RbacAction = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.NoRetryOn449StatusCode, key)) - { - if (throwIfAlreadyExists && this.NoRetryOn449StatusCode != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.NoRetryOn449StatusCode = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.CanThrottle, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.CanThrottle != null) @@ -4167,16 +3956,6 @@ public void UpdateHelper( this.RbacAction = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.NoRetryOn449StatusCode, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.NoRetryOn449StatusCode != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.NoRetryOn449StatusCode = value; - return; - } break; case 17: if (object.ReferenceEquals(HttpConstants.HttpHeaders.Continuation, key)) @@ -6175,26 +5954,6 @@ public void UpdateHelper( } break; case 41: - if (object.ReferenceEquals(HttpConstants.HttpHeaders.ForceDatabaseAccountUpdate, key)) - { - if (throwIfAlreadyExists && this.ForceDatabaseAccountUpdate != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.ForceDatabaseAccountUpdate = value; - return; - } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.OptimisticDirectExecute, key)) - { - if (throwIfAlreadyExists && this.OptimisticDirectExecute != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.OptimisticDirectExecute = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.ForceDatabaseAccountUpdate, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.ForceDatabaseAccountUpdate != null) @@ -6205,16 +5964,6 @@ public void UpdateHelper( this.ForceDatabaseAccountUpdate = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.OptimisticDirectExecute, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.OptimisticDirectExecute != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.OptimisticDirectExecute = value; - return; - } break; case 42: if (object.ReferenceEquals(WFConstants.BackendHeaders.MergeCheckPointGLSN, key)) @@ -6319,16 +6068,6 @@ public void UpdateHelper( this.UniqueIndexNameEncodingMode = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.SupportedSerializationFormats, key)) - { - if (throwIfAlreadyExists && this.SupportedSerializationFormats != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.SupportedSerializationFormats = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.DisableRUPerMinuteUsage, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.DisableRUPerMinuteUsage != null) @@ -6369,16 +6108,6 @@ public void UpdateHelper( this.UniqueIndexNameEncodingMode = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.SupportedSerializationFormats, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.SupportedSerializationFormats != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.SupportedSerializationFormats = value; - return; - } break; case 44: if (object.ReferenceEquals(HttpConstants.HttpHeaders.ContentSerializationFormat, key)) @@ -6525,16 +6254,6 @@ public void UpdateHelper( this.SkipRefreshDatabaseAccountConfigs = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.IsMigratedFixedCollection, key)) - { - if (throwIfAlreadyExists && this.IsMigratedFixedCollection != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.IsMigratedFixedCollection = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.MigrateOfferToManualThroughput, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.MigrateOfferToManualThroughput != null) @@ -6555,16 +6274,6 @@ public void UpdateHelper( this.SkipRefreshDatabaseAccountConfigs = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.IsMigratedFixedCollection, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.IsMigratedFixedCollection != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.IsMigratedFixedCollection = value; - return; - } break; case 47: if (object.ReferenceEquals(HttpConstants.HttpHeaders.SupportSpatialLegacyCoordinates, key)) @@ -6689,16 +6398,6 @@ public void UpdateHelper( this.AllowRestoreParamsUpdate = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.HighPriorityForcedBackup, key)) - { - if (throwIfAlreadyExists && this.HighPriorityForcedBackup != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.HighPriorityForcedBackup = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.PopulateCollectionThroughputInfo, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.PopulateCollectionThroughputInfo != null) @@ -6739,16 +6438,6 @@ public void UpdateHelper( this.AllowRestoreParamsUpdate = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.HighPriorityForcedBackup, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.HighPriorityForcedBackup != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.HighPriorityForcedBackup = value; - return; - } break; case 49: if (string.Equals(HttpConstants.HttpHeaders.UsePolygonsSmallerThanAHemisphere, key, StringComparison.OrdinalIgnoreCase)) @@ -6899,16 +6588,6 @@ public void UpdateHelper( this.IsOfferStorageRefreshRequest = value; return; } - if (object.ReferenceEquals(WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations, key)) - { - if (throwIfAlreadyExists && this.PopulateMinGLSNForDocumentOperations != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.PopulateMinGLSNForDocumentOperations = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.IsRUPerGBEnforcementRequest, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.IsRUPerGBEnforcementRequest != null) @@ -6929,16 +6608,6 @@ public void UpdateHelper( this.IsOfferStorageRefreshRequest = value; return; } - if (string.Equals(WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.PopulateMinGLSNForDocumentOperations != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.PopulateMinGLSNForDocumentOperations = value; - return; - } break; case 54: if (object.ReferenceEquals(HttpConstants.HttpHeaders.IncludePhysicalPartitionThroughputInfo, key)) @@ -6982,18 +6651,6 @@ public void UpdateHelper( return; } break; - case 55: - if (string.Equals(HttpConstants.HttpHeaders.UpdateOfferStateToRestorePending, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.UpdateOfferStateToRestorePending != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.UpdateOfferStateToRestorePending = value; - return; - } - break; case 56: if (string.Equals(WFConstants.BackendHeaders.CollectionChildResourceContentLimitInKB, key, StringComparison.OrdinalIgnoreCase)) { @@ -7019,26 +6676,6 @@ public void UpdateHelper( } break; case 58: - if (object.ReferenceEquals(HttpConstants.HttpHeaders.IgnoreSystemLoweringMaxThroughput, key)) - { - if (throwIfAlreadyExists && this.IgnoreSystemLoweringMaxThroughput != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.IgnoreSystemLoweringMaxThroughput = value; - return; - } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending, key)) - { - if (throwIfAlreadyExists && this.SetMasterResourcesDeletionPending != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.SetMasterResourcesDeletionPending = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.IgnoreSystemLoweringMaxThroughput, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.IgnoreSystemLoweringMaxThroughput != null) @@ -7049,16 +6686,6 @@ public void UpdateHelper( this.IgnoreSystemLoweringMaxThroughput = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.SetMasterResourcesDeletionPending, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.SetMasterResourcesDeletionPending != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.SetMasterResourcesDeletionPending = value; - return; - } break; case 59: if (string.Equals(HttpConstants.HttpHeaders.UpdateMaxThroughputEverProvisioned, key, StringComparison.OrdinalIgnoreCase)) @@ -7084,18 +6711,6 @@ public void UpdateHelper( return; } break; - case 62: - if (string.Equals(HttpConstants.HttpHeaders.SkipAdjustThroughputFractionsForOfferReplace, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.SkipAdjustThroughputFractionsForOfferReplace != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.SkipAdjustThroughputFractionsForOfferReplace = value; - return; - } - break; default: break; } diff --git a/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs b/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs index 7700911c57..fd5b76af0a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RequestOptions.cs @@ -626,7 +626,7 @@ sealed class RequestOptions /// /// /// - internal PriorityLevel? PriorityLevel { get; set; } + public PriorityLevel? PriorityLevel { get; set; } #if !COSMOSCLIENT /// diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs index 1a4b9e9bec..675e81f875 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdConstants.cs @@ -10,7 +10,6 @@ namespace Microsoft.Azure.Documents { using System; using System.Collections.Concurrent; - using System.Collections.Generic; /// /// THIS IS AN AUTOGENERATED FILE. ALL UPDATES SHOULD BE DONE VIA RntbdConstants.tt @@ -123,9 +122,6 @@ public enum RntbdOperationType : ushort CreateSystemSnapshot = 0x0032, UpdateFailoverPriorityList = 0x0033, GetStorageAuthToken = 0x0034, - UpdatePartitionThroughput = 0x0035, - CreateRidRangeResources = 0x0036, - Truncate = 0x0037, } public enum ConnectionContextRequestTokenIdentifiers : ushort @@ -274,15 +270,6 @@ public enum RntbdContentSerializationFormat : byte Invalid = 0xFF, } - [Flags] - public enum RntbdSupportedSerializationFormats : byte - { - None = 0x00, - JsonText = 0x01, - CosmosBinary = 0x02, - HybridRow = 0x04, - } - public enum RntbdSystemDocumentType : byte { PartitionKey = 0x00, @@ -485,14 +472,7 @@ public enum RequestIdentifiers : ushort PriorityLevel = 0x00BF, AllowRestoreParamsUpdate = 0x00C0, PruneCollectionSchemas = 0x00C1, - PopulateIndexMetricsText = 0x00C2, - IsMigratedFixedCollection = 0x00C3, - SupportedSerializationFormats = 0x00C4, - UpdateOfferStateToRestorePending = 0x00C5, - SetMasterResourcesDeletionPending = 0x00C6, - HighPriorityForcedBackup = 0x00C7, - OptimisticDirectExecute = 0x00C8, - PopulateMinGLSNForDocumentOperations = 0x00C9, + PopulateIndexMetricsText = 0x00C2 } public sealed class Request : RntbdTokenStream @@ -677,13 +657,6 @@ public sealed class Request : RntbdTokenStream public RntbdToken allowRestoreParamsUpdate; public RntbdToken pruneCollectionSchemas; public RntbdToken populateIndexMetricsText; - public RntbdToken isMigratedFixedCollection; - public RntbdToken supportedSerializationFormats; - public RntbdToken updateOfferStateToRestorePending; - public RntbdToken setMasterResourcesDeletionPending; - public RntbdToken highPriorityForcedBackup; - public RntbdToken optimisticDirectExecute; - public RntbdToken populateMinGLSNForDocumentOperations; public Request() { @@ -865,13 +838,6 @@ public Request() this.allowRestoreParamsUpdate = new RntbdToken(false, RntbdTokenTypes.String, (ushort)RequestIdentifiers.AllowRestoreParamsUpdate); this.pruneCollectionSchemas = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.PruneCollectionSchemas); this.populateIndexMetricsText = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.PopulateIndexMetricsText); - this.isMigratedFixedCollection = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.IsMigratedFixedCollection); - this.supportedSerializationFormats = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.SupportedSerializationFormats); - this.updateOfferStateToRestorePending = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.UpdateOfferStateToRestorePending); - this.setMasterResourcesDeletionPending = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.SetMasterResourcesDeletionPending); - this.highPriorityForcedBackup = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.HighPriorityForcedBackup); - this.optimisticDirectExecute = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.OptimisticDirectExecute); - this.populateMinGLSNForDocumentOperations = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)RequestIdentifiers.PopulateMinGLSNForDocumentOperations); this.tokens = new RntbdToken[] { @@ -1070,37 +1036,21 @@ public Request() this.allowRestoreParamsUpdate, this.pruneCollectionSchemas, this.populateIndexMetricsText, - this.isMigratedFixedCollection, - this.supportedSerializationFormats, - this.updateOfferStateToRestorePending, - this.setMasterResourcesDeletionPending, - this.highPriorityForcedBackup, - this.optimisticDirectExecute, - this.populateMinGLSNForDocumentOperations, }; } } - // Values are generated from the common source where response headers ordered by the chance headers could apper on response. - // This order helps in constracting more performant switch statements in the loop(s) processing response headers. public enum ResponseIdentifiers : ushort { - TransportRequestID = 0x0035, - ServerDateTimeUtc = 0x0039, - SubStatus = 0x001C, - ETag = 0x0004, - ResourceName = 0x0047, - RequestCharge = 0x0015, - SessionToken = 0x003E, - ContinuationToken = 0x0003, - LSN = 0x0013, - GlobalCommittedLSN = 0x0029, - ItemLSN = 0x0032, - LocalLSN = 0x003A, - QuorumAckedLocalLSN = 0x003B, - ItemLocalLSN = 0x003C, PayloadPresent = 0x0000, LastStateChangeDateTime = 0x0002, + ContinuationToken = 0x0003, + ETag = 0x0004, + ReadsPerformed = 0x0007, + WritesPerformed = 0x0008, + QueriesPerformed = 0x0009, + IndexTermsGenerated = 0x000A, + ScriptsExecuted = 0x000B, RetryAfterMilliseconds = 0x000C, IndexingDirective = 0x000D, StorageMaxResoureQuota = 0x000E, @@ -1108,12 +1058,15 @@ public enum ResponseIdentifiers : ushort SchemaVersion = 0x0010, CollectionPartitionIndex = 0x0011, CollectionServiceIndex = 0x0012, + LSN = 0x0013, ItemCount = 0x0014, + RequestCharge = 0x0015, OwnerFullName = 0x0017, OwnerId = 0x0018, DatabaseAccountId = 0x0019, QuorumAckedLSN = 0x001A, RequestValidationFailure = 0x001B, + SubStatus = 0x001C, CollectionUpdateProgress = 0x001D, CurrentWriteQuorum = 0x001E, CurrentReplicaSetSize = 0x001F, @@ -1123,13 +1076,21 @@ public enum ResponseIdentifiers : ushort XPRole = 0x0026, IsRUPerMinuteUsed = 0x0027, QueryMetrics = 0x0028, + GlobalCommittedLSN = 0x0029, NumberOfReadRegions = 0x0030, OfferReplacePending = 0x0031, + ItemLSN = 0x0032, RestoreState = 0x0033, CollectionSecurityIdentifier = 0x0034, + TransportRequestID = 0x0035, ShareThroughput = 0x0036, DisableRntbdChannel = 0x0038, + ServerDateTimeUtc = 0x0039, + LocalLSN = 0x003A, + QuorumAckedLocalLSN = 0x003B, + ItemLocalLSN = 0x003C, HasTentativeWrites = 0x003D, + SessionToken = 0x003E, ReplicatorLSNToGLSNDelta = 0x003F, ReplicatorLSNToLLSNDelta = 0x0040, VectorClockLocalProgress = 0x0041, @@ -1138,6 +1099,7 @@ public enum ResponseIdentifiers : ushort IndexUtilization = 0x0044, QueryExecutionInfo = 0x0045, UnflushedMergeLogEntryCount = 0x0046, + ResourceName = 0x0047, TimeToLiveInSeconds = 0x0048, ReplicaStatusRevoked = 0x0049, SoftMaxAllowedThroughput = 0x0050, @@ -1160,11 +1122,280 @@ public enum ResponseIdentifiers : ushort MaxContentLength = 0x0061, OldestActiveSchemaId = 0x0062, PhysicalPartitionId = 0x0063, - OfferRestorePending = 0x0064, - InstantScaleUpValue = 0x0065, - RequiresDistribution = 0x0066, - CapacityType = 0x0067, - MinGLSNForDocumentOperations = 0x0068, + } + + public sealed class Response : RntbdTokenStream + { + public override int RequiredTokenCount => 1; + + public RntbdToken payloadPresent; + public RntbdToken lastStateChangeDateTime; + public RntbdToken continuationToken; + public RntbdToken eTag; + public RntbdToken readsPerformed; + public RntbdToken writesPerformed; + public RntbdToken queriesPerformed; + public RntbdToken indexTermsGenerated; + public RntbdToken scriptsExecuted; + public RntbdToken retryAfterMilliseconds; + public RntbdToken indexingDirective; + public RntbdToken storageMaxResoureQuota; + public RntbdToken storageResourceQuotaUsage; + public RntbdToken schemaVersion; + public RntbdToken collectionPartitionIndex; + public RntbdToken collectionServiceIndex; + public RntbdToken lSN; + public RntbdToken itemCount; + public RntbdToken requestCharge; + public RntbdToken ownerFullName; + public RntbdToken ownerId; + public RntbdToken databaseAccountId; + public RntbdToken quorumAckedLSN; + public RntbdToken requestValidationFailure; + public RntbdToken subStatus; + public RntbdToken collectionUpdateProgress; + public RntbdToken currentWriteQuorum; + public RntbdToken currentReplicaSetSize; + public RntbdToken collectionLazyIndexProgress; + public RntbdToken partitionKeyRangeId; + public RntbdToken logResults; + public RntbdToken xPRole; + public RntbdToken isRUPerMinuteUsed; + public RntbdToken queryMetrics; + public RntbdToken globalCommittedLSN; + public RntbdToken numberOfReadRegions; + public RntbdToken offerReplacePending; + public RntbdToken itemLSN; + public RntbdToken restoreState; + public RntbdToken collectionSecurityIdentifier; + public RntbdToken transportRequestID; + public RntbdToken shareThroughput; + public RntbdToken disableRntbdChannel; + public RntbdToken serverDateTimeUtc; + public RntbdToken localLSN; + public RntbdToken quorumAckedLocalLSN; + public RntbdToken itemLocalLSN; + public RntbdToken hasTentativeWrites; + public RntbdToken sessionToken; + public RntbdToken replicatorLSNToGLSNDelta; + public RntbdToken replicatorLSNToLLSNDelta; + public RntbdToken vectorClockLocalProgress; + public RntbdToken minimumRUsForOffer; + public RntbdToken xPConfigurationSessionsCount; + public RntbdToken indexUtilization; + public RntbdToken queryExecutionInfo; + public RntbdToken unflushedMergeLogEntryCount; + public RntbdToken resourceName; + public RntbdToken timeToLiveInSeconds; + public RntbdToken replicaStatusRevoked; + public RntbdToken softMaxAllowedThroughput; + public RntbdToken backendRequestDurationMilliseconds; + public RntbdToken correlatedActivityId; + public RntbdToken confirmedStoreChecksum; + public RntbdToken tentativeStoreChecksum; + public RntbdToken pendingPKDelete; + public RntbdToken aadAppliedRoleAssignmentId; + public RntbdToken collectionUniqueIndexReIndexProgress; + public RntbdToken collectionUniqueKeysUnderReIndex; + public RntbdToken analyticalMigrationProgress; + public RntbdToken totalAccountThroughput; + public RntbdToken bYOKEncryptionProgress; + public RntbdToken appliedPolicyElementId; + public RntbdToken mergeProgressBlocked; + public RntbdToken changeFeedInfo; + public RntbdToken reindexerProgress; + public RntbdToken offerReplacePendingForMerge; + public RntbdToken maxContentLength; + public RntbdToken oldestActiveSchemaId; + public RntbdToken physicalPartitionId; + + public Response() + { + this.payloadPresent = new RntbdToken(true, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.PayloadPresent); + this.lastStateChangeDateTime = new RntbdToken(false, RntbdTokenTypes.SmallString, (ushort)ResponseIdentifiers.LastStateChangeDateTime); + this.continuationToken = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.ContinuationToken); + this.eTag = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.ETag); + this.readsPerformed = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.ReadsPerformed); + this.writesPerformed = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.WritesPerformed); + this.queriesPerformed = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.QueriesPerformed); + this.indexTermsGenerated = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.IndexTermsGenerated); + this.scriptsExecuted = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.ScriptsExecuted); + this.retryAfterMilliseconds = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.RetryAfterMilliseconds); + this.indexingDirective = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.IndexingDirective); + this.storageMaxResoureQuota = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.StorageMaxResoureQuota); + this.storageResourceQuotaUsage = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.StorageResourceQuotaUsage); + this.schemaVersion = new RntbdToken(false, RntbdTokenTypes.SmallString, (ushort)ResponseIdentifiers.SchemaVersion); + this.collectionPartitionIndex = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CollectionPartitionIndex); + this.collectionServiceIndex = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CollectionServiceIndex); + this.lSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.LSN); + this.itemCount = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.ItemCount); + this.requestCharge = new RntbdToken(false, RntbdTokenTypes.Double, (ushort)ResponseIdentifiers.RequestCharge); + this.ownerFullName = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.OwnerFullName); + this.ownerId = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.OwnerId); + this.databaseAccountId = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.DatabaseAccountId); + this.quorumAckedLSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.QuorumAckedLSN); + this.requestValidationFailure = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.RequestValidationFailure); + this.subStatus = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.SubStatus); + this.collectionUpdateProgress = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CollectionUpdateProgress); + this.currentWriteQuorum = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CurrentWriteQuorum); + this.currentReplicaSetSize = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CurrentReplicaSetSize); + this.collectionLazyIndexProgress = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CollectionLazyIndexProgress); + this.partitionKeyRangeId = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.PartitionKeyRangeId); + this.logResults = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.LogResults); + this.xPRole = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.XPRole); + this.isRUPerMinuteUsed = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.IsRUPerMinuteUsed); + this.queryMetrics = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.QueryMetrics); + this.globalCommittedLSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.GlobalCommittedLSN); + this.numberOfReadRegions = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.NumberOfReadRegions); + this.offerReplacePending = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.OfferReplacePending); + this.itemLSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.ItemLSN); + this.restoreState = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.RestoreState); + this.collectionSecurityIdentifier = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.CollectionSecurityIdentifier); + this.transportRequestID = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.TransportRequestID); + this.shareThroughput = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.ShareThroughput); + this.disableRntbdChannel = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.DisableRntbdChannel); + this.serverDateTimeUtc = new RntbdToken(false, RntbdTokenTypes.SmallString, (ushort)ResponseIdentifiers.ServerDateTimeUtc); + this.localLSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.LocalLSN); + this.quorumAckedLocalLSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.QuorumAckedLocalLSN); + this.itemLocalLSN = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.ItemLocalLSN); + this.hasTentativeWrites = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.HasTentativeWrites); + this.sessionToken = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.SessionToken); + this.replicatorLSNToGLSNDelta = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.ReplicatorLSNToGLSNDelta); + this.replicatorLSNToLLSNDelta = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.ReplicatorLSNToLLSNDelta); + this.vectorClockLocalProgress = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.VectorClockLocalProgress); + this.minimumRUsForOffer = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.MinimumRUsForOffer); + this.xPConfigurationSessionsCount = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.XPConfigurationSessionsCount); + this.indexUtilization = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.IndexUtilization); + this.queryExecutionInfo = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.QueryExecutionInfo); + this.unflushedMergeLogEntryCount = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.UnflushedMergeLogEntryCount); + this.resourceName = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.ResourceName); + this.timeToLiveInSeconds = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.TimeToLiveInSeconds); + this.replicaStatusRevoked = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.ReplicaStatusRevoked); + this.softMaxAllowedThroughput = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.SoftMaxAllowedThroughput); + this.backendRequestDurationMilliseconds = new RntbdToken(false, RntbdTokenTypes.Double, (ushort)ResponseIdentifiers.BackendRequestDurationMilliseconds); + this.correlatedActivityId = new RntbdToken(false, RntbdTokenTypes.Guid, (ushort)ResponseIdentifiers.CorrelatedActivityId); + this.confirmedStoreChecksum = new RntbdToken(false, RntbdTokenTypes.ULongLong, (ushort)ResponseIdentifiers.ConfirmedStoreChecksum); + this.tentativeStoreChecksum = new RntbdToken(false, RntbdTokenTypes.ULongLong, (ushort)ResponseIdentifiers.TentativeStoreChecksum); + this.pendingPKDelete = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.PendingPKDelete); + this.aadAppliedRoleAssignmentId = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.AadAppliedRoleAssignmentId); + this.collectionUniqueIndexReIndexProgress = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.CollectionUniqueIndexReIndexProgress); + this.collectionUniqueKeysUnderReIndex = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.CollectionUniqueKeysUnderReIndex); + this.analyticalMigrationProgress = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.AnalyticalMigrationProgress); + this.totalAccountThroughput = new RntbdToken(false, RntbdTokenTypes.LongLong, (ushort)ResponseIdentifiers.TotalAccountThroughput); + this.bYOKEncryptionProgress = new RntbdToken(false, RntbdTokenTypes.Long, (ushort)ResponseIdentifiers.BYOKEncryptionProgress); + this.appliedPolicyElementId = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.AppliedPolicyElementId); + this.mergeProgressBlocked = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.MergeProgressBlocked); + this.changeFeedInfo = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.ChangeFeedInfo); + this.reindexerProgress = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.ReindexerProgress); + this.offerReplacePendingForMerge = new RntbdToken(false, RntbdTokenTypes.Byte, (ushort)ResponseIdentifiers.OfferReplacePendingForMerge); + this.maxContentLength = new RntbdToken(false, RntbdTokenTypes.ULong, (ushort)ResponseIdentifiers.MaxContentLength); + this.oldestActiveSchemaId = new RntbdToken(false, RntbdTokenTypes.Long, (ushort)ResponseIdentifiers.OldestActiveSchemaId); + this.physicalPartitionId = new RntbdToken(false, RntbdTokenTypes.String, (ushort)ResponseIdentifiers.PhysicalPartitionId); + + this.tokens = new RntbdToken[] + { + this.payloadPresent, + null, // 0x0001 + this.lastStateChangeDateTime, + this.continuationToken, + this.eTag, + null, // 0x0005 + null, // 0x0006 + this.readsPerformed, + this.writesPerformed, + this.queriesPerformed, + this.indexTermsGenerated, + this.scriptsExecuted, + this.retryAfterMilliseconds, + this.indexingDirective, + this.storageMaxResoureQuota, + this.storageResourceQuotaUsage, + this.schemaVersion, + this.collectionPartitionIndex, + this.collectionServiceIndex, + this.lSN, + this.itemCount, + this.requestCharge, + null, // 0x0016 + this.ownerFullName, + this.ownerId, + this.databaseAccountId, + this.quorumAckedLSN, + this.requestValidationFailure, + this.subStatus, + this.collectionUpdateProgress, + this.currentWriteQuorum, + this.currentReplicaSetSize, + this.collectionLazyIndexProgress, + this.partitionKeyRangeId, + null, // 0x0022 + null, // 0x0023 + null, // 0x0024 + this.logResults, + this.xPRole, + this.isRUPerMinuteUsed, + this.queryMetrics, + this.globalCommittedLSN, + null, // 0x002A + null, // 0x002B + null, // 0x002C + null, // 0x002D + null, // 0x002E + null, // 0x002F + this.numberOfReadRegions, + this.offerReplacePending, + this.itemLSN, + this.restoreState, + this.collectionSecurityIdentifier, + this.transportRequestID, + this.shareThroughput, + null, // 0x0037 + this.disableRntbdChannel, + this.serverDateTimeUtc, + this.localLSN, + this.quorumAckedLocalLSN, + this.itemLocalLSN, + this.hasTentativeWrites, + this.sessionToken, + this.replicatorLSNToGLSNDelta, + this.replicatorLSNToLLSNDelta, + this.vectorClockLocalProgress, + this.minimumRUsForOffer, + this.xPConfigurationSessionsCount, + this.indexUtilization, + this.queryExecutionInfo, + this.unflushedMergeLogEntryCount, + this.resourceName, + this.timeToLiveInSeconds, + this.replicaStatusRevoked, + null, // 0x004A + null, // 0x004B + null, // 0x004C + null, // 0x004D + null, // 0x004E + null, // 0x004F + this.softMaxAllowedThroughput, + this.backendRequestDurationMilliseconds, + this.correlatedActivityId, + this.confirmedStoreChecksum, + this.tentativeStoreChecksum, + this.pendingPKDelete, + this.aadAppliedRoleAssignmentId, + this.collectionUniqueIndexReIndexProgress, + this.collectionUniqueKeysUnderReIndex, + this.analyticalMigrationProgress, + this.totalAccountThroughput, + this.bYOKEncryptionProgress, + this.appliedPolicyElementId, + this.mergeProgressBlocked, + this.changeFeedInfo, + this.reindexerProgress, + this.offerReplacePendingForMerge, + this.maxContentLength, + this.oldestActiveSchemaId, + this.physicalPartitionId + }; + } } // diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdStreamReader.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdStreamReader.cs index 7be205cda1..f96f01b3c7 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdStreamReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdStreamReader.cs @@ -80,12 +80,12 @@ private async ValueTask PopulateBytesAndReadAsync(byte[] payload, int offse // if the count requested is bigger than the buffer just read directly into the target payload. if (count >= this.buffer.Length) { - return await this.ReadStreamAsync(payload, offset, count); + return await this.stream.ReadAsync(payload, offset, count); } else { this.offset = 0; - this.length = await this.ReadStreamAsync(this.buffer, offset: 0, this.buffer.Length); + this.length = await this.stream.ReadAsync(this.buffer, offset: 0, this.buffer.Length); if (this.length == 0) { // graceful closure. @@ -100,7 +100,7 @@ private async ValueTask PopulateBytesAndReadAsync(MemoryStream payload, int { Debug.Assert(this.length == 0); this.offset = 0; - this.length = await this.ReadStreamAsync(this.buffer, offset: 0, this.buffer.Length); + this.length = await this.stream.ReadAsync(this.buffer, offset: 0, this.buffer.Length); if (this.length == 0) { // graceful closure. @@ -167,23 +167,5 @@ private int CopyFromAvailableBytes(MemoryStream payload, int count) throw new IOException("Error copying buffered bytes", e); } } - - /// - /// Helper, used to ensure we always issue a zero-byte read before a real one. - /// - /// We do this because, as of .NET 6, all built-in streams will avoid pinning - /// memory for long periods of time if we follow this pattern. - /// - /// See: https://github.com/dotnet/runtime/issues/76029 - /// For the precipitating issue. - /// - private async Task ReadStreamAsync(byte[] buffer, int offset, int count) - { - // this should not complete until we have data to read - await this.stream.ReadAsync(Array.Empty(), 0, 0); - - // this should complete almost immediately - return await this.stream.ReadAsync(buffer, offset, count); - } } } diff --git a/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs b/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs index 0511fd83ca..df5af05604 100644 --- a/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs +++ b/Microsoft.Azure.Cosmos/src/direct/RntbdTokenStream.cs @@ -165,7 +165,8 @@ public void ParseFrom(ref BytesDeserializer reader) RntbdTokenTypes type = (RntbdTokenTypes)reader.ReadByte(); RntbdToken token; - if (this.tokens[identifier] != null) + if (identifier < this.tokens.Length + && this.tokens[identifier] != null) { token = this.tokens[identifier]; } diff --git a/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs b/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs index f5cd68a0ac..a178abb10f 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SDKSupportedCapabilities.cs @@ -10,6 +10,5 @@ internal enum SDKSupportedCapabilities : ulong { None = 0, PartitionMerge = 1 << 0, - ChangeFeedWithStartTimePostMerge = 1 << 1 } } diff --git a/Microsoft.Azure.Cosmos/src/direct/SnapshotContent.cs b/Microsoft.Azure.Cosmos/src/direct/SnapshotContent.cs index e019a29ba8..e79a9978d7 100644 --- a/Microsoft.Azure.Cosmos/src/direct/SnapshotContent.cs +++ b/Microsoft.Azure.Cosmos/src/direct/SnapshotContent.cs @@ -329,19 +329,6 @@ internal set } } - [JsonProperty(PropertyName = Constants.SnapshotProperties.IsMasterResourcesDeletionPending)] - public bool? IsMasterResourcesDeletionPending - { - get - { - return base.GetValue(Constants.SnapshotProperties.IsMasterResourcesDeletionPending, null); - } - internal set - { - base.SetValue(Constants.SnapshotProperties.IsMasterResourcesDeletionPending, value); - } - } - /// /// Gets the list of PartitionKeyRanges. /// diff --git a/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs b/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs index 85d541664f..3fa2250dda 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StatusCodes.cs @@ -97,16 +97,11 @@ internal enum SubStatusCodes ConfigurationNameAlreadyExists = 3207, PartitionkeyHashCollisionForId = 3302, - // 409: Partition migration Count mismatch conflict sub status codes - PartitionMigrationDocumentCountMismatchBetweenSourceAndTargetPartition = 3050, - PartitionMigrationDocumentCountMismatchBetweenTargetPartitionReplicas = 3051, - // 503: Service Unavailable due to region being out of capacity for bindable partitions InsufficientBindablePartitions = 1007, ComputeFederationNotFound = 1012, OperationPaused = 9001, ServiceIsOffline = 9002, - InsufficientCapacity = 9003, //412: PreCondition Failed SplitIsDisabled = 2001, @@ -124,7 +119,6 @@ internal enum SubStatusCodes OfferValidationFailed = 2017, CanNotAquireMasterPartitionAccessLock = 2018, CanNotAcquireInAccountRestoreInProgressLock = 2019, - CollectionStateChanged = 2020, //412: PreConditionFailed migration substatus codes PartitionMigrationCancelledForPendingUserOperation = 2006, @@ -139,14 +133,15 @@ internal enum SubStatusCodes PartitionMigrationFailedToResolvePartitionInformation = 2026, PartitionMigrationTopologyHasWriteRegionEmpty = 2027, PartitionMigrationIsDisableOnTheGlobalDatabaseAccount = 2028, - PartitionMigrationIsDisableOnTheRunnerAccount = 2029, - PartitionMigrationCanNotProceedForInactiveRegionalDatabaseAccount = 2030, + + // 500: InternalServerError migration sub status codes + PartitionMigrationDocumentCountMismatchBetweenSourceAndTargetPartition = 3050, + PartitionMigrationDocumentCountMismatchBetweenTargetPartitionReplicas = 3051, // 500: InternalServerError ConfigurationNameNotEmpty = 3001, ConfigurationOperationCancelled = 3002, InvalidAccountConfiguration = 3003, - FederationDoesnotExistOrIsLocked = 3004, // 429: Request Rate Too Large PrepareTimeLimitExceeded = 3207, @@ -171,8 +166,7 @@ internal enum SubStatusCodes InvalidKeyVaultKeyAndCertURI = 4011, // Indicate the Key Vault Key and Cert URI is invalid. CustomerKeyRotated = 4012, // Indicates the rewrapped key doesn't match with existing key. MissingRequestParameter = 4013, // Indicates that the incoming request has missing parameters. - InvalidKeyVaultSecretURI = 4014, // Indicates the Key Vault secret URI is invalid. - UndefinedDefaultIdentity = 4015, // Indicates that the account has an undefined default identity. + InvalidKeyVaultSecretURI = 4014, // Indicate the Key Vault secret URI is invalid. // Keep in sync with Microsoft.Azure.Cosmos.ServiceFramework.Security.AadAuthentication.AadSubStatusCodes // 401 : Unauthorized Exception (User-side errors start with 50) @@ -217,6 +211,7 @@ internal enum SubStatusCodes NspNotInitiated = 5312, NspOperationNotSupported = 5313, + // 200 OK. List feed throttled response. ListResourceFeedThrottled = 5500, diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs b/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs index a6fcc8727f..0466f4493c 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreClientFactory.cs @@ -49,7 +49,8 @@ public StoreClientFactory( int rntbdMaxConcurrentOpeningConnectionCount = ushort.MaxValue, // Optional for Rntbd MemoryStreamPool memoryStreamPool = null, RemoteCertificateValidationCallback remoteCertificateValidationCallback = null, - Func> dnsResolutionFunction = null) // optional override + Func> dnsResolutionFunction = null, // optional override + bool isDistributedTracingEnabled = false) // Distributed Tracing Flag { // <=0 means idle timeout is disabled. // valid value: >= 10 minutes @@ -220,7 +221,8 @@ public StoreClientFactory( MaxConcurrentOpeningConnectionCount = rntbdMaxConcurrentOpeningConnectionCount, MemoryStreamPool = memoryStreamPool, RemoteCertificateValidationCallback = remoteCertificateValidationCallback, - DnsResolutionFunction = dnsResolutionFunction + DnsResolutionFunction = dnsResolutionFunction, + IsDistributedTracingEnabled = isDistributedTracingEnabled }); this.fallbackTransportClient = new Rntbd.TransportClient( @@ -246,7 +248,8 @@ public StoreClientFactory( MaxConcurrentOpeningConnectionCount = rntbdMaxConcurrentOpeningConnectionCount, MemoryStreamPool = memoryStreamPool, RemoteCertificateValidationCallback = remoteCertificateValidationCallback, - DnsResolutionFunction = dnsResolutionFunction + DnsResolutionFunction = dnsResolutionFunction, + IsDistributedTracingEnabled = isDistributedTracingEnabled }); } else diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs b/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs index 27060d0dcb..ed7d427b3a 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreReader.cs @@ -181,6 +181,14 @@ private async Task ReadMultipleReplicasInternalAsync(Document includePrimary, entity.RequestContext.ForceRefreshAddressCache); + if (!string.IsNullOrEmpty(requestedCollectionRid) && !string.IsNullOrEmpty(entity.RequestContext.ResolvedCollectionRid)) + { + if (!requestedCollectionRid.Equals(entity.RequestContext.ResolvedCollectionRid)) + { + this.sessionContainer.ClearTokenByResourceId(requestedCollectionRid); + } + } + ISessionToken requestSessionToken = null; if (useSessionToken) { diff --git a/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs b/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs index 36122f41c7..6023fb724c 100644 --- a/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs +++ b/Microsoft.Azure.Cosmos/src/direct/StoreResponseNameValueCollection.cs @@ -11,7 +11,6 @@ namespace Microsoft.Azure.Documents.Collections using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; - using System.Threading; using Microsoft.Azure.Documents; /// @@ -23,9 +22,7 @@ namespace Microsoft.Azure.Documents.Collections internal class StoreResponseNameValueCollection : INameValueCollection, IEnumerable> { private static readonly StringComparer DefaultStringComparer = StringComparer.OrdinalIgnoreCase; - - // this is null if it's never been added to, and is created in a thread safe manner via GetOrCreateLazyHeaders() - private Dictionary lazyNotCommonHeaders; + private readonly Lazy> lazyNotCommonHeaders; // The INameValueCollection interface is expected to be a replacement for NameValueCollection across the projects. // However, there are a few public API with NameValueCollection as return type, e.g. DocumentServiceResponse.ResponseHeaders and @@ -45,7 +42,6 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string AppliedPolicyElementId { get; set; } public string BackendRequestDurationMilliseconds { get; set; } public string ByokEncryptionProgress { get; set; } - public string CapacityType { get; set; } public string ChangeFeedInfo { get; set; } public string CollectionIndexTransformationProgress { get; set; } public string CollectionLazyIndexingProgress { get; set; } @@ -67,8 +63,6 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string HasTentativeWrites { get; set; } public string IndexingDirective { get; set; } public string IndexUtilization { get; set; } - public string InstantScaleUpValue { get; set; } - public string IsOfferRestorePending { get; set; } public string IsRUPerMinuteUsed { get; set; } public string ItemCount { get; set; } public string ItemLocalLSN { get; set; } @@ -80,7 +74,6 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string MaxContentLength { get; set; } public string MaxResourceQuota { get; set; } public string MergeProgressBlocked { get; set; } - public string MinGLSNForDocumentOperations { get; set; } public string MinimumRUsForOffer { get; set; } public string NumberOfReadRegions { get; set; } public string OfferReplacePending { get; set; } @@ -101,7 +94,6 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string ReplicatorLSNToLLSNDelta { get; set; } public string RequestCharge { get; set; } public string RequestValidationFailure { get; set; } - public string RequiresDistribution { get; set; } public string ResourceId { get; set; } public string RestoreState { get; set; } public string RetryAfterInMilliseconds { get; set; } @@ -122,12 +114,13 @@ internal class StoreResponseNameValueCollection : INameValueCollection, IEnumera public string XPRole { get; set; } public StoreResponseNameValueCollection() + : this(new Lazy>(() => new Dictionary(StoreResponseNameValueCollection.DefaultStringComparer))) { } - private StoreResponseNameValueCollection(Dictionary lazyNotCommonHeaders) + private StoreResponseNameValueCollection(Lazy> notCommonHeaders) { - this.lazyNotCommonHeaders = lazyNotCommonHeaders; + this.lazyNotCommonHeaders = notCommonHeaders ?? throw new ArgumentNullException(nameof(notCommonHeaders)); } public string this[string key] @@ -156,9 +149,9 @@ public string[] AllKeys() public void Clear() { - if (this.lazyNotCommonHeaders != null) + if (this.lazyNotCommonHeaders.IsValueCreated) { - this.lazyNotCommonHeaders.Clear(); + this.lazyNotCommonHeaders.Value.Clear(); } this.AadAppliedRoleAssignmentId = null; @@ -167,7 +160,6 @@ public void Clear() this.AppliedPolicyElementId = null; this.BackendRequestDurationMilliseconds = null; this.ByokEncryptionProgress = null; - this.CapacityType = null; this.ChangeFeedInfo = null; this.CollectionIndexTransformationProgress = null; this.CollectionLazyIndexingProgress = null; @@ -189,8 +181,6 @@ public void Clear() this.HasTentativeWrites = null; this.IndexingDirective = null; this.IndexUtilization = null; - this.InstantScaleUpValue = null; - this.IsOfferRestorePending = null; this.IsRUPerMinuteUsed = null; this.ItemCount = null; this.ItemLocalLSN = null; @@ -202,7 +192,6 @@ public void Clear() this.MaxContentLength = null; this.MaxResourceQuota = null; this.MergeProgressBlocked = null; - this.MinGLSNForDocumentOperations = null; this.MinimumRUsForOffer = null; this.NumberOfReadRegions = null; this.OfferReplacePending = null; @@ -223,7 +212,6 @@ public void Clear() this.ReplicatorLSNToLLSNDelta = null; this.RequestCharge = null; this.RequestValidationFailure = null; - this.RequiresDistribution = null; this.ResourceId = null; this.RestoreState = null; this.RetryAfterInMilliseconds = null; @@ -247,10 +235,13 @@ public void Clear() public INameValueCollection Clone() { - Dictionary cloneNotCommonHeaders = null; - if (this.lazyNotCommonHeaders != null) + Lazy> cloneNotCommonHeaders = new Lazy>(() => new Dictionary(StoreResponseNameValueCollection.DefaultStringComparer)); + if (this.lazyNotCommonHeaders.IsValueCreated) { - cloneNotCommonHeaders = new Dictionary(this.lazyNotCommonHeaders, StoreResponseNameValueCollection.DefaultStringComparer); + foreach (KeyValuePair notCommonHeader in this.lazyNotCommonHeaders.Value) + { + cloneNotCommonHeaders.Value[notCommonHeader.Key] = notCommonHeader.Value; + } } StoreResponseNameValueCollection cloneHeaders = new StoreResponseNameValueCollection(cloneNotCommonHeaders) @@ -261,7 +252,6 @@ public INameValueCollection Clone() AppliedPolicyElementId = this.AppliedPolicyElementId, BackendRequestDurationMilliseconds = this.BackendRequestDurationMilliseconds, ByokEncryptionProgress = this.ByokEncryptionProgress, - CapacityType = this.CapacityType, ChangeFeedInfo = this.ChangeFeedInfo, CollectionIndexTransformationProgress = this.CollectionIndexTransformationProgress, CollectionLazyIndexingProgress = this.CollectionLazyIndexingProgress, @@ -283,8 +273,6 @@ public INameValueCollection Clone() HasTentativeWrites = this.HasTentativeWrites, IndexingDirective = this.IndexingDirective, IndexUtilization = this.IndexUtilization, - InstantScaleUpValue = this.InstantScaleUpValue, - IsOfferRestorePending = this.IsOfferRestorePending, IsRUPerMinuteUsed = this.IsRUPerMinuteUsed, ItemCount = this.ItemCount, ItemLocalLSN = this.ItemLocalLSN, @@ -296,7 +284,6 @@ public INameValueCollection Clone() MaxContentLength = this.MaxContentLength, MaxResourceQuota = this.MaxResourceQuota, MergeProgressBlocked = this.MergeProgressBlocked, - MinGLSNForDocumentOperations = this.MinGLSNForDocumentOperations, MinimumRUsForOffer = this.MinimumRUsForOffer, NumberOfReadRegions = this.NumberOfReadRegions, OfferReplacePending = this.OfferReplacePending, @@ -317,7 +304,6 @@ public INameValueCollection Clone() ReplicatorLSNToLLSNDelta = this.ReplicatorLSNToLLSNDelta, RequestCharge = this.RequestCharge, RequestValidationFailure = this.RequestValidationFailure, - RequiresDistribution = this.RequiresDistribution, ResourceId = this.ResourceId, RestoreState = this.RestoreState, RetryAfterInMilliseconds = this.RetryAfterInMilliseconds, @@ -657,30 +643,10 @@ IEnumerator> IEnumerable(HttpConstants.HttpHeaders.MaxContentLength, this.MaxContentLength); } - if (this.IsOfferRestorePending != null) - { - yield return new KeyValuePair(HttpConstants.HttpHeaders.IsOfferRestorePending, this.IsOfferRestorePending); - } - if (this.InstantScaleUpValue != null) - { - yield return new KeyValuePair(HttpConstants.HttpHeaders.InstantScaleUpValue, this.InstantScaleUpValue); - } - if (this.RequiresDistribution != null) - { - yield return new KeyValuePair(WFConstants.BackendHeaders.RequiresDistribution, this.RequiresDistribution); - } - if (this.CapacityType != null) - { - yield return new KeyValuePair(HttpConstants.HttpHeaders.CapacityType, this.CapacityType); - } - if (this.MinGLSNForDocumentOperations != null) - { - yield return new KeyValuePair(WFConstants.BackendHeaders.MinGLSNForDocumentOperations, this.MinGLSNForDocumentOperations); - } - if (this.lazyNotCommonHeaders != null) + if (this.lazyNotCommonHeaders.IsValueCreated) { - foreach (KeyValuePair kvp in this.lazyNotCommonHeaders) + foreach (KeyValuePair kvp in this.lazyNotCommonHeaders.Value) { yield return kvp; } @@ -1004,30 +970,10 @@ public IEnumerable Keys() { yield return HttpConstants.HttpHeaders.MaxContentLength; } - if (this.IsOfferRestorePending != null) - { - yield return HttpConstants.HttpHeaders.IsOfferRestorePending; - } - if (this.InstantScaleUpValue != null) - { - yield return HttpConstants.HttpHeaders.InstantScaleUpValue; - } - if (this.RequiresDistribution != null) - { - yield return WFConstants.BackendHeaders.RequiresDistribution; - } - if (this.CapacityType != null) - { - yield return HttpConstants.HttpHeaders.CapacityType; - } - if (this.MinGLSNForDocumentOperations != null) - { - yield return WFConstants.BackendHeaders.MinGLSNForDocumentOperations; - } - if (this.lazyNotCommonHeaders != null) + if(this.lazyNotCommonHeaders.IsValueCreated) { - foreach (string key in this.lazyNotCommonHeaders.Keys) + foreach (string key in this.lazyNotCommonHeaders.Value.Keys) { yield return key; } @@ -1350,29 +1296,9 @@ public NameValueCollection ToNameValueCollection() { this.nameValueCollection.Add(HttpConstants.HttpHeaders.MaxContentLength, this.MaxContentLength); } - if (this.IsOfferRestorePending != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.IsOfferRestorePending, this.IsOfferRestorePending); - } - if (this.InstantScaleUpValue != null) + if(this.lazyNotCommonHeaders.IsValueCreated) { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.InstantScaleUpValue, this.InstantScaleUpValue); - } - if (this.RequiresDistribution != null) - { - this.nameValueCollection.Add(WFConstants.BackendHeaders.RequiresDistribution, this.RequiresDistribution); - } - if (this.CapacityType != null) - { - this.nameValueCollection.Add(HttpConstants.HttpHeaders.CapacityType, this.CapacityType); - } - if (this.MinGLSNForDocumentOperations != null) - { - this.nameValueCollection.Add(WFConstants.BackendHeaders.MinGLSNForDocumentOperations, this.MinGLSNForDocumentOperations); - } - if(this.lazyNotCommonHeaders != null) - { - foreach (KeyValuePair keyValuePair in this.lazyNotCommonHeaders) + foreach (KeyValuePair keyValuePair in this.lazyNotCommonHeaders.Value) { this.nameValueCollection.Add(keyValuePair.Key, keyValuePair.Value); } @@ -1667,10 +1593,6 @@ public string Get(string key) { return this.TransportRequestID; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.CapacityType, key)) - { - return this.CapacityType; - } if (string.Equals(WFConstants.BackendHeaders.CurrentWriteQuorum, key, StringComparison.OrdinalIgnoreCase)) { return this.CurrentWriteQuorum; @@ -1686,11 +1608,6 @@ public string Get(string key) return this.TransportRequestID; } - if (string.Equals(HttpConstants.HttpHeaders.CapacityType, key, StringComparison.OrdinalIgnoreCase)) - { - return this.CapacityType; - } - break; case 26: if (object.ReferenceEquals(HttpConstants.HttpHeaders.LastStateChangeUtc, key)) @@ -1713,10 +1630,6 @@ public string Get(string key) { return this.MinimumRUsForOffer; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.IsOfferRestorePending, key)) - { - return this.IsOfferRestorePending; - } if (string.Equals(HttpConstants.HttpHeaders.LastStateChangeUtc, key, StringComparison.OrdinalIgnoreCase)) { return this.LastStateChangeUtc; @@ -1742,11 +1655,6 @@ public string Get(string key) return this.MinimumRUsForOffer; } - if (string.Equals(HttpConstants.HttpHeaders.IsOfferRestorePending, key, StringComparison.OrdinalIgnoreCase)) - { - return this.IsOfferRestorePending; - } - break; case 27: if (object.ReferenceEquals(WFConstants.BackendHeaders.NumberOfReadRegions, key)) @@ -1801,10 +1709,6 @@ public string Get(string key) { return this.QuorumAckedLocalLSN; } - if (object.ReferenceEquals(WFConstants.BackendHeaders.MinGLSNForDocumentOperations, key)) - { - return this.MinGLSNForDocumentOperations; - } if (string.Equals(WFConstants.BackendHeaders.CurrentReplicaSetSize, key, StringComparison.OrdinalIgnoreCase)) { return this.CurrentReplicaSetSize; @@ -1825,11 +1729,6 @@ public string Get(string key) return this.QuorumAckedLocalLSN; } - if (string.Equals(WFConstants.BackendHeaders.MinGLSNForDocumentOperations, key, StringComparison.OrdinalIgnoreCase)) - { - return this.MinGLSNForDocumentOperations; - } - break; case 30: if (object.ReferenceEquals(WFConstants.BackendHeaders.ReIndexerProgress, key)) @@ -1925,10 +1824,6 @@ public string Get(string key) { return this.HasTentativeWrites; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.InstantScaleUpValue, key)) - { - return this.InstantScaleUpValue; - } if (string.Equals(HttpConstants.HttpHeaders.LogResults, key, StringComparison.OrdinalIgnoreCase)) { return this.LogResults; @@ -1939,11 +1834,6 @@ public string Get(string key) return this.HasTentativeWrites; } - if (string.Equals(HttpConstants.HttpHeaders.InstantScaleUpValue, key, StringComparison.OrdinalIgnoreCase)) - { - return this.InstantScaleUpValue; - } - break; case 35: if (object.ReferenceEquals(WFConstants.BackendHeaders.PartitionKeyRangeId, key)) @@ -2045,10 +1935,6 @@ public string Get(string key) { return this.TentativeStoreChecksum; } - if (object.ReferenceEquals(WFConstants.BackendHeaders.RequiresDistribution, key)) - { - return this.RequiresDistribution; - } if (string.Equals(WFConstants.BackendHeaders.VectorClockLocalProgress, key, StringComparison.OrdinalIgnoreCase)) { return this.VectorClockLocalProgress; @@ -2064,11 +1950,6 @@ public string Get(string key) return this.TentativeStoreChecksum; } - if (string.Equals(WFConstants.BackendHeaders.RequiresDistribution, key, StringComparison.OrdinalIgnoreCase)) - { - return this.RequiresDistribution; - } - break; case 40: if (string.Equals(WFConstants.BackendHeaders.SoftMaxAllowedThroughput, key, StringComparison.OrdinalIgnoreCase)) @@ -2143,7 +2024,8 @@ public string Get(string key) break; } - if (this.lazyNotCommonHeaders?.TryGetValue(key, out string value) ?? false) + if (this.lazyNotCommonHeaders.IsValueCreated + && this.lazyNotCommonHeaders.Value.TryGetValue(key, out string value)) { return value; } @@ -2738,16 +2620,6 @@ public void UpdateHelper( this.TransportRequestID = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.CapacityType, key)) - { - if (throwIfAlreadyExists && this.CapacityType != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.CapacityType = value; - return; - } if (string.Equals(WFConstants.BackendHeaders.CurrentWriteQuorum, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.CurrentWriteQuorum != null) @@ -2778,16 +2650,6 @@ public void UpdateHelper( this.TransportRequestID = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.CapacityType, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.CapacityType != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.CapacityType = value; - return; - } break; case 26: if (object.ReferenceEquals(HttpConstants.HttpHeaders.LastStateChangeUtc, key)) @@ -2840,16 +2702,6 @@ public void UpdateHelper( this.MinimumRUsForOffer = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.IsOfferRestorePending, key)) - { - if (throwIfAlreadyExists && this.IsOfferRestorePending != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.IsOfferRestorePending = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.LastStateChangeUtc, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.LastStateChangeUtc != null) @@ -2900,16 +2752,6 @@ public void UpdateHelper( this.MinimumRUsForOffer = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.IsOfferRestorePending, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.IsOfferRestorePending != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.IsOfferRestorePending = value; - return; - } break; case 27: if (object.ReferenceEquals(WFConstants.BackendHeaders.NumberOfReadRegions, key)) @@ -3026,16 +2868,6 @@ public void UpdateHelper( this.QuorumAckedLocalLSN = value; return; } - if (object.ReferenceEquals(WFConstants.BackendHeaders.MinGLSNForDocumentOperations, key)) - { - if (throwIfAlreadyExists && this.MinGLSNForDocumentOperations != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.MinGLSNForDocumentOperations = value; - return; - } if (string.Equals(WFConstants.BackendHeaders.CurrentReplicaSetSize, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.CurrentReplicaSetSize != null) @@ -3076,16 +2908,6 @@ public void UpdateHelper( this.QuorumAckedLocalLSN = value; return; } - if (string.Equals(WFConstants.BackendHeaders.MinGLSNForDocumentOperations, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.MinGLSNForDocumentOperations != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.MinGLSNForDocumentOperations = value; - return; - } break; case 30: if (object.ReferenceEquals(WFConstants.BackendHeaders.ReIndexerProgress, key)) @@ -3286,16 +3108,6 @@ public void UpdateHelper( this.HasTentativeWrites = value; return; } - if (object.ReferenceEquals(HttpConstants.HttpHeaders.InstantScaleUpValue, key)) - { - if (throwIfAlreadyExists && this.InstantScaleUpValue != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.InstantScaleUpValue = value; - return; - } if (string.Equals(HttpConstants.HttpHeaders.LogResults, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.LogResults != null) @@ -3316,16 +3128,6 @@ public void UpdateHelper( this.HasTentativeWrites = value; return; } - if (string.Equals(HttpConstants.HttpHeaders.InstantScaleUpValue, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.InstantScaleUpValue != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.InstantScaleUpValue = value; - return; - } break; case 35: if (object.ReferenceEquals(WFConstants.BackendHeaders.PartitionKeyRangeId, key)) @@ -3544,16 +3346,6 @@ public void UpdateHelper( this.TentativeStoreChecksum = value; return; } - if (object.ReferenceEquals(WFConstants.BackendHeaders.RequiresDistribution, key)) - { - if (throwIfAlreadyExists && this.RequiresDistribution != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.RequiresDistribution = value; - return; - } if (string.Equals(WFConstants.BackendHeaders.VectorClockLocalProgress, key, StringComparison.OrdinalIgnoreCase)) { if (throwIfAlreadyExists && this.VectorClockLocalProgress != null) @@ -3584,16 +3376,6 @@ public void UpdateHelper( this.TentativeStoreChecksum = value; return; } - if (string.Equals(WFConstants.BackendHeaders.RequiresDistribution, key, StringComparison.OrdinalIgnoreCase)) - { - if (throwIfAlreadyExists && this.RequiresDistribution != null) - { - throw new ArgumentException($"The {key} already exists in the collection"); - } - - this.RequiresDistribution = value; - return; - } break; case 40: if (string.Equals(WFConstants.BackendHeaders.SoftMaxAllowedThroughput, key, StringComparison.OrdinalIgnoreCase)) @@ -3727,41 +3509,22 @@ public void UpdateHelper( if (throwIfAlreadyExists) { - this.GetOrCreateLazyHeaders().Add(key, value); + this.lazyNotCommonHeaders.Value.Add(key, value); } else { if (value == null) { - // don't create lazyNotCommonHeaders if it doesn't already exist - - if (this.lazyNotCommonHeaders != null) + if (this.lazyNotCommonHeaders.IsValueCreated) { - this.lazyNotCommonHeaders.Remove(key); + this.lazyNotCommonHeaders.Value.Remove(key); } } else { - this.GetOrCreateLazyHeaders()[key] = value; + this.lazyNotCommonHeaders.Value[key] = value; } } } - - private Dictionary GetOrCreateLazyHeaders() - { - Dictionary lazyHeaders = this.lazyNotCommonHeaders; - - if (lazyHeaders == null) - { - // risk over allocating, but everyone will get the same dictionary in the end - Dictionary newDict = new Dictionary(StoreResponseNameValueCollection.DefaultStringComparer); - - // Either swap newDict in (getting back the old null) or obtain the Dictionary some other thread swapped in - // (and then we drop newDict on the floor). - lazyHeaders = Interlocked.CompareExchange(ref this.lazyNotCommonHeaders, newDict, null) ?? newDict; - } - - return lazyHeaders; - } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/SupportedSerializationFormats.cs b/Microsoft.Azure.Cosmos/src/direct/SupportedSerializationFormats.cs deleted file mode 100644 index c472e29e30..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/SupportedSerializationFormats.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -using System; - -namespace Microsoft.Azure.Documents -{ - [Flags] - internal enum SupportedSerializationFormats - { - None = 0, - - /// - /// Standard JSON RFC UTF-8 text. - /// - JsonText = 1 << 0, - - /// - /// Custom binary for Cosmos DB that encodes a superset of JSON values. - /// - CosmosBinary = 1 << 1, - - /// - /// HybridRow format. - /// - HybridRow = 1 << 2, - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs b/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs deleted file mode 100644 index 1d3363cb8b..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/SystemSynchronizationScope.cs +++ /dev/null @@ -1,158 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.ServiceFramework.Core -{ - using System; - using System.Threading; - using Microsoft.Azure.Cosmos.Core.Trace; - - /// - /// Encapsulates a system mutex that can be used for inter-process synchronization of operations. - /// - internal sealed class SystemSynchronizationScope : IDisposable - { - private readonly Mutex mutex; - private readonly bool isOwned; - - /// - /// Initializes a new instance of the class. - /// - /// Name of the mutex. - /// Time to wait to acquire the mutex. - public SystemSynchronizationScope(string name, TimeSpan timeout = default) - { - if (string.IsNullOrWhiteSpace(name)) - { - throw new ArgumentException("Name should not be null or empty", nameof(name)); - } - - this.MutexName = name; - Mutex tempMutex = default; - try - { - tempMutex = new Mutex(initiallyOwned: true, this.MutexName, out bool createdNew); - if (!createdNew) - { - DefaultTrace.TraceInformation($"{this.TraceId}: Acquiring existing system mutex '{this.MutexName}'"); - try - { - timeout = timeout == default ? Timeout.InfiniteTimeSpan : timeout; - this.isOwned = tempMutex.WaitOne(timeout); - if (!this.isOwned) - { - throw new TimeoutException($"Timed out waiting for system mutex '{this.MutexName}'"); - } - - DefaultTrace.TraceInformation($"{this.TraceId}: Acquired existing system mutex '{this.MutexName}'"); - } - catch (AbandonedMutexException amEx) - { - DefaultTrace.TraceWarning($"{this.TraceId}: {nameof(AbandonedMutexException)} waiting for mutex '{this.MutexName}': {amEx}"); - this.isOwned = true; - } - } - else - { - this.isOwned = true; - DefaultTrace.TraceInformation($"{this.TraceId}: Created system mutex '{this.MutexName}'"); - } - - this.mutex = tempMutex; - tempMutex = default; - } - finally - { - this.ReleaseAndDisposeMutexSave(tempMutex); - } - } - - /// - /// Gets the name of the system mutex. - /// - public string MutexName { get; } - - private string TraceId => $"{nameof(SystemSynchronizationScope)}[{Environment.CurrentManagedThreadId}]"; - - /// - /// Creates a synchronization object based on a mutex of the given name to guarantee that the code within the scope executes synchronously - /// across processes. - /// - /// Name of the scope mutex. - /// Time to wait to acquire the mutex. - /// Object which releases the scope mutex when disposed. - public static SystemSynchronizationScope CreateSynchronizationScope(string name, TimeSpan timeout = default) - => new SystemSynchronizationScope(name, timeout); - - /// - /// Executes an operation within a system mutex synchronization scope. - /// - /// Name of the scope mutex. - /// Operation to be executed. - /// Time to wait to acquire the mutex. - /// Result of the . - /// Thrown if the is null. - public static TResult ExecuteWithSynchronization(string name, Func function, TimeSpan timeout = default) - { - if (function == null) - { - throw new ArgumentNullException(nameof(name)); - } - - using (SystemSynchronizationScope.CreateSynchronizationScope(name, timeout)) - { - return function.Invoke(); - } - } - - /// - /// Executes an operation within a system mutex synchronization scope. - /// - /// Name of the scope mutex. - /// Operation to be executed. - /// Time to wait to acquire the mutex. - /// Thrown if the is null. - public static void ExecuteWithSynchronization(string name, Action action, TimeSpan timeout = default) - { - SystemSynchronizationScope.ExecuteWithSynchronization(name, - function: () => - { - action.Invoke(); - return true; - }, - timeout); - } - - public void Dispose() - { - this.ReleaseAndDisposeMutexSave(this.mutex); - } - - private void ReleaseAndDisposeMutexSave(Mutex mutex) - { - if (mutex != null) - { - try - { - // If we already have the mutex then release it. - if (this.isOwned) - { - DefaultTrace.TraceInformation($"{this.TraceId}: Releasing system mutex '{this.MutexName}'"); - mutex.ReleaseMutex(); - } - } - catch (AbandonedMutexException amEx) - { - DefaultTrace.TraceWarning($"{this.TraceId}: {nameof(AbandonedMutexException)} waiting for mutex '{this.MutexName}': {amEx}"); - } - catch (ApplicationException appEx) - { - DefaultTrace.TraceWarning($"{this.TraceId}: Exception releasing system mutex '{this.MutexName}': {appEx}"); - } - - mutex.Dispose(); - } - } - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs new file mode 100644 index 0000000000..0dde9fc0e2 --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorder.cs @@ -0,0 +1,79 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ +#if NETSTANDARD2_0_OR_GREATER +namespace Microsoft.Azure.Documents.Telemetry +{ + using System; + using System.Globalization; + using global::Azure.Core; + using Microsoft.Azure.Cosmos.Core.Trace; + + /// + /// This class is used to add information in an Activity tags + /// + internal class OpenTelemetryRecorder : IDisposable + { + private const string CosmosDb = "cosmosdb"; + private const string DateTimeFormat = "yyyy-MM-dd'T'HH:mm:ssZZ"; + private readonly DiagnosticScope scope; + + public OpenTelemetryRecorder(DiagnosticScope scope) + { + this.scope = scope; + this.scope.Start(); + } + + public void Record(Uri addressUri, + Exception exception = null, + DocumentClientException documentClientException = null, + StoreResponse storeResponse = null) + { + try + { + this.scope.AddAttribute("rntbd.uri", addressUri); + + if (exception == null && documentClientException == null) + { + //record activity + this.scope.AddAttribute("rntbd.sub_status_code", storeResponse.SubStatusCode); + this.scope.AddAttribute("rntbd.status_code", storeResponse.StatusCode); + } + else + { + //record exception + if (exception != null) + { + this.scope.AddAttribute("exception.type", exception.GetType().FullName); + this.scope.AddAttribute("exception.timestamp", DateTimeOffset.Now.ToString(DateTimeFormat, CultureInfo.InvariantCulture)); + this.scope.AddAttribute("exception.message", exception.Message); + } + else if (documentClientException != null) + { + this.scope.AddAttribute("rntbd.status_code", documentClientException.StatusCode); + this.scope.AddAttribute("rntbd.sub_status_code", documentClientException.GetSubStatus()); + this.scope.AddAttribute("exception.type", documentClientException.GetType().FullName); + this.scope.AddAttribute("exception.timestamp", DateTimeOffset.Now.ToString(DateTimeFormat, CultureInfo.InvariantCulture)); + this.scope.AddAttribute("exception.message", documentClientException.Message); + } + } + } + catch (Exception ex) + { + DefaultTrace.TraceWarning("Error with distributed tracing {0}", ex.ToString()); + } + } + public void Dispose() + { + try + { + this.scope.Dispose(); + } + catch (Exception ex) + { + DefaultTrace.TraceWarning("Error with diagnostic scope dispose {0}", ex.ToString()); + } + } + } +} +#endif \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs new file mode 100644 index 0000000000..8cfcacb8dd --- /dev/null +++ b/Microsoft.Azure.Cosmos/src/direct/Telemetry/OpenTelemetryRecorderFactory.cs @@ -0,0 +1,60 @@ +// ------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +// ------------------------------------------------------------ +#if NETSTANDARD2_0_OR_GREATER +namespace Microsoft.Azure.Documents.Telemetry +{ + using System; + using System.Diagnostics; + using System.Threading; + using global::Azure.Core; + using Microsoft.Azure.Cosmos.Core.Trace; + using static Microsoft.Azure.Documents.RntbdConstants; + + /// + /// This class is used to generate Activities with Azure.Cosmos.Operation Source Name + /// + internal static class OpenTelemetryRecorderFactory + { + + private const string NetworkLevelPrefix = "Request"; + private const string DiagnosticNamespace = "Azure.Cosmos"; + private const string ResourceProviderNamespace = "Microsoft.DocumentDB"; + private const string traceParent = "traceparent"; + /// + /// Singleton to make sure we only have one instance of the DiagnosticScopeFactory and pattern matching of listener happens only once + /// + private static readonly Lazy LazyScopeFactory = new Lazy( + valueFactory: () => new DiagnosticScopeFactory( + clientNamespace: DiagnosticNamespace, + resourceProviderNamespace: ResourceProviderNamespace, + isActivityEnabled: true, + suppressNestedClientActivities: false), + isThreadSafe: true); + public static OpenTelemetryRecorder CreateRecorder(bool IsDistributedTracingEnabled, DocumentServiceRequest request) + { + if (IsDistributedTracingEnabled) + { + try + { + DiagnosticScope scope = LazyScopeFactory.Value.CreateScope(name: $"{NetworkLevelPrefix}.{request.OperationType}", kind: DiagnosticScope.ActivityKind.Client); + + // Record values only when we have a valid Diagnostic Scope + if (scope.IsEnabled) + { + OpenTelemetryRecorder openTelemetryRecorder = new OpenTelemetryRecorder(scope: scope); + request.Headers.Set(traceParent, Activity.Current?.Id); + return openTelemetryRecorder; + } + request.Headers.Set(traceParent, Activity.Current?.Id); + } + catch(Exception ex) + { + DefaultTrace.TraceWarning("Error with distributed tracing {0}", ex.ToString()); + } + } + return default; + } + } +} +#endif \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs b/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs index edc303ccf4..7df69fd775 100644 --- a/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs +++ b/Microsoft.Azure.Cosmos/src/direct/TransportSerialization.cs @@ -156,7 +156,6 @@ internal static SerializedRequest BuildRequest( TransportSerialization.AddPopulateQueryMetrics(requestHeaders, rntbdRequest); TransportSerialization.AddPopulateQueryMetricsIndexUtilization(requestHeaders, rntbdRequest); TransportSerialization.AddPopulateIndexMetricsText(requestHeaders, rntbdRequest); - TransportSerialization.AddOptimisticDirectExecute(requestHeaders, rntbdRequest); TransportSerialization.AddQueryForceScan(requestHeaders, rntbdRequest); TransportSerialization.AddResponseContinuationTokenLimitInKb(requestHeaders, rntbdRequest); TransportSerialization.AddPopulatePartitionStatistics(requestHeaders, rntbdRequest); @@ -181,7 +180,6 @@ internal static SerializedRequest BuildRequest( TransportSerialization.AddFanoutOperationStateHeader(requestHeaders, rntbdRequest); TransportSerialization.AddStartAndEndKeys(request, requestHeaders, rntbdRequest); TransportSerialization.AddContentSerializationFormat(requestHeaders, rntbdRequest); - TransportSerialization.AddSupportedSerializationFormats(requestHeaders, rntbdRequest); TransportSerialization.AddIsUserRequest(requestHeaders, rntbdRequest); TransportSerialization.AddPreserveFullContent(requestHeaders, rntbdRequest); TransportSerialization.AddIsRUPerGBEnforcementRequest(requestHeaders, rntbdRequest); @@ -201,13 +199,10 @@ internal static SerializedRequest BuildRequest( TransportSerialization.AddRequestedCollectionType(requestHeaders, rntbdRequest); TransportSerialization.AddIsThroughputCapRequest(requestHeaders, rntbdRequest); TransportSerialization.AddUpdateOfferStateToPending(requestHeaders, rntbdRequest); - TransportSerialization.AddUpdateOfferStateToRestorePending(requestHeaders, rntbdRequest); - TransportSerialization.AddMasterResourcesDeletionPending(requestHeaders, rntbdRequest); TransportSerialization.AddIsInternalServerlessRequest(requestHeaders, rntbdRequest); TransportSerialization.AddOfferReplaceRURedistribution(requestHeaders, rntbdRequest); TransportSerialization.AddIsMaterializedViewSourceSchemaReplaceBatchRequest(requestHeaders, rntbdRequest); TransportSerialization.AddIsCassandraAlterTypeRequest(request, rntbdRequest); - TransportSerialization.AddHighPriorityForcedBackup(requestHeaders, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.Authorization, requestHeaders.Authorization, rntbdRequest.authorizationToken, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.SessionToken, requestHeaders.SessionToken, rntbdRequest.sessionToken, rntbdRequest); @@ -288,10 +283,7 @@ internal static SerializedRequest BuildRequest( TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.ForceDatabaseAccountUpdate, requestHeaders.ForceDatabaseAccountUpdate, rntbdRequest.forceDatabaseAccountUpdate, rntbdRequest); TransportSerialization.AddPriorityLevelHeader(request, HttpConstants.HttpHeaders.PriorityLevel, requestHeaders.PriorityLevel, requestHeaders, rntbdRequest); TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.AllowRestoreParamsUpdate, requestHeaders.AllowRestoreParamsUpdate, rntbdRequest.allowRestoreParamsUpdate, rntbdRequest); - TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.PruneCollectionSchemas, requestHeaders.PruneCollectionSchemas, rntbdRequest.pruneCollectionSchemas, rntbdRequest); - TransportSerialization.FillTokenFromHeader(request, HttpConstants.HttpHeaders.IsMigratedFixedCollection, requestHeaders.IsMigratedFixedCollection, rntbdRequest.isMigratedFixedCollection, rntbdRequest); - TransportSerialization.FillTokenFromHeader(request, WFConstants.BackendHeaders.PopulateMinGLSNForDocumentOperations, requestHeaders.PopulateMinGLSNForDocumentOperations, rntbdRequest.populateMinGLSNForDocumentOperations, rntbdRequest); - + // will be null in case of direct, which is fine - BE will use the value from the connection context message. // When this is used in Gateway, the header value will be populated with the proxied HTTP request's header, and // BE will respect the per-request value. @@ -428,19 +420,128 @@ internal static byte[] BuildContextRequest(Guid activityId, UserAgentContainer u } internal static StoreResponse MakeStoreResponse( - StatusCodes status, - Guid activityId, - Stream body, - string serverVersion, - ref BytesDeserializer rntbdHeaderReader) => new() - { - Headers = HeadersTransportSerialization.BuildStoreResponseNameValueCollection( - activityId, - serverVersion, - ref rntbdHeaderReader), - ResponseBody = body, - Status = (int)status - }; + StatusCodes status, + Guid activityId, + RntbdConstants.Response response, + Stream body, + string serverVersion) + { + StoreResponseNameValueCollection responseHeaders = new StoreResponseNameValueCollection(); + StoreResponse storeResponse = new StoreResponse() + { + Headers = responseHeaders + }; + + // When adding new RntbdResponseTokens please add the constant name and constant value to the + // list at the top of the StoreResponseNameValueCollection.tt file. + // This will add the new property matching the constant name to the StoreResponseNameValueCollection which avoids the dictionary overhead + responseHeaders.LastStateChangeUtc = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.lastStateChangeDateTime); + responseHeaders.Continuation = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.continuationToken); + responseHeaders.ETag = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.eTag); + responseHeaders.RetryAfterInMilliseconds = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.retryAfterMilliseconds); + responseHeaders.MaxResourceQuota = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.storageMaxResoureQuota); + responseHeaders.CurrentResourceQuotaUsage = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.storageResourceQuotaUsage); + responseHeaders.CollectionPartitionIndex = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionPartitionIndex); + responseHeaders.CollectionServiceIndex = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionServiceIndex); + responseHeaders.LSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.lSN); + responseHeaders.ItemCount = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.itemCount); + responseHeaders.SchemaVersion = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.schemaVersion); + responseHeaders.OwnerFullName = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.ownerFullName); + responseHeaders.OwnerId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.ownerId); + responseHeaders.DatabaseAccountId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.databaseAccountId); + responseHeaders.QuorumAckedLSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.quorumAckedLSN); + responseHeaders.RequestValidationFailure = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.requestValidationFailure); + responseHeaders.SubStatus = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.subStatus); + responseHeaders.CollectionIndexTransformationProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionUpdateProgress); + responseHeaders.CurrentWriteQuorum = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.currentWriteQuorum); + responseHeaders.CurrentReplicaSetSize = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.currentReplicaSetSize); + responseHeaders.CollectionLazyIndexingProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionLazyIndexProgress); + responseHeaders.PartitionKeyRangeId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.partitionKeyRangeId); + responseHeaders.LogResults = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.logResults); + responseHeaders.XPRole = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.xPRole); + responseHeaders.IsRUPerMinuteUsed = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.isRUPerMinuteUsed); + responseHeaders.QueryMetrics = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.queryMetrics); + responseHeaders.QueryExecutionInfo = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.queryExecutionInfo); + responseHeaders.IndexUtilization = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.indexUtilization); + responseHeaders.GlobalCommittedLSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.globalCommittedLSN); + responseHeaders.NumberOfReadRegions = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.numberOfReadRegions); + responseHeaders.OfferReplacePending = TransportSerialization.GetResponseBoolHeaderIfPresent(response.offerReplacePending); + responseHeaders.ItemLSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.itemLSN); + responseHeaders.RestoreState = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.restoreState); + responseHeaders.CollectionSecurityIdentifier = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionSecurityIdentifier); + responseHeaders.TransportRequestID = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.transportRequestID); + responseHeaders.ShareThroughput = TransportSerialization.GetResponseBoolHeaderIfPresent(response.shareThroughput); + responseHeaders.DisableRntbdChannel = TransportSerialization.GetResponseBoolHeaderIfPresent(response.disableRntbdChannel); + responseHeaders.XDate = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.serverDateTimeUtc); + responseHeaders.LocalLSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.localLSN); + responseHeaders.QuorumAckedLocalLSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.quorumAckedLocalLSN); + responseHeaders.ItemLocalLSN = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.itemLocalLSN); + responseHeaders.HasTentativeWrites = TransportSerialization.GetResponseBoolHeaderIfPresent(response.hasTentativeWrites); + responseHeaders.SessionToken = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.sessionToken); + responseHeaders.ReplicatorLSNToGLSNDelta = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.replicatorLSNToGLSNDelta); + responseHeaders.ReplicatorLSNToLLSNDelta = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.replicatorLSNToLLSNDelta); + responseHeaders.VectorClockLocalProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.vectorClockLocalProgress); + responseHeaders.MinimumRUsForOffer = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.minimumRUsForOffer); + responseHeaders.XPConfigurationSessionsCount = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.xPConfigurationSessionsCount); + responseHeaders.UnflushedMergLogEntryCount = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.unflushedMergeLogEntryCount); + responseHeaders.ResourceId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.resourceName); + responseHeaders.TimeToLiveInSeconds = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.timeToLiveInSeconds); + responseHeaders.ReplicaStatusRevoked = TransportSerialization.GetResponseBoolHeaderIfPresent(response.replicaStatusRevoked); + responseHeaders.SoftMaxAllowedThroughput = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.softMaxAllowedThroughput); + responseHeaders.BackendRequestDurationMilliseconds = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.backendRequestDurationMilliseconds); + responseHeaders.CorrelatedActivityId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.correlatedActivityId); + responseHeaders.ConfirmedStoreChecksum = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.confirmedStoreChecksum); + responseHeaders.TentativeStoreChecksum = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.tentativeStoreChecksum); + responseHeaders.PendingPKDelete = TransportSerialization.GetResponseBoolHeaderIfPresent(response.pendingPKDelete); + responseHeaders.AadAppliedRoleAssignmentId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.aadAppliedRoleAssignmentId); + responseHeaders.CollectionUniqueIndexReIndexProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionUniqueIndexReIndexProgress); + responseHeaders.CollectionUniqueKeysUnderReIndex = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.collectionUniqueKeysUnderReIndex); + responseHeaders.AnalyticalMigrationProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.analyticalMigrationProgress); + responseHeaders.TotalAccountThroughput = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.totalAccountThroughput); + responseHeaders.ByokEncryptionProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.bYOKEncryptionProgress); + responseHeaders.AppliedPolicyElementId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.appliedPolicyElementId); + responseHeaders.MergeProgressBlocked = TransportSerialization.GetResponseBoolHeaderIfPresent(response.mergeProgressBlocked); + responseHeaders.ChangeFeedInfo = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.changeFeedInfo); + responseHeaders.ReIndexerProgress = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.reindexerProgress); + responseHeaders.OfferReplacePendingForMerge = TransportSerialization.GetResponseBoolHeaderIfPresent(response.offerReplacePendingForMerge); + responseHeaders.OldestActiveSchemaId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.oldestActiveSchemaId); + responseHeaders.PhysicalPartitionId = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.physicalPartitionId); + responseHeaders.MaxContentLength = TransportSerialization.GetStringFromRntbdTokenIfPresent(response.maxContentLength); + if (response.requestCharge.isPresent) + { + responseHeaders.RequestCharge = string.Format(CultureInfo.InvariantCulture, "{0:0.##}", response.requestCharge.value.valueDouble); + } + + if (response.indexingDirective.isPresent) + { + string indexingDirective; + switch (response.indexingDirective.value.valueByte) + { + case (byte) RntbdConstants.RntbdIndexingDirective.Default: + indexingDirective = IndexingDirectiveStrings.Default; + break; + case (byte) RntbdConstants.RntbdIndexingDirective.Exclude: + indexingDirective = IndexingDirectiveStrings.Exclude; + break; + case (byte) RntbdConstants.RntbdIndexingDirective.Include: + indexingDirective = IndexingDirectiveStrings.Include; + break; + default: + throw new Exception(); + } + + responseHeaders.IndexingDirective = indexingDirective; + } + + responseHeaders.ServerVersion = serverVersion; + + responseHeaders.ActivityId = activityId.ToString(); + + storeResponse.ResponseBody = body; + storeResponse.Status = (int)status; + + return storeResponse; + } internal static RntbdHeader DecodeRntbdHeader(byte[] header) { @@ -449,6 +550,47 @@ internal static RntbdHeader DecodeRntbdHeader(byte[] header) return new RntbdHeader(status, activityId); } + private static string GetStringFromRntbdTokenIfPresent(RntbdToken token) + { + if (token.isPresent) + { + switch (token.GetTokenType()) + { + case RntbdTokenTypes.Guid: + return token.value.valueGuid.ToString(); + case RntbdTokenTypes.LongLong: + return token.value.valueLongLong.ToString(CultureInfo.InvariantCulture); + case RntbdTokenTypes.Double: + return token.value.valueDouble.ToString(CultureInfo.InvariantCulture); + case RntbdTokenTypes.ULong: + return token.value.valueULong.ToString(CultureInfo.InvariantCulture); + case RntbdTokenTypes.ULongLong: + return token.value.valueULongLong.ToString(CultureInfo.InvariantCulture); + case RntbdTokenTypes.Byte: + return token.value.valueByte.ToString(CultureInfo.InvariantCulture); + case RntbdTokenTypes.String: + case RntbdTokenTypes.SmallString: + return BytesSerializer.GetStringFromBytes(token.value.valueBytes); + case RntbdTokenTypes.Long: + return token.value.valueLong.ToString(CultureInfo.InvariantCulture); + default: + throw new Exception($"Unsupported token type {token.GetTokenType()}"); + } + } + + return null; + } + + private static string GetResponseBoolHeaderIfPresent(RntbdToken token) + { + if (token.isPresent) + { + return (token.value.valueByte != 0).ToString().ToLowerInvariant(); + } + + return null; + } + private static RntbdConstants.RntbdOperationType GetRntbdOperationType(OperationType operationType) { switch (operationType) @@ -546,16 +688,10 @@ private static RntbdConstants.RntbdOperationType GetRntbdOperationType(Operation return RntbdConstants.RntbdOperationType.MetadataCheckAccess; case OperationType.CreateSystemSnapshot: return RntbdConstants.RntbdOperationType.CreateSystemSnapshot; - case OperationType.CreateRidRangeResources: - return RntbdConstants.RntbdOperationType.CreateRidRangeResources; case OperationType.UpdateFailoverPriorityList: return RntbdConstants.RntbdOperationType.UpdateFailoverPriorityList; case OperationType.GetStorageAuthToken: return RntbdConstants.RntbdOperationType.GetStorageAuthToken; - case OperationType.UpdatePartitionThroughput: - return RntbdConstants.RntbdOperationType.UpdatePartitionThroughput; - case OperationType.Truncate: - return RntbdConstants.RntbdOperationType.Truncate; #endif case OperationType.AddComputeGatewayRequestCharges: return RntbdConstants.RntbdOperationType.AddComputeGatewayRequestCharges; @@ -1367,18 +1503,6 @@ private static void AddPopulateIndexMetricsText(RequestNameValueCollection reque } } - private static void AddOptimisticDirectExecute(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) - { - if (!string.IsNullOrEmpty(requestHeaders.OptimisticDirectExecute)) - { - rntbdRequest.optimisticDirectExecute.value.valueByte = (requestHeaders.OptimisticDirectExecute. - Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) - ? (byte)0x01 - : (byte)0x00; - rntbdRequest.optimisticDirectExecute.isPresent = true; - } - } - private static void AddQueryForceScan(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) { if (!string.IsNullOrEmpty(requestHeaders.ForceQueryScan)) @@ -1991,47 +2115,6 @@ private static void AddContentSerializationFormat(RequestNameValueCollection req } } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "Roslyn Baseline 12/12/2022 16:40")] - private static void AddSupportedSerializationFormats(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) - { - if (requestHeaders.SupportedSerializationFormats != null) - { - RntbdConstants.RntbdSupportedSerializationFormats rntbdSupportedSerializationFormats = RntbdConstants.RntbdSupportedSerializationFormats.None; - - // Making empty header value check consistent with http request. If header value is empty throw exception. - if (requestHeaders.SupportedSerializationFormats.Length == 0 || !Enum.TryParse(requestHeaders.SupportedSerializationFormats, true, out SupportedSerializationFormats supportedSerializationFormats)) - { - throw new BadRequestException(String.Format(CultureInfo.CurrentUICulture, RMResources.InvalidEnumValue, - requestHeaders.SupportedSerializationFormats, nameof(SupportedSerializationFormats))); - } - - if(supportedSerializationFormats.HasFlag(SupportedSerializationFormats.JsonText)) - { - rntbdSupportedSerializationFormats |= RntbdConstants.RntbdSupportedSerializationFormats.JsonText; - } - - if(supportedSerializationFormats.HasFlag(SupportedSerializationFormats.CosmosBinary)) - { - rntbdSupportedSerializationFormats |= RntbdConstants.RntbdSupportedSerializationFormats.CosmosBinary; - } - - if (supportedSerializationFormats.HasFlag(SupportedSerializationFormats.HybridRow)) - { - rntbdSupportedSerializationFormats |= RntbdConstants.RntbdSupportedSerializationFormats.HybridRow; - } - - if((supportedSerializationFormats & - ~(SupportedSerializationFormats.JsonText | SupportedSerializationFormats.CosmosBinary | SupportedSerializationFormats.HybridRow)) != SupportedSerializationFormats.None) - { - throw new BadRequestException(String.Format(CultureInfo.CurrentUICulture, RMResources.InvalidEnumValue, - requestHeaders.SupportedSerializationFormats, nameof(SupportedSerializationFormats))); - } - - rntbdRequest.supportedSerializationFormats.value.valueByte = (byte)rntbdSupportedSerializationFormats; - rntbdRequest.supportedSerializationFormats.isPresent = true; - } - } - private static void FillTokenFromHeader(DocumentServiceRequest request, string headerName, string headerStringValue, RntbdToken token, RntbdConstants.Request rntbdRequest) { object headerValue = null; @@ -2449,30 +2532,6 @@ private static void AddUpdateOfferStateToPending(RequestNameValueCollection requ } } - private static void AddUpdateOfferStateToRestorePending(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) - { - if (!string.IsNullOrEmpty(requestHeaders.UpdateOfferStateToRestorePending)) - { - rntbdRequest.updateOfferStateToRestorePending.value.valueByte = (requestHeaders.UpdateOfferStateToRestorePending. - Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) - ? (byte)0x01 - : (byte)0x00; - rntbdRequest.updateOfferStateToRestorePending.isPresent = true; - } - } - - private static void AddMasterResourcesDeletionPending(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) - { - if (!string.IsNullOrEmpty(requestHeaders.SetMasterResourcesDeletionPending)) - { - rntbdRequest.setMasterResourcesDeletionPending.value.valueByte = (requestHeaders.SetMasterResourcesDeletionPending. - Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) - ? (byte)0x01 - : (byte)0x00; - rntbdRequest.setMasterResourcesDeletionPending.isPresent = true; - } - } - private static void AddOfferReplaceRURedistribution(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) { if(!string.IsNullOrEmpty(requestHeaders.OfferReplaceRURedistribution)) @@ -2509,18 +2568,6 @@ private static void AddIsCassandraAlterTypeRequest(DocumentServiceRequest reques } } - private static void AddHighPriorityForcedBackup(RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) - { - if (!string.IsNullOrEmpty(requestHeaders.HighPriorityForcedBackup)) - { - rntbdRequest.highPriorityForcedBackup.value.valueByte = (requestHeaders.HighPriorityForcedBackup. - Equals(bool.TrueString, StringComparison.OrdinalIgnoreCase)) - ? (byte)0x01 - : (byte)0x00; - rntbdRequest.highPriorityForcedBackup.isPresent = true; - } - } - private static void AddPriorityLevelHeader(DocumentServiceRequest request, string headerName, string headerStringValue, RequestNameValueCollection requestHeaders, RntbdConstants.Request rntbdRequest) { PriorityLevel priorityLevel = PriorityLevel.High; diff --git a/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs b/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs index ed18a83d42..e12f8eff72 100644 Binary files a/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs and b/Microsoft.Azure.Cosmos/src/direct/WFConstants.cs differ diff --git a/Microsoft.Azure.Cosmos/src/direct/rntbd2/HeadersTransportSerialization.cs b/Microsoft.Azure.Cosmos/src/direct/rntbd2/HeadersTransportSerialization.cs deleted file mode 100644 index dcc65b9642..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/rntbd2/HeadersTransportSerialization.cs +++ /dev/null @@ -1,756 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -// THIS IS AN AUTOGENERATED FILE. ALL UPDATES SHOULD BE DONE VIA HeadersTransportSerialization.tt -namespace Microsoft.Azure.Documents.Rntbd -{ - using System; - using System.Diagnostics; - using System.Globalization; -#if COSMOSCLIENT - using Microsoft.Azure.Cosmos.Rntbd; -#endif - using Microsoft.Azure.Documents.Collections; - using static Microsoft.Azure.Documents.RntbdConstants; - - /// - /// THIS IS AN AUTOGENERATED FILE. ALL UPDATES SHOULD BE DONE VIA RntbdConstants.tt - /// This allows the RntbdTokenStreams to be correctly ordered and optimized. - /// If you need to add a new RntbdToken to any of the existing types, do it on the RntbdConstants.tt file - /// - internal static class HeadersTransportSerialization - { - public static StoreResponseNameValueCollection BuildStoreResponseNameValueCollection( - Guid activityId, - string serverVersion, - ref BytesDeserializer rntbdHeaderReader) - { - StoreResponseNameValueCollection responseHeaders = new() - { - ActivityId = activityId.ToString(), - ServerVersion = serverVersion - }; - - while(rntbdHeaderReader.Position < rntbdHeaderReader.Length) - { - ResponseIdentifiers identifier = (ResponseIdentifiers)rntbdHeaderReader.ReadUInt16(); - switch (identifier) - { - case ResponseIdentifiers.TransportRequestID: - { - responseHeaders.TransportRequestID = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ServerDateTimeUtc: - { - responseHeaders.XDate = HeadersTransportSerialization.ReadSmallStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.SubStatus: - { - responseHeaders.SubStatus = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ETag: - { - responseHeaders.ETag = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ResourceName: - { - responseHeaders.ResourceId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.RequestCharge: - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Double); - double value = rntbdHeaderReader.ReadDouble(); - responseHeaders.RequestCharge = string.Format(CultureInfo.InvariantCulture, "{0:0.##}", value); - break; - } - - case ResponseIdentifiers.SessionToken: - { - responseHeaders.SessionToken = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ContinuationToken: - { - responseHeaders.Continuation = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.LSN: - { - responseHeaders.LSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.GlobalCommittedLSN: - { - responseHeaders.GlobalCommittedLSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ItemLSN: - { - responseHeaders.ItemLSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.LocalLSN: - { - responseHeaders.LocalLSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.QuorumAckedLocalLSN: - { - responseHeaders.QuorumAckedLocalLSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ItemLocalLSN: - { - responseHeaders.ItemLocalLSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.LastStateChangeDateTime: - { - responseHeaders.LastStateChangeUtc = HeadersTransportSerialization.ReadSmallStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.RetryAfterMilliseconds: - { - responseHeaders.RetryAfterInMilliseconds = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.IndexingDirective: - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - byte value = rntbdHeaderReader.ReadByte(); - string indexingDirective = value switch - { - (byte)RntbdConstants.RntbdIndexingDirective.Default => IndexingDirectiveStrings.Default, - (byte)RntbdConstants.RntbdIndexingDirective.Exclude => IndexingDirectiveStrings.Exclude, - (byte)RntbdConstants.RntbdIndexingDirective.Include => IndexingDirectiveStrings.Include, - _ => throw new Exception(), - }; - responseHeaders.IndexingDirective = indexingDirective; - break; - } - - case ResponseIdentifiers.StorageMaxResoureQuota: - { - responseHeaders.MaxResourceQuota = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.StorageResourceQuotaUsage: - { - responseHeaders.CurrentResourceQuotaUsage = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.SchemaVersion: - { - responseHeaders.SchemaVersion = HeadersTransportSerialization.ReadSmallStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionPartitionIndex: - { - responseHeaders.CollectionPartitionIndex = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionServiceIndex: - { - responseHeaders.CollectionServiceIndex = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ItemCount: - { - responseHeaders.ItemCount = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.OwnerFullName: - { - responseHeaders.OwnerFullName = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.OwnerId: - { - responseHeaders.OwnerId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.DatabaseAccountId: - { - responseHeaders.DatabaseAccountId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.QuorumAckedLSN: - { - responseHeaders.QuorumAckedLSN = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.RequestValidationFailure: - { - responseHeaders.RequestValidationFailure = HeadersTransportSerialization.ReadIntBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionUpdateProgress: - { - responseHeaders.CollectionIndexTransformationProgress = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CurrentWriteQuorum: - { - responseHeaders.CurrentWriteQuorum = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CurrentReplicaSetSize: - { - responseHeaders.CurrentReplicaSetSize = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionLazyIndexProgress: - { - responseHeaders.CollectionLazyIndexingProgress = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.PartitionKeyRangeId: - { - responseHeaders.PartitionKeyRangeId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.LogResults: - { - responseHeaders.LogResults = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.XPRole: - { - responseHeaders.XPRole = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.IsRUPerMinuteUsed: - { - responseHeaders.IsRUPerMinuteUsed = HeadersTransportSerialization.ReadIntBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.QueryMetrics: - { - responseHeaders.QueryMetrics = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.NumberOfReadRegions: - { - responseHeaders.NumberOfReadRegions = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.OfferReplacePending: - { - responseHeaders.OfferReplacePending = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.RestoreState: - { - responseHeaders.RestoreState = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionSecurityIdentifier: - { - responseHeaders.CollectionSecurityIdentifier = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ShareThroughput: - { - responseHeaders.ShareThroughput = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.DisableRntbdChannel: - { - responseHeaders.DisableRntbdChannel = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.HasTentativeWrites: - { - responseHeaders.HasTentativeWrites = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ReplicatorLSNToGLSNDelta: - { - responseHeaders.ReplicatorLSNToGLSNDelta = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ReplicatorLSNToLLSNDelta: - { - responseHeaders.ReplicatorLSNToLLSNDelta = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.VectorClockLocalProgress: - { - responseHeaders.VectorClockLocalProgress = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.MinimumRUsForOffer: - { - responseHeaders.MinimumRUsForOffer = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.XPConfigurationSessionsCount: - { - responseHeaders.XPConfigurationSessionsCount = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.IndexUtilization: - { - responseHeaders.IndexUtilization = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.QueryExecutionInfo: - { - responseHeaders.QueryExecutionInfo = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.UnflushedMergeLogEntryCount: - { - responseHeaders.UnflushedMergLogEntryCount = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.TimeToLiveInSeconds: - { - responseHeaders.TimeToLiveInSeconds = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ReplicaStatusRevoked: - { - responseHeaders.ReplicaStatusRevoked = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.SoftMaxAllowedThroughput: - { - responseHeaders.SoftMaxAllowedThroughput = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.BackendRequestDurationMilliseconds: - { - responseHeaders.BackendRequestDurationMilliseconds = HeadersTransportSerialization.ReadDoubleHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CorrelatedActivityId: - { - responseHeaders.CorrelatedActivityId = HeadersTransportSerialization.ReadGuidHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ConfirmedStoreChecksum: - { - responseHeaders.ConfirmedStoreChecksum = HeadersTransportSerialization.ReadULongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.TentativeStoreChecksum: - { - responseHeaders.TentativeStoreChecksum = HeadersTransportSerialization.ReadULongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.PendingPKDelete: - { - responseHeaders.PendingPKDelete = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.AadAppliedRoleAssignmentId: - { - responseHeaders.AadAppliedRoleAssignmentId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionUniqueIndexReIndexProgress: - { - responseHeaders.CollectionUniqueIndexReIndexProgress = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CollectionUniqueKeysUnderReIndex: - { - responseHeaders.CollectionUniqueKeysUnderReIndex = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.AnalyticalMigrationProgress: - { - responseHeaders.AnalyticalMigrationProgress = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.TotalAccountThroughput: - { - responseHeaders.TotalAccountThroughput = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.BYOKEncryptionProgress: - { - responseHeaders.ByokEncryptionProgress = HeadersTransportSerialization.ReadIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.AppliedPolicyElementId: - { - responseHeaders.AppliedPolicyElementId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.MergeProgressBlocked: - { - responseHeaders.MergeProgressBlocked = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ChangeFeedInfo: - { - responseHeaders.ChangeFeedInfo = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.ReindexerProgress: - { - responseHeaders.ReIndexerProgress = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.OfferReplacePendingForMerge: - { - responseHeaders.OfferReplacePendingForMerge = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.MaxContentLength: - { - responseHeaders.MaxContentLength = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.OldestActiveSchemaId: - { - responseHeaders.OldestActiveSchemaId = HeadersTransportSerialization.ReadIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.PhysicalPartitionId: - { - responseHeaders.PhysicalPartitionId = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.OfferRestorePending: - { - responseHeaders.IsOfferRestorePending = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.InstantScaleUpValue: - { - responseHeaders.InstantScaleUpValue = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.RequiresDistribution: - { - responseHeaders.RequiresDistribution = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.CapacityType: - { - responseHeaders.CapacityType = HeadersTransportSerialization.ReadUShortHeader(ref rntbdHeaderReader); - break; - } - - case ResponseIdentifiers.MinGLSNForDocumentOperations: - { - responseHeaders.MinGLSNForDocumentOperations = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - break; - } - - default: - { - // We have to read all headers if those are in the middle of the payload - // For example ReadsPerformed, WritesPerformed,QueriesPerformed, IndexTermsGenerated and ScriptsExecuted - HeadersTransportSerialization.AdvanceByRntbdHeader(ref rntbdHeaderReader, identifier); - break; - } - } - } - - return responseHeaders; - } - - /// - /// Reads PayloadPresent RNTBD header to tell if payload is present. Resets the Position back on - /// if PayloadPresent was not the first header to make sure no other data is lost before the final headers processing - /// in . - /// - /// - /// TODO: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/2105986 consider initializing - /// StoreResponseNameValueCollection on the main "receive" thread and reuse headers processing. - /// - internal static bool TryParseMandatoryResponseHeaders(ref BytesDeserializer rntbdHeaderReader, out bool payloadPresent, out uint transportRequestId) - { - payloadPresent = default; - transportRequestId = default; - - bool hasPayloadPresent = false; - bool hasTransportRequestId = false; - - while((!hasPayloadPresent || !hasTransportRequestId) && rntbdHeaderReader.Position < rntbdHeaderReader.Length) - { - ResponseIdentifiers identifier = (ResponseIdentifiers)rntbdHeaderReader.ReadUInt16(); - if (identifier == ResponseIdentifiers.PayloadPresent) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - - hasPayloadPresent = true; - payloadPresent = rntbdHeaderReader.ReadByte() != 0x0; - } - else if (identifier == ResponseIdentifiers.TransportRequestID) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.ULong); - - hasTransportRequestId = true; - transportRequestId = rntbdHeaderReader.ReadUInt32(); - } - else - { - HeadersTransportSerialization.AdvanceByRntbdHeader(ref rntbdHeaderReader, identifier); - } - } - - return hasPayloadPresent && hasTransportRequestId; - } - - /// - /// Offsetting by current header. Used to skip unused RNTBD headers. - /// - private static void AdvanceByRntbdHeader(ref BytesDeserializer rntbdHeaderReader, ResponseIdentifiers identifier) - { - RntbdTokenTypes tokenType = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - switch (tokenType) - { - case RntbdTokenTypes.Byte: - { - rntbdHeaderReader.ReadByte(); - return; - } - - case RntbdTokenTypes.UShort: - { - rntbdHeaderReader.AdvancePositionByUInt16(); - return; - } - - case RntbdTokenTypes.ULong: - { - rntbdHeaderReader.AdvancePositionByUInt32(); - return; - } - - case RntbdTokenTypes.Long: - { - rntbdHeaderReader.AdvancePositionByInt32(); - return; - } - - case RntbdTokenTypes.ULongLong: - { - rntbdHeaderReader.AdvancePositionByUInt64(); - return; - } - - case RntbdTokenTypes.LongLong: - { - rntbdHeaderReader.AdvancePositionByInt64(); - return; - } - - case RntbdTokenTypes.Float: - { - rntbdHeaderReader.AdvancePositionBySingle(); - return; - } - - case RntbdTokenTypes.Double: - { - rntbdHeaderReader.AdvancePositionByDouble(); - return; - } - - case RntbdTokenTypes.Guid: - { - rntbdHeaderReader.AdvancePositionByGuid(); - return; - } - - case RntbdTokenTypes.SmallBytes: - case RntbdTokenTypes.SmallString: - { - byte length = rntbdHeaderReader.ReadByte(); - rntbdHeaderReader.AdvancePositionByBytes(length); - return; - } - case RntbdTokenTypes.Bytes: - case RntbdTokenTypes.String: - { - ushort length = rntbdHeaderReader.ReadUInt16(); - rntbdHeaderReader.AdvancePositionByBytes(length); - return; - } - case RntbdTokenTypes.ULongBytes: - case RntbdTokenTypes.ULongString: - { - uint length = rntbdHeaderReader.ReadUInt32(); - rntbdHeaderReader.AdvancePositionByBytes((int)length); - return; - } - default: - { - INameValueCollection validationFailureResponseHeader = new DictionaryNameValueCollection(); - validationFailureResponseHeader.Add(HttpConstants.HttpHeaders.RequestValidationFailure, "1"); - throw new InternalServerErrorException($"Unrecognized token type {tokenType} with identifier {identifier} found in RNTBD token stream", validationFailureResponseHeader); - } - } - } - - private static string ReadStringHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.String); - ushort length = rntbdHeaderReader.ReadUInt16(); - return BytesSerializer.GetStringFromBytes(rntbdHeaderReader.ReadBytes(length)); - } - - private static string ReadSmallStringHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.SmallString); - byte length = rntbdHeaderReader.ReadByte(); - return BytesSerializer.GetStringFromBytes(rntbdHeaderReader.ReadBytes(length)); - } - - private static string ReadDoubleHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Double); - return rntbdHeaderReader.ReadDouble().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadIntHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Long); - return rntbdHeaderReader.ReadInt32().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadLongHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.LongLong); - return rntbdHeaderReader.ReadInt64().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadIntBoolHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - return rntbdHeaderReader.ReadByte() != 0x0 ? "1" : "0"; - } - - private static string ReadBoolHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - return rntbdHeaderReader.ReadByte() != 0x0 ? "true" : "false"; - } - - private static string ReadGuidHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Guid); - return rntbdHeaderReader.ReadGuid().ToString(); - } - - private static string ReadUIntHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.ULong); - return rntbdHeaderReader.ReadUInt32().ToString(); - } - - private static string ReadUShortHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.UShort); - return rntbdHeaderReader.ReadUInt16().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadULongHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.ULongLong); - return rntbdHeaderReader.ReadUInt64().ToString(); - } - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/rntbd2/HeadersTransportSerialization.tt b/Microsoft.Azure.Cosmos/src/direct/rntbd2/HeadersTransportSerialization.tt deleted file mode 100644 index 63b5bb8c44..0000000000 --- a/Microsoft.Azure.Cosmos/src/direct/rntbd2/HeadersTransportSerialization.tt +++ /dev/null @@ -1,341 +0,0 @@ -<#@ template language="C#" hostspecific="true" #> -<#@ import namespace="System.Collections.Generic" #> -<#@ include file="..\Rntbd\RntbdConstantsDefinition.ttinclude"#><##> -<#@ include file="..\Rntbd\RntbdConstantsResponseTokens.ttinclude"#><##> -<#@ output extension=".cs" #> -<# -Dictionary tokenNameOverride = new Dictionary() -{ - {"LastStateChangeDateTime", "LastStateChangeUtc"}, - {"ContinuationToken", "Continuation"}, - {"RetryAfterMilliseconds", "RetryAfterInMilliseconds"}, - {"StorageMaxResoureQuota", "MaxResourceQuota"}, - {"StorageResourceQuotaUsage", "CurrentResourceQuotaUsage"}, - {"CollectionUpdateProgress", "CollectionIndexTransformationProgress"}, - {"CollectionLazyIndexProgress", "CollectionLazyIndexingProgress"}, - {"ServerDateTimeUtc", "XDate"}, - {"UnflushedMergeLogEntryCount", "UnflushedMergLogEntryCount"}, - {"ResourceName", "ResourceId"}, - {"BYOKEncryptionProgress", "ByokEncryptionProgress"}, - {"ReindexerProgress", "ReIndexerProgress"}, - {"OfferRestorePending", "IsOfferRestorePending"} -}; -#> -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -// THIS IS AN AUTOGENERATED FILE. ALL UPDATES SHOULD BE DONE VIA HeadersTransportSerialization.tt -namespace Microsoft.Azure.Documents.Rntbd -{ - using System; - using System.Diagnostics; - using System.Globalization; -#if COSMOSCLIENT - using Microsoft.Azure.Cosmos.Rntbd; -#endif - using Microsoft.Azure.Documents.Collections; - using static Microsoft.Azure.Documents.RntbdConstants; - - /// - /// THIS IS AN AUTOGENERATED FILE. ALL UPDATES SHOULD BE DONE VIA RntbdConstants.tt - /// This allows the RntbdTokenStreams to be correctly ordered and optimized. - /// If you need to add a new RntbdToken to any of the existing types, do it on the RntbdConstants.tt file - /// - internal static class HeadersTransportSerialization - { - public static StoreResponseNameValueCollection BuildStoreResponseNameValueCollection( - Guid activityId, - string serverVersion, - ref BytesDeserializer rntbdHeaderReader) - { - StoreResponseNameValueCollection responseHeaders = new() - { - ActivityId = activityId.ToString(), - ServerVersion = serverVersion - }; - - while(rntbdHeaderReader.Position < rntbdHeaderReader.Length) - { - ResponseIdentifiers identifier = (ResponseIdentifiers)rntbdHeaderReader.ReadUInt16(); - switch (identifier) - { -<# foreach(RntbdTokenDefinition token in responseTokens) { #> -<# if (token.Name == "PayloadPresent") continue; #> -<# string responseHeadersFieldName = tokenNameOverride.ContainsKey(token.Name) ? tokenNameOverride[token.Name] : token.Name; #> - case ResponseIdentifiers.<#= token.Name #>: - { - <# if (token.Name == "RequestCharge") {#> - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Double); - double value = rntbdHeaderReader.ReadDouble(); - responseHeaders.RequestCharge = string.Format(CultureInfo.InvariantCulture, "{0:0.##}", value); - <#} else if (token.Name == "IndexingDirective") {#> - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - byte value = rntbdHeaderReader.ReadByte(); - string indexingDirective = value switch - { - (byte)RntbdConstants.RntbdIndexingDirective.Default => IndexingDirectiveStrings.Default, - (byte)RntbdConstants.RntbdIndexingDirective.Exclude => IndexingDirectiveStrings.Exclude, - (byte)RntbdConstants.RntbdIndexingDirective.Include => IndexingDirectiveStrings.Include, - _ => throw new Exception(), - }; - responseHeaders.IndexingDirective = indexingDirective; - <#} else if (token.TokenType == "RntbdTokenTypes.UShort") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadUShortHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.ULong") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadUIntHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.ULongLong") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadULongHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.Long") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadIntHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.LongLong") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadLongHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.Double") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadDoubleHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.Guid") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadGuidHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.String") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadStringHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.SmallString") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadSmallStringHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.Byte" && (token.Name == "RequestValidationFailure" || token.Name == "IsRUPerMinuteUsed")) {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadIntBoolHeader(ref rntbdHeaderReader); - <#} else if (token.TokenType == "RntbdTokenTypes.Byte") {#> - responseHeaders.<#= responseHeadersFieldName #> = HeadersTransportSerialization.ReadBoolHeader(ref rntbdHeaderReader); - <#} else { throw new Exception("Unsupported TokenTypr for response header"); } #> - break; - } - -<# } #> - default: - { - // We have to read all headers if those are in the middle of the payload - // For example ReadsPerformed, WritesPerformed,QueriesPerformed, IndexTermsGenerated and ScriptsExecuted - HeadersTransportSerialization.AdvanceByRntbdHeader(ref rntbdHeaderReader, identifier); - break; - } - } - } - - return responseHeaders; - } - - /// - /// Reads PayloadPresent RNTBD header to tell if payload is present. Resets the Position back on - /// if PayloadPresent was not the first header to make sure no other data is lost before the final headers processing - /// in . - /// - /// - /// TODO: https://msdata.visualstudio.com/CosmosDB/_workitems/edit/2105986 consider initializing - /// StoreResponseNameValueCollection on the main "receive" thread and reuse headers processing. - /// - internal static bool TryParseMandatoryResponseHeaders(ref BytesDeserializer rntbdHeaderReader, out bool payloadPresent, out uint transportRequestId) - { - payloadPresent = default; - transportRequestId = default; - - bool hasPayloadPresent = false; - bool hasTransportRequestId = false; - - while((!hasPayloadPresent || !hasTransportRequestId) && rntbdHeaderReader.Position < rntbdHeaderReader.Length) - { - ResponseIdentifiers identifier = (ResponseIdentifiers)rntbdHeaderReader.ReadUInt16(); - if (identifier == ResponseIdentifiers.PayloadPresent) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - - hasPayloadPresent = true; - payloadPresent = rntbdHeaderReader.ReadByte() != 0x0; - } - else if (identifier == ResponseIdentifiers.TransportRequestID) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.ULong); - - hasTransportRequestId = true; - transportRequestId = rntbdHeaderReader.ReadUInt32(); - } - else - { - HeadersTransportSerialization.AdvanceByRntbdHeader(ref rntbdHeaderReader, identifier); - } - } - - return hasPayloadPresent && hasTransportRequestId; - } - - /// - /// Offsetting by current header. Used to skip unused RNTBD headers. - /// - private static void AdvanceByRntbdHeader(ref BytesDeserializer rntbdHeaderReader, ResponseIdentifiers identifier) - { - RntbdTokenTypes tokenType = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - switch (tokenType) - { - case RntbdTokenTypes.Byte: - { - rntbdHeaderReader.ReadByte(); - return; - } - - case RntbdTokenTypes.UShort: - { - rntbdHeaderReader.AdvancePositionByUInt16(); - return; - } - - case RntbdTokenTypes.ULong: - { - rntbdHeaderReader.AdvancePositionByUInt32(); - return; - } - - case RntbdTokenTypes.Long: - { - rntbdHeaderReader.AdvancePositionByInt32(); - return; - } - - case RntbdTokenTypes.ULongLong: - { - rntbdHeaderReader.AdvancePositionByUInt64(); - return; - } - - case RntbdTokenTypes.LongLong: - { - rntbdHeaderReader.AdvancePositionByInt64(); - return; - } - - case RntbdTokenTypes.Float: - { - rntbdHeaderReader.AdvancePositionBySingle(); - return; - } - - case RntbdTokenTypes.Double: - { - rntbdHeaderReader.AdvancePositionByDouble(); - return; - } - - case RntbdTokenTypes.Guid: - { - rntbdHeaderReader.AdvancePositionByGuid(); - return; - } - - case RntbdTokenTypes.SmallBytes: - case RntbdTokenTypes.SmallString: - { - byte length = rntbdHeaderReader.ReadByte(); - rntbdHeaderReader.AdvancePositionByBytes(length); - return; - } - case RntbdTokenTypes.Bytes: - case RntbdTokenTypes.String: - { - ushort length = rntbdHeaderReader.ReadUInt16(); - rntbdHeaderReader.AdvancePositionByBytes(length); - return; - } - case RntbdTokenTypes.ULongBytes: - case RntbdTokenTypes.ULongString: - { - uint length = rntbdHeaderReader.ReadUInt32(); - rntbdHeaderReader.AdvancePositionByBytes((int)length); - return; - } - default: - { - INameValueCollection validationFailureResponseHeader = new DictionaryNameValueCollection(); - validationFailureResponseHeader.Add(HttpConstants.HttpHeaders.RequestValidationFailure, "1"); - throw new InternalServerErrorException($"Unrecognized token type {tokenType} with identifier {identifier} found in RNTBD token stream", validationFailureResponseHeader); - } - } - } - - private static string ReadStringHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.String); - ushort length = rntbdHeaderReader.ReadUInt16(); - return BytesSerializer.GetStringFromBytes(rntbdHeaderReader.ReadBytes(length)); - } - - private static string ReadSmallStringHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.SmallString); - byte length = rntbdHeaderReader.ReadByte(); - return BytesSerializer.GetStringFromBytes(rntbdHeaderReader.ReadBytes(length)); - } - - private static string ReadDoubleHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Double); - return rntbdHeaderReader.ReadDouble().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadIntHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Long); - return rntbdHeaderReader.ReadInt32().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadLongHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.LongLong); - return rntbdHeaderReader.ReadInt64().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadIntBoolHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - return rntbdHeaderReader.ReadByte() != 0x0 ? "1" : "0"; - } - - private static string ReadBoolHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Byte); - return rntbdHeaderReader.ReadByte() != 0x0 ? "true" : "false"; - } - - private static string ReadGuidHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.Guid); - return rntbdHeaderReader.ReadGuid().ToString(); - } - - private static string ReadUIntHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.ULong); - return rntbdHeaderReader.ReadUInt32().ToString(); - } - - private static string ReadUShortHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.UShort); - return rntbdHeaderReader.ReadUInt16().ToString(CultureInfo.InvariantCulture); - } - - private static string ReadULongHeader(ref BytesDeserializer rntbdHeaderReader) - { - RntbdTokenTypes type = (RntbdTokenTypes)rntbdHeaderReader.ReadByte(); - Debug.Assert(type == RntbdTokenTypes.ULongLong); - return rntbdHeaderReader.ReadUInt64().ToString(); - } - } -} diff --git a/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs b/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs index 1c1a315289..8f8fe203b3 100644 --- a/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs +++ b/Microsoft.Azure.Cosmos/src/direct/rntbd2/TransportClient.cs @@ -11,7 +11,9 @@ namespace Microsoft.Azure.Documents.Rntbd using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Core.Trace; - +#if NETSTANDARD2_0_OR_GREATER + using Microsoft.Azure.Documents.Telemetry; +#endif #if NETSTANDARD15 || NETSTANDARD16 using Trace = Microsoft.Azure.Documents.Trace; #endif @@ -27,11 +29,11 @@ private enum TransportResponseStatusCode } private static TransportPerformanceCounters transportPerformanceCounters = new TransportPerformanceCounters(); - private readonly TimerPool timerPool; - private readonly TimerPool idleTimerPool; + private readonly TimerPool TimerPool; + private readonly TimerPool IdleTimerPool; private readonly ChannelDictionary channelDictionary; private bool disposed = false; - + private bool isDistributedTracingEnabled; #region RNTBD Transition // Transitional state while migrating SDK users from the old RNTBD stack @@ -40,7 +42,7 @@ private enum TransportResponseStatusCode // Guarded by disableRntbdChannelLock private bool disableRntbdChannel = false; - #endregion +#endregion public TransportClient(Options clientOptions) { @@ -59,22 +61,24 @@ public TransportClient(Options clientOptions) clientOptions.PortPoolBindAttempts); } - this.timerPool = new TimerPool((int)clientOptions.TimerPoolResolution.TotalSeconds); + this.TimerPool = new TimerPool((int)clientOptions.TimerPoolResolution.TotalSeconds); if (clientOptions.IdleTimeout > TimeSpan.Zero) { - this.idleTimerPool = new TimerPool(minSupportedTimerDelayInSeconds: 30); + this.IdleTimerPool = new TimerPool(minSupportedTimerDelayInSeconds: 30); } else { - this.idleTimerPool = null; + this.IdleTimerPool = null; } + this.isDistributedTracingEnabled = clientOptions.IsDistributedTracingEnabled; + this.channelDictionary = new ChannelDictionary( new ChannelProperties( clientOptions.UserAgent, clientOptions.CertificateHostNameOverride, clientOptions.ConnectionStateListener, - this.timerPool, + this.TimerPool, clientOptions.RequestTimeout, clientOptions.OpenTimeout, clientOptions.LocalRegionOpenTimeout, @@ -87,7 +91,7 @@ public TransportClient(Options clientOptions) clientOptions.ReceiveHangDetectionTime, clientOptions.SendHangDetectionTime, clientOptions.IdleTimeout, - this.idleTimerPool, + this.IdleTimerPool, clientOptions.CallerId, clientOptions.EnableChannelMultiplexing, clientOptions.MemoryStreamPool, @@ -121,6 +125,9 @@ internal override async Task InvokeStoreAsync( string operation = "Unknown operation"; DateTime requestStartTime = DateTime.UtcNow; int transportResponseStatusCode = (int)TransportResponseStatusCode.Success; +#if NETSTANDARD2_0_OR_GREATER + using OpenTelemetryRecorder recorder = OpenTelemetryRecorderFactory.CreateRecorder(this.isDistributedTracingEnabled, request); +#endif try { TransportClient.IncrementCounters(); @@ -138,6 +145,10 @@ internal override async Task InvokeStoreAsync( resourceOperation, activityId, transportRequestStats); transportRequestStats.RecordState(TransportRequestStats.RequestStage.Completed); storeResponse.TransportRequestStats = transportRequestStats; + +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, storeResponse: storeResponse); +#endif } catch (TransportException ex) { @@ -165,6 +176,7 @@ internal override async Task InvokeStoreAsync( // TransportException directly, don't allow TransportException // to escape, and wrap it in an expected DocumentClientException // instead. Tracked in backlog item 303368. + transportRequestStats.RecordState(TransportRequestStats.RequestStage.Failed); transportResponseStatusCode = (int) ex.ErrorCode; ex.RequestStartTime = requestStartTime; @@ -182,24 +194,41 @@ internal override async Task InvokeStoreAsync( if (request.IsReadOnlyRequest) { DefaultTrace.TraceInformation("Converting to Gone (read-only request)"); - throw TransportExceptions.GetGoneException( + GoneException goneExcepetion = TransportExceptions.GetGoneException( physicalAddress.Uri, activityId, ex, transportRequestStats); +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, documentClientException: goneExcepetion); +#endif + throw goneExcepetion; } if (!ex.UserRequestSent) { DefaultTrace.TraceInformation("Converting to Gone (write request, not sent)"); - throw TransportExceptions.GetGoneException( + GoneException goneExcepetion = TransportExceptions.GetGoneException( physicalAddress.Uri, activityId, ex, transportRequestStats); +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, documentClientException: goneExcepetion); +#endif + throw goneExcepetion; } if (TransportException.IsTimeout(ex.ErrorCode)) { DefaultTrace.TraceInformation("Converting to RequestTimeout"); - throw TransportExceptions.GetRequestTimeoutException( + RequestTimeoutException requestTimeoutException = TransportExceptions.GetRequestTimeoutException( physicalAddress.Uri, activityId, ex, transportRequestStats); +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, documentClientException: requestTimeoutException); +#endif + throw requestTimeoutException; } DefaultTrace.TraceInformation("Converting to ServiceUnavailable"); - throw TransportExceptions.GetServiceUnavailableException( + ServiceUnavailableException serviceUnavailableException = TransportExceptions.GetServiceUnavailableException( physicalAddress.Uri, activityId, ex, transportRequestStats); +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, documentClientException: serviceUnavailableException); +#endif + throw serviceUnavailableException; + } catch (DocumentClientException ex) { @@ -209,6 +238,9 @@ internal override async Task InvokeStoreAsync( physicalAddress, ex); transportRequestStats.RecordState(TransportRequestStats.RequestStage.Failed); ex.TransportRequestStats = transportRequestStats; +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, documentClientException: ex); +#endif throw; } catch (Exception ex) @@ -217,6 +249,9 @@ internal override async Task InvokeStoreAsync( DefaultTrace.TraceInformation("{0} failed: RID: {1}, Resource Type: {2}, Op: {3}, Address: {4}, " + "Exception: {5}", operation, request.ResourceAddress, request.ResourceType, resourceOperation, physicalAddress, ex); +#if NETSTANDARD2_0_OR_GREATER + recorder?.Record(physicalAddress.Uri, exception: ex); +#endif throw; } finally @@ -237,12 +272,12 @@ public override void Dispose() this.disposed = true; this.channelDictionary.Dispose(); - if (this.idleTimerPool != null) + if (this.IdleTimerPool != null) { - this.idleTimerPool.Dispose(); + this.IdleTimerPool.Dispose(); } - this.timerPool.Dispose(); + this.TimerPool.Dispose(); base.Dispose(); @@ -297,7 +332,7 @@ internal override Task OpenConnectionAsync( activityId: activityId); } - #region RNTBD Transition +#region RNTBD Transition public event Action OnDisableRntbdChannel; @@ -355,7 +390,7 @@ private void RaiseProtocolDowngradeRequest(StoreResponse storeResponse) TaskScheduler.Current); } - #endregion +#endregion public sealed class Options { @@ -463,6 +498,11 @@ public TimeSpan TimerPoolResolution /// Override for DNS resolution callbacks for RNTBD connections. /// public Func> DnsResolutionFunction { get; internal set; } + + /// + /// Flag for distributed tracing + /// + public bool IsDistributedTracingEnabled { get; set; } public override string ToString() { @@ -502,6 +542,8 @@ public override string ToString() s.AppendLine(this.MemoryStreamPool != null ? bool.TrueString : bool.FalseString); s.Append(" Use_CustomDnsResolution: "); s.AppendLine(this.DnsResolutionFunction != null ? bool.TrueString : bool.FalseString); + s.Append(" IsDistributedTracingEnabled: "); + s.AppendLine(this.IsDistributedTracingEnabled.ToString()); return s.ToString(); } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs index e9fbc54267..62f20f1fe4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/BaselineTests.cs @@ -153,8 +153,8 @@ public void ExecuteTestSuite(IEnumerable inputs, [CallerMemberName] stri Please run the ..\azure-cosmos-dotnet-v3\UpdateContracts.ps1 script to update the baselines. Expected: {baselineTextSuffix}, Actual: {outputTextSuffix}, - OutputPath: {outputPath}, - BaselinePath: {baselinePath}"); + OutputPath: {Path.GetFullPath(outputPath)}, + BaselinePath: {Path.GetFullPath(baselinePath)}"); } /// diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BatchOperationsAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BatchOperationsAsync.xml index d468fe87f5..90f32b89c9 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BatchOperationsAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BatchOperationsAsync.xml @@ -129,7 +129,7 @@ } ] }]]> - Operation.ExecuteAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationExecuteAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeBatchdb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.ExecuteAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationExecuteAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeBatchdb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BulkOperationsAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BulkOperationsAsync.xml index 041523ff8a..b776a8eaae 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BulkOperationsAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.BulkOperationsAsync.xml @@ -153,16 +153,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -311,16 +311,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -469,16 +469,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -627,16 +627,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -785,16 +785,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -943,16 +943,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1101,16 +1101,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1259,16 +1259,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1417,16 +1417,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1575,16 +1575,16 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -2324,7 +2324,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ChangeFeedAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ChangeFeedAsync.xml index dccb7fe5d0..4189b4bab8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ChangeFeedAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ChangeFeedAsync.xml @@ -952,11 +952,11 @@ } ] }]]> - Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1569,11 +1569,11 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -2167,11 +2167,11 @@ } ] }]]> - Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Change Feed Iterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Change Feed Iterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Iterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -2785,11 +2785,11 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -3066,9 +3066,7 @@ } ] }]]> - Operation.Change Feed Estimator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationChange Feed Estimator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. + Operation.Change Feed Estimator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationChange Feed Estimator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.MiscellanousAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.MiscellanousAsync.xml index 832dfee446..591a6af4ac 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.MiscellanousAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.MiscellanousAsync.xml @@ -107,8 +107,8 @@ } ] }]]> - Operation.DeleteAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationDeleteAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateDatabaseAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateDatabaseAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.DeleteAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationDeleteAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateDatabaseAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateDatabaseAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -207,8 +207,8 @@ } ] }]]> - Operation.DeleteAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationDeleteAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted -Operation.CreateDatabaseAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateDatabaseAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted + Operation.DeleteAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationDeleteAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted +Operation.CreateDatabaseAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateDatabaseAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contacted LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.PointOperationsExceptionsAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.PointOperationsExceptionsAsync.xml index 200ad02660..64e7e0c3ed 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.PointOperationsExceptionsAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.PointOperationsExceptionsAsync.xml @@ -148,7 +148,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -390,7 +390,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -615,7 +615,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -872,7 +872,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1193,7 +1193,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1347,7 +1347,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectexception.stacktraceexception.typedb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.regions_contactedSouth Central USexception.messagedb.cosmosdb.operation_typeCreate ExceptionIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.QueryAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.QueryAsync.xml index 876d37dc63..d2abebc194 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.QueryAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.QueryAsync.xml @@ -574,10 +574,10 @@ } ] }]]> - Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1180,10 +1180,10 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1767,10 +1767,10 @@ } ] }]]> - Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -2374,10 +2374,10 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -3048,10 +3048,10 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -3644,10 +3644,10 @@ } ] }]]> - Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -4260,10 +4260,10 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeQuerydb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadFeedAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadFeedAsync.xml index 44a8a04a51..dc6df3eacf 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadFeedAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadFeedAsync.xml @@ -536,10 +536,10 @@ } ] }]]> - Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1104,10 +1104,10 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1653,10 +1653,10 @@ } ] }]]> - Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.FeedIterator Read Next Asynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.FeedIterator Read Next Asyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationFeedIterator Read Next Asyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -2222,10 +2222,10 @@ } ] }]]> - Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.Typed FeedIterator ReadNextAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US +Operation.Typed FeedIterator ReadNextAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationTyped FeedIterator ReadNextAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReadFeeddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadManyAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadManyAsync.xml index 9a96ef9751..29b36304ec 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadManyAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.ReadManyAsync.xml @@ -542,17 +542,7 @@ } ] }]]> - Operation.ReadManyItemsStreamAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationReadManyItemsStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US -LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. -LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. -LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. -LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. -LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. + Operation.ReadManyItemsStreamAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationReadManyItemsStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -1112,7 +1102,7 @@ } ] }]]> - Operation.ReadManyItemsAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationReadManyItemsAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.ReadManyItemsAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationReadManyItemsAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.StreamPointOperationsAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.StreamPointOperationsAsync.xml index 25a01f6b94..18f11acd62 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.StreamPointOperationsAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.StreamPointOperationsAsync.xml @@ -89,7 +89,7 @@ } ] }]]> - Operation.CreateItemStreamAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.CreateItemStreamAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -178,7 +178,7 @@ } ] }]]> - Operation.ReadItemStreamAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationReadItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.ReadItemStreamAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationReadItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -275,7 +275,7 @@ } ] }]]> - Operation.ReplaceItemStreamAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationReplaceItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReplacedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.ReplaceItemStreamAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationReplaceItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReplacedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -367,7 +367,7 @@ } ] }]]> - Operation.DeleteItemStreamAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationDeleteItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.DeleteItemStreamAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationDeleteItemStreamAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.TypedPointOperationsAsync.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.TypedPointOperationsAsync.xml index 4dfceee978..abeaa41de8 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.TypedPointOperationsAsync.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/EndToEndTraceWriterBaselineTests.TypedPointOperationsAsync.xml @@ -109,7 +109,7 @@ } ] }]]> - Operation.CreateItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.CreateItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationCreateItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeCreatedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -203,7 +203,7 @@ } ] }]]> - Operation.ReadItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationReadItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.ReadItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationReadItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReaddb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -310,7 +310,7 @@ } ] }]]> - Operation.ReplaceItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationReplaceItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReplacedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.ReplaceItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationReplaceItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeReplacedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. @@ -406,7 +406,7 @@ } ] }]]> - Operation.DeleteItemAsynckindclientaz.namespaceMicrosoft.DocumentDBdb.operationDeleteItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iddb.cosmosdb.user_agentdb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US + Operation.DeleteItemAsyncaz.namespaceMicrosoft.DocumentDBaz.schema_urldb.operationDeleteItemAsyncdb.namedb.cosmosdb.containerdb.systemcosmosdbdb.cosmosdb.machine_idnet.peer.name127.0.0.1db.cosmosdb.client_iduser_agent.originaldb.cosmosdb.connection_modeDirectdb.cosmosdb.operation_typeDeletedb.cosmosdb.request_content_length_bytesdb.cosmosdb.response_content_length_bytesdb.cosmosdb.status_codedb.cosmosdb.sub_status_codedb.cosmosdb.request_chargedb.cosmosdb.item_countdb.cosmosdb.activity_iddb.cosmosdb.correlated_activity_iddb.cosmosdb.regions_contactedSouth Central US LatencyOverThresholdIdeally, this should contain request diagnostics but request diagnostics is subject to change with each request as it contains few unique id. So just putting this tag with this static text to make sure event is getting generated for each test. diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestLambdaReuse.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestLambdaReuse.xml new file mode 100644 index 0000000000..bd2e168e76 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqGeneralBaselineTests.TestLambdaReuse.xml @@ -0,0 +1,38 @@ + + + + Where with same predicate instance]]> + + + + + + + + + Select with same predicate instance]]> + + + + + + + + + Select -> Where with same predicate instance]]> + new AnonymousType(Int = 10, Result = c)).Where(DisplayClass.predicate2)]]> + + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringFunctions.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringFunctions.xml index a9fc581461..4ccc9d34ca 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringFunctions.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestStringFunctions.xml @@ -363,6 +363,28 @@ FROM root]]> + + + + + + doc.StringField.Replace(c, a))]]> + + + + + + + + + doc.StringField.Replace("str", "str2"))]]> + + + @@ -379,34 +401,45 @@ FROM root]]> - - doc.StringField.TrimStart())]]> + + doc.StringField.Trim())]]> - - doc.StringField.Replace(c, a))]]> + + " abc ".Trim())]]> - - doc.StringField.Replace("str", "str2"))]]> + + doc.StringField.Trim(new [] {}))]]> + + + + + + " abc ".Trim(new [] {}))]]> + + + @@ -418,6 +451,83 @@ FROM root]]> + + + + + + " abc ".TrimEnd())]]> + + + + + + + + + doc.StringField.TrimEnd(new [] {}))]]> + + + + + + + + + " abc ".TrimEnd(new [] {}))]]> + + + + + + + + + doc.StringField.TrimStart())]]> + + + + + + + + + " abc ".TrimStart())]]> + + + + + + + + + doc.StringField.TrimStart(new [] {}))]]> + + + + + + + + + " abc ".TrimStart(new [] {}))]]> + + + diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestTypeCheckFunctions.xml b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestTypeCheckFunctions.xml index 90a463defa..97aac9ef55 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestTypeCheckFunctions.xml +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/BaselineTest/TestBaseline/LinqTranslationBaselineTests.TestTypeCheckFunctions.xml @@ -1,4 +1,52 @@  + + + + doc.ArrayField.IsArray())]]> + + + + + + + + + doc.StringField.IsArray())]]> + + + + + + + + + Convert(doc.BooleanField, Object).IsBool())]]> + + + + + + + + + doc.StringField.IsBool())]]> + + + + + @@ -45,6 +93,52 @@ FROM root WHERE IS_NULL(root["StringField"])]]> + + + + Convert(doc.NumericField, Object).IsNumber())]]> + + + + + + + + + doc.StringField.IsNumber())]]> + + + + + + + + + doc.ObjectField.IsObject())]]> + + + + + + + + + doc.StringField.IsObject())]]> + + + + + @@ -68,4 +162,27 @@ FROM root WHERE IS_PRIMITIVE(root["StringField"])]]> + + + + doc.StringField.IsString())]]> + + + + + + + + + Convert(doc.NumericField, Object).IsString())]]> + + + + + \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Batch/BatchSinglePartitionKeyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Batch/BatchSinglePartitionKeyTests.cs index 675ed6b20e..b2b1ffb217 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Batch/BatchSinglePartitionKeyTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Batch/BatchSinglePartitionKeyTests.cs @@ -693,7 +693,8 @@ public async Task BatchCustomSerializerUsedForPatchAsync() DateTime patchDate = new DateTime(2020, 07, 01, 01, 02, 03); List patchOperations = new List() { - PatchOperation.Add("/date", patchDate) + PatchOperation.Add("/date", patchDate), + PatchOperation.Move("/date", "/TodayDate") }; BatchCore batch = (BatchCore)new BatchCore((ContainerInlineCore)customSerializationContainer, BatchTestBase.GetPartitionKey(this.PartitionKey1)) @@ -719,7 +720,8 @@ public async Task BatchCustomSerializerUsedForPatchAsync() Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Resource); - Assert.IsTrue(dateJson.Contains(response.Resource["date"].ToString())); + Assert.IsNull(response.Resource["date"]); + Assert.IsTrue(dateJson.Contains(response.Resource["TodayDate"].ToString())); } private async Task RunCrudAsync(bool isStream, bool isSchematized, bool useEpk, Container container) diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTelemetryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTelemetryTests.cs index 08028cec69..58ce4851a0 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTelemetryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTelemetryTests.cs @@ -1,176 +1,132 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests -{ - using System; - using System.Collections.Generic; - using System.Text; - using System.Threading.Tasks; - using System.Net; - using System.Net.Http; - using System.Reflection; - using Microsoft.Azure.Cosmos.Fluent; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using Microsoft.Azure.Cosmos.Tracing; - using Microsoft.Azure.Cosmos.Telemetry; - using Microsoft.Azure.Cosmos.Handler; - using Microsoft.Azure.Documents; - using Newtonsoft.Json.Linq; - using Newtonsoft.Json; - using Documents.Rntbd; - using System.Globalization; - using System.Linq; - using Cosmos.Util; - using Microsoft.Azure.Cosmos.Telemetry.Models; - - [TestClass] - public class ClientTelemetryTests : BaseCosmosClientHelper - { - private const int scheduledInSeconds = 1; - private static readonly object jsonObject = JsonConvert.DeserializeObject("{\"compute\":{\"azEnvironment\":\"AzurePublicCloud\",\"customData\":\"\",\"isHostCompatibilityLayerVm\":\"false\",\"licenseType\":\"\",\"location\":\"eastus\",\"name\":\"sourabh-testing\",\"offer\":\"UbuntuServer\",\"osProfile\":{\"adminUsername\":\"azureuser\",\"computerName\":\"sourabh-testing\"},\"osType\":\"Linux\",\"placementGroupId\":\"\",\"plan\":{\"name\":\"\",\"product\":\"\",\"publisher\":\"\"},\"platformFaultDomain\":\"0\",\"platformUpdateDomain\":\"0\",\"provider\":\"Microsoft.Compute\",\"publicKeys\":[{\"keyData\":\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC5uCeOAm3ehmhI+2PbMoMl17Eo\r\nqfHKCycSaBJsv9qxlmBOuFheSJc1XknJleXUSsuTO016/d1PyWpevnqOZNRksWoa\r\nJvQ23sDTxcK+X2OP3QlCUeX4cMjPXqlL8z1UYzU4Bx3fFvf8fs67G3N72sxWBw5P\r\nZyuXyhBm0NCe/2NYMKgEDT4ma8XszO0ikbhoPKbMbgHAQk/ktWQHNcqYOPQKEWqp\r\nEK1R0rjS2nmtovfScP/ZGXcvOpJ1/NDBo4dh1K+OxOGM/4PSH/F448J5Zy4eAyEk\r\nscys+IpeIOTOlRUy/703SNIX0LEWlnYqbyL9c1ypcYLQqF76fKkDfzzFI/OWVlGw\r\nhj/S9uP8iMsR+fhGIbn6MAa7O4DWPWLuedSp7KDYyjY09gqNJsfuaAJN4LiC6bPy\r\nhknm0PVLK3ux7EUOt+cZrHCdIFWbdOtxiPNIl1tkv9kV5aE5Aj2gJm4MeB9uXYhS\r\nOuksboBc0wyUGrl9+XZJ1+NlZOf7IjVi86CieK8= generated-by-azure\r\n\",\"path\":\"/home/azureuser/.ssh/authorized_keys\"}],\"publisher\":\"Canonical\",\"resourceGroupName\":\"sourabh-telemetry-sdk\",\"resourceId\":\"/subscriptions/8fba6d4f-7c37-4d13-9063-fd58ad2b86e2/resourceGroups/sourabh-telemetry-sdk/providers/Microsoft.Compute/virtualMachines/sourabh-testing\",\"securityProfile\":{\"secureBootEnabled\":\"false\",\"virtualTpmEnabled\":\"false\"},\"sku\":\"18.04-LTS\",\"storageProfile\":{\"dataDisks\":[],\"imageReference\":{\"id\":\"\",\"offer\":\"UbuntuServer\",\"publisher\":\"Canonical\",\"sku\":\"18.04-LTS\",\"version\":\"latest\"},\"osDisk\":{\"caching\":\"ReadWrite\",\"createOption\":\"FromImage\",\"diffDiskSettings\":{\"option\":\"\"},\"diskSizeGB\":\"30\",\"encryptionSettings\":{\"enabled\":\"false\"},\"image\":{\"uri\":\"\"},\"managedDisk\":{\"id\":\"/subscriptions/8fba6d4f-7c37-4d13-9063-fd58ad2b86e2/resourceGroups/sourabh-telemetry-sdk/providers/Microsoft.Compute/disks/sourabh-testing_OsDisk_1_9a54abfc5ba149c6a106bd9e5b558c2a\",\"storageAccountType\":\"Premium_LRS\"},\"name\":\"sourabh-testing_OsDisk_1_9a54abfc5ba149c6a106bd9e5b558c2a\",\"osType\":\"Linux\",\"vhd\":{\"uri\":\"\"},\"writeAcceleratorEnabled\":\"false\"}},\"subscriptionId\":\"8fba6d4f-7c37-4d13-9063-fd58ad2b86e2\",\"tags\":\"azsecpack:nonprod;platformsettings.host_environment.service.platform_optedin_for_rootcerts:true\",\"tagsList\":[{\"name\":\"azsecpack\",\"value\":\"nonprod\"},{\"name\":\"platformsettings.host_environment.service.platform_optedin_for_rootcerts\",\"value\":\"true\"}],\"version\":\"18.04.202103250\",\"vmId\":\"d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd\",\"vmScaleSetName\":\"\",\"vmSize\":\"Standard_D2s_v3\",\"zone\":\"1\"},\"network\":{\"interface\":[{\"ipv4\":{\"ipAddress\":[{\"privateIpAddress\":\"10.0.7.5\",\"publicIpAddress\":\"\"}],\"subnet\":[{\"address\":\"10.0.7.0\",\"prefix\":\"24\"}]},\"ipv6\":{\"ipAddress\":[]},\"macAddress\":\"000D3A8F8BA0\"}]}}"); - - private CosmosClientBuilder cosmosClientBuilder; - private static SystemUsageMonitor systemUsageMonitor; - - private List actualInfo; - private List preferredRegionList; - - private IDictionary expectedMetricNameUnitMap; - - private HttpClientHandlerHelper httpHandler; - private HttpClientHandlerHelper httpHandlerForNonAzureInstance; - - [ClassInitialize] - public static void ClassInitialize(TestContext _) - { - SystemUsageMonitor oldSystemUsageMonitor = (SystemUsageMonitor)typeof(DiagnosticsHandlerHelper) - .GetField("systemUsageMonitor", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(DiagnosticsHandlerHelper.Instance); - oldSystemUsageMonitor.Stop(); - - ClientTelemetryTests.ResetSystemUsageMonitor(true); - } - - [TestInitialize] - public void TestInitialize() - { - Util.EnableClientTelemetryEnvironmentVariables(); - - this.actualInfo = new List(); - - this.httpHandler = new HttpClientHandlerHelper - { - RequestCallBack = (request, cancellation) => - { - if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) - { - HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); - - string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult(); - - lock (this.actualInfo) - { - this.actualInfo.Add(JsonConvert.DeserializeObject(jsonObject)); - } - - return Task.FromResult(result); - } - else if (request.RequestUri.AbsoluteUri.Equals(VmMetadataApiHandler.vmMetadataEndpointUrl.AbsoluteUri)) - { - HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); - - string payload = JsonConvert.SerializeObject(ClientTelemetryTests.jsonObject); - result.Content = new StringContent(payload, Encoding.UTF8, "application/json"); - - return Task.FromResult(result); - } - return null; - } - }; - - this.httpHandlerForNonAzureInstance = new HttpClientHandlerHelper - { - RequestCallBack = (request, cancellation) => - { - if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) - { - HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); - - string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult(); - - lock (this.actualInfo) - { - this.actualInfo.Add(JsonConvert.DeserializeObject(jsonObject)); - } - - return Task.FromResult(result); - } - return null; - } - }; - - this.preferredRegionList = new List - { - "region1", - "region2" - }; - - this.expectedMetricNameUnitMap = new Dictionary() - { - { ClientTelemetryOptions.CpuName, ClientTelemetryOptions.CpuUnit }, - { ClientTelemetryOptions.MemoryName, ClientTelemetryOptions.MemoryUnit }, - { ClientTelemetryOptions.AvailableThreadsName, ClientTelemetryOptions.AvailableThreadsUnit }, - { ClientTelemetryOptions.IsThreadStarvingName, ClientTelemetryOptions.IsThreadStarvingUnit }, - { ClientTelemetryOptions.ThreadWaitIntervalInMsName, ClientTelemetryOptions.ThreadWaitIntervalInMsUnit } - }; - - this.cosmosClientBuilder = TestCommon.GetDefaultConfiguration() - .WithApplicationPreferredRegions(this.preferredRegionList); - } - - private static void ResetSystemUsageMonitor(bool isTelemetryEnabled) - { - ClientTelemetryTests.systemUsageMonitor?.Stop(); - - FieldInfo diagnosticsHandlerHelperInstance = typeof(DiagnosticsHandlerHelper) - .GetField("isTelemetryMonitoringEnabled", BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); - diagnosticsHandlerHelperInstance.SetValue(null, isTelemetryEnabled); - - List recorders = new List() - { - (SystemUsageRecorder)typeof(DiagnosticsHandlerHelper) - .GetField("diagnosticSystemUsageRecorder", - BindingFlags.Instance | BindingFlags.NonPublic) - .GetValue(DiagnosticsHandlerHelper.Instance) - }; - - if (isTelemetryEnabled) - { - recorders.Add( - (SystemUsageRecorder)typeof(DiagnosticsHandlerHelper) - .GetField("telemetrySystemUsageRecorder", - BindingFlags.Instance | BindingFlags.NonPublic) - .GetValue(DiagnosticsHandlerHelper.Instance)); - } - - ClientTelemetryTests.systemUsageMonitor = SystemUsageMonitor.CreateAndStart(recorders); - } - - [ClassCleanup] - public static void FinalCleanup() - { - FieldInfo isInitializedField = typeof(VmMetadataApiHandler).GetField("isInitialized", - BindingFlags.Static | - BindingFlags.NonPublic); - isInitializedField.SetValue(null, false); - - FieldInfo azMetadataField = typeof(VmMetadataApiHandler).GetField("azMetadata", - BindingFlags.Static | - BindingFlags.NonPublic); - azMetadataField.SetValue(null, null); - - ClientTelemetryTests.ResetSystemUsageMonitor(false); +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests +{ + using System; + using System.Collections.Generic; + using System.Text; + using System.Threading.Tasks; + using System.Net; + using System.Net.Http; + using System.Reflection; + using Microsoft.Azure.Cosmos.Fluent; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using Microsoft.Azure.Cosmos.Tracing; + using Microsoft.Azure.Cosmos.Telemetry; + using Microsoft.Azure.Cosmos.Handler; + using Microsoft.Azure.Documents; + using Newtonsoft.Json.Linq; + using Newtonsoft.Json; + using Documents.Rntbd; + using System.Globalization; + using System.Linq; + using Cosmos.Util; + using Microsoft.Azure.Cosmos.Telemetry.Models; + + [TestClass] + public class ClientTelemetryTests : BaseCosmosClientHelper + { + private const int scheduledInSeconds = 1; + private static readonly object jsonObject = JsonConvert.DeserializeObject("{\"compute\":{\"azEnvironment\":\"AzurePublicCloud\",\"customData\":\"\",\"isHostCompatibilityLayerVm\":\"false\",\"licenseType\":\"\",\"location\":\"eastus\",\"name\":\"sourabh-testing\",\"offer\":\"UbuntuServer\",\"osProfile\":{\"adminUsername\":\"azureuser\",\"computerName\":\"sourabh-testing\"},\"osType\":\"Linux\",\"placementGroupId\":\"\",\"plan\":{\"name\":\"\",\"product\":\"\",\"publisher\":\"\"},\"platformFaultDomain\":\"0\",\"platformUpdateDomain\":\"0\",\"provider\":\"Microsoft.Compute\",\"publicKeys\":[{\"keyData\":\"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC5uCeOAm3ehmhI+2PbMoMl17Eo\r\nqfHKCycSaBJsv9qxlmBOuFheSJc1XknJleXUSsuTO016/d1PyWpevnqOZNRksWoa\r\nJvQ23sDTxcK+X2OP3QlCUeX4cMjPXqlL8z1UYzU4Bx3fFvf8fs67G3N72sxWBw5P\r\nZyuXyhBm0NCe/2NYMKgEDT4ma8XszO0ikbhoPKbMbgHAQk/ktWQHNcqYOPQKEWqp\r\nEK1R0rjS2nmtovfScP/ZGXcvOpJ1/NDBo4dh1K+OxOGM/4PSH/F448J5Zy4eAyEk\r\nscys+IpeIOTOlRUy/703SNIX0LEWlnYqbyL9c1ypcYLQqF76fKkDfzzFI/OWVlGw\r\nhj/S9uP8iMsR+fhGIbn6MAa7O4DWPWLuedSp7KDYyjY09gqNJsfuaAJN4LiC6bPy\r\nhknm0PVLK3ux7EUOt+cZrHCdIFWbdOtxiPNIl1tkv9kV5aE5Aj2gJm4MeB9uXYhS\r\nOuksboBc0wyUGrl9+XZJ1+NlZOf7IjVi86CieK8= generated-by-azure\r\n\",\"path\":\"/home/azureuser/.ssh/authorized_keys\"}],\"publisher\":\"Canonical\",\"resourceGroupName\":\"sourabh-telemetry-sdk\",\"resourceId\":\"/subscriptions/8fba6d4f-7c37-4d13-9063-fd58ad2b86e2/resourceGroups/sourabh-telemetry-sdk/providers/Microsoft.Compute/virtualMachines/sourabh-testing\",\"securityProfile\":{\"secureBootEnabled\":\"false\",\"virtualTpmEnabled\":\"false\"},\"sku\":\"18.04-LTS\",\"storageProfile\":{\"dataDisks\":[],\"imageReference\":{\"id\":\"\",\"offer\":\"UbuntuServer\",\"publisher\":\"Canonical\",\"sku\":\"18.04-LTS\",\"version\":\"latest\"},\"osDisk\":{\"caching\":\"ReadWrite\",\"createOption\":\"FromImage\",\"diffDiskSettings\":{\"option\":\"\"},\"diskSizeGB\":\"30\",\"encryptionSettings\":{\"enabled\":\"false\"},\"image\":{\"uri\":\"\"},\"managedDisk\":{\"id\":\"/subscriptions/8fba6d4f-7c37-4d13-9063-fd58ad2b86e2/resourceGroups/sourabh-telemetry-sdk/providers/Microsoft.Compute/disks/sourabh-testing_OsDisk_1_9a54abfc5ba149c6a106bd9e5b558c2a\",\"storageAccountType\":\"Premium_LRS\"},\"name\":\"sourabh-testing_OsDisk_1_9a54abfc5ba149c6a106bd9e5b558c2a\",\"osType\":\"Linux\",\"vhd\":{\"uri\":\"\"},\"writeAcceleratorEnabled\":\"false\"}},\"subscriptionId\":\"8fba6d4f-7c37-4d13-9063-fd58ad2b86e2\",\"tags\":\"azsecpack:nonprod;platformsettings.host_environment.service.platform_optedin_for_rootcerts:true\",\"tagsList\":[{\"name\":\"azsecpack\",\"value\":\"nonprod\"},{\"name\":\"platformsettings.host_environment.service.platform_optedin_for_rootcerts\",\"value\":\"true\"}],\"version\":\"18.04.202103250\",\"vmId\":\"d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd\",\"vmScaleSetName\":\"\",\"vmSize\":\"Standard_D2s_v3\",\"zone\":\"1\"},\"network\":{\"interface\":[{\"ipv4\":{\"ipAddress\":[{\"privateIpAddress\":\"10.0.7.5\",\"publicIpAddress\":\"\"}],\"subnet\":[{\"address\":\"10.0.7.0\",\"prefix\":\"24\"}]},\"ipv6\":{\"ipAddress\":[]},\"macAddress\":\"000D3A8F8BA0\"}]}}"); + + private CosmosClientBuilder cosmosClientBuilder; + private static SystemUsageMonitor systemUsageMonitor; + + private List actualInfo; + private List preferredRegionList; + + private IDictionary expectedMetricNameUnitMap; + + private HttpClientHandlerHelper httpHandler; + private HttpClientHandlerHelper httpHandlerForNonAzureInstance; + + [ClassInitialize] + public static void ClassInitialize(TestContext _) + { + SystemUsageMonitor oldSystemUsageMonitor = (SystemUsageMonitor)typeof(DiagnosticsHandlerHelper) + .GetField("systemUsageMonitor", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(DiagnosticsHandlerHelper.Instance); + oldSystemUsageMonitor.Stop(); + + ClientTelemetryTests.ResetSystemUsageMonitor(true); + } + + [TestInitialize] + public void TestInitialize() + { + Util.EnableClientTelemetryEnvironmentVariables(); + + this.actualInfo = new List(); + + this.httpHandler = new HttpClientHandlerHelper + { + RequestCallBack = (request, cancellation) => + { + if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) + { + HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); + + string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + + lock (this.actualInfo) + { + this.actualInfo.Add(JsonConvert.DeserializeObject(jsonObject)); + } + + return Task.FromResult(result); + } + else if (request.RequestUri.AbsoluteUri.Equals(VmMetadataApiHandler.vmMetadataEndpointUrl.AbsoluteUri)) + { + HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); + + string payload = JsonConvert.SerializeObject(ClientTelemetryTests.jsonObject); + result.Content = new StringContent(payload, Encoding.UTF8, "application/json"); + + return Task.FromResult(result); + } + return null; + } + }; + + this.httpHandlerForNonAzureInstance = new HttpClientHandlerHelper + { + RequestCallBack = (request, cancellation) => + { + if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) + { + HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); + + string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + + lock (this.actualInfo) + { + this.actualInfo.Add(JsonConvert.DeserializeObject(jsonObject)); + } + + return Task.FromResult(result); + } + return null; + } + }; + + this.preferredRegionList = new List + { + "region1", + "region2" + }; + + this.expectedMetricNameUnitMap = new Dictionary() + { + { ClientTelemetryOptions.CpuName, ClientTelemetryOptions.CpuUnit }, + { ClientTelemetryOptions.MemoryName, ClientTelemetryOptions.MemoryUnit }, + { ClientTelemetryOptions.AvailableThreadsName, ClientTelemetryOptions.AvailableThreadsUnit }, + { ClientTelemetryOptions.IsThreadStarvingName, ClientTelemetryOptions.IsThreadStarvingUnit }, + { ClientTelemetryOptions.ThreadWaitIntervalInMsName, ClientTelemetryOptions.ThreadWaitIntervalInMsUnit } + }; + + this.cosmosClientBuilder = TestCommon.GetDefaultConfiguration() + .WithApplicationPreferredRegions(this.preferredRegionList); } private static void ResetSystemUsageMonitor(bool isTelemetryEnabled) @@ -201,985 +157,968 @@ private static void ResetSystemUsageMonitor(bool isTelemetryEnabled) ClientTelemetryTests.systemUsageMonitor = SystemUsageMonitor.CreateAndStart(recorders); } - [TestCleanup] + [TestCleanup] public async Task Cleanup() { - await base.TestCleanup(); - - Util.DisableClientTelemetryEnvironmentVariables(); - } - - [ClassCleanup] - public static void FinalCleanup() - { - ClientTelemetryTests.ResetSystemUsageMonitor(false); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct, true)] - [DataRow(ConnectionMode.Gateway, true)] - [DataRow(ConnectionMode.Direct, false)] - [DataRow(ConnectionMode.Gateway, false)] - public async Task PointSuccessOperationsTest(ConnectionMode mode, bool isAzureInstance) - { - Container container = await this.CreateClientAndContainer( - mode: mode, - isAzureInstance: isAzureInstance); - - // Create an item - ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue"); - ItemResponse createResponse = await container.CreateItemAsync(testItem); - ToDoActivity testItemCreated = createResponse.Resource; - - // Read an Item - await container.ReadItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); - - // Upsert an Item - await container.UpsertItemAsync(testItem); - - // Replace an Item - await container.ReplaceItemAsync(testItemCreated, testItemCreated.id.ToString()); - - // Patch an Item - List patch = new List() - { - PatchOperation.Add("/new", "patched") - }; - await ((ContainerInternal)container).PatchItemAsync( - testItem.id, - new Cosmos.PartitionKey(testItem.id), - patch); - - // Delete an Item - await container.DeleteItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Create.ToString(), 1}, - { Documents.OperationType.Upsert.ToString(), 1}, - { Documents.OperationType.Read.ToString(), 1}, - { Documents.OperationType.Replace.ToString(), 1}, - { Documents.OperationType.Patch.ToString(), 1}, - { Documents.OperationType.Delete.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 12, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - isAzureInstance: isAzureInstance); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task PointReadFailureOperationsTest(ConnectionMode mode) - { - // Fail Read - try - { - Container container = await this.CreateClientAndContainer(mode, Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix); - - await container.ReadItemAsync( - new Guid().ToString(), - new Cosmos.PartitionKey(new Guid().ToString()), - new ItemRequestOptions() - { - BaseConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual // overriding client level consistency - }); - } - catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.NotFound) - { - string message = ce.ToString(); - Assert.IsNotNull(message); - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Read.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 2, - expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - expectedCacheSource: null, - isExpectedNetworkTelemetry: false); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task StreamReadFailureOperationsTest(ConnectionMode mode) - { - Container container = await this.CreateClientAndContainer(mode); - - // Fail Read - try - { - await container.ReadItemStreamAsync( - new Guid().ToString(), - new Cosmos.PartitionKey(new Guid().ToString()), - new ItemRequestOptions() - { - BaseConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix // Request level consistency - }); - } - catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.NotFound) - { - string message = ce.ToString(); - Assert.IsNotNull(message); - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Read.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 2, - expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - expectedCacheSource: null, - isExpectedNetworkTelemetry: false); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task StreamOperationsTest(ConnectionMode mode) - { - Container container = await this.CreateClientAndContainer(mode); - - // Create an item - var testItem = new { id = "MyTestItemId", partitionKeyPath = "MyTestPkValue", details = "it's working", status = "done" }; - await container - .CreateItemStreamAsync(TestCommon.SerializerCore.ToStream(testItem), - new Cosmos.PartitionKey(testItem.id)); - - //Upsert an Item - await container.UpsertItemStreamAsync(TestCommon.SerializerCore.ToStream(testItem), new Cosmos.PartitionKey(testItem.id)); - - //Read an Item - await container.ReadItemStreamAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); - - //Replace an Item - await container.ReplaceItemStreamAsync(TestCommon.SerializerCore.ToStream(testItem), testItem.id, new Cosmos.PartitionKey(testItem.id)); - - // Patch an Item - List patch = new List() - { - PatchOperation.Add("/new", "patched") - }; - await ((ContainerInternal)container).PatchItemStreamAsync( - partitionKey: new Cosmos.PartitionKey(testItem.id), - id: testItem.id, - patchOperations: patch); - - //Delete an Item - await container.DeleteItemStreamAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Create.ToString(), 1}, - { Documents.OperationType.Upsert.ToString(), 1}, - { Documents.OperationType.Read.ToString(), 1}, - { Documents.OperationType.Replace.ToString(), 1}, - { Documents.OperationType.Patch.ToString(), 1}, - { Documents.OperationType.Delete.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 12, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - expectedCacheSource: null); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task BatchOperationsTest(ConnectionMode mode) - { - Container container = await this.CreateClientAndContainer(mode, Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual); // Client level consistency - using (BatchAsyncContainerExecutor executor = - new BatchAsyncContainerExecutor( - (ContainerInlineCore)container, - ((ContainerInlineCore)container).ClientContext, - 20, - Documents.Constants.MaxDirectModeBatchRequestBodySizeInBytes) - ) - { - List> tasks = new List>(); - for (int i = 0; i < 10; i++) - { - tasks.Add(executor.AddAsync(CreateItem(i.ToString()), NoOpTrace.Singleton, default)); - } - - await Task.WhenAll(tasks); - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Batch.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 2, - expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual, - expectedOperationRecordCountMap: expectedRecordCountInOperation); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task SingleOperationMultipleTimesTest(ConnectionMode mode) - { - Container container = await this.CreateClientAndContainer(mode); - - // Create an item - ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); - - await container.CreateItemAsync(testItem, requestOptions: new ItemRequestOptions()); - - for (int count = 0; count < 50; count++) - { - // Read an Item - await container.ReadItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Read.ToString(), 50}, - { Documents.OperationType.Create.ToString(), 1} - }; - - await this.WaitAndAssert( - expectedOperationCount: 4,// 2 (read, requetLatency + requestCharge) + 2 (create, requestLatency + requestCharge) - expectedOperationRecordCountMap: expectedRecordCountInOperation); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task QueryOperationSinglePartitionTest(ConnectionMode mode) - { - Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); - - Container container = await this.CreateClientAndContainer(mode); - - ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue", "MyTestItemId"); - ItemRequestOptions requestOptions = new ItemRequestOptions() - { - ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix - }; - - ItemResponse createResponse = await container.CreateItemAsync( - item: testItem, - requestOptions: requestOptions); - - QueryRequestOptions queryRequestOptions = new QueryRequestOptions() - { - ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix, - }; - - List families = new List(); - if (createResponse.StatusCode == HttpStatusCode.Created) - { - string sqlQueryText = "SELECT * FROM c"; - - QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); - using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator( - queryDefinition: queryDefinition, - requestOptions: queryRequestOptions)) - { - while (queryResultSetIterator.HasMoreResults) - { - FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); - foreach (object family in currentResultSet) - { - families.Add(family); - } - } - } - - Assert.AreEqual(1, families.Count); - - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Query.ToString(), 1}, - { Documents.OperationType.Create.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 4, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task QueryMultiPageSinglePartitionOperationTest(ConnectionMode mode) - { - Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); - Container container = await this.CreateClientAndContainer(mode: mode); - - ItemRequestOptions requestOptions = new ItemRequestOptions() - { - ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix - }; - - ToDoActivity testItem1 = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue1", "MyTestItemId1"); - ItemResponse createResponse1 = await container.CreateItemAsync( - item: testItem1, - requestOptions: requestOptions); - ToDoActivity testItem2 = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue2", "MyTestItemId2"); - ItemResponse createResponse2 = await container.CreateItemAsync( - item: testItem2, - requestOptions: requestOptions); - - if (createResponse1.StatusCode == HttpStatusCode.Created && - createResponse2.StatusCode == HttpStatusCode.Created) - { - string sqlQueryText = "SELECT * FROM c"; - - List families = new List(); - QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); - using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator( - queryDefinition: queryDefinition, - requestOptions: new QueryRequestOptions() - { - ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix, - MaxItemCount = 1 - })) - { - while (queryResultSetIterator.HasMoreResults) - { - FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); - foreach (object family in currentResultSet) - { - families.Add(family); - } - } - } - - Assert.AreEqual(2, families.Count); - - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Query.ToString(), 3}, - { Documents.OperationType.Create.ToString(), 2} - }; - - await this.WaitAndAssert( - expectedOperationCount: 4, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task QueryOperationCrossPartitionTest(ConnectionMode mode) - { - Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); - - ContainerInternal itemsCore = (ContainerInternal)await this.CreateClientAndContainer( - mode: mode, - isLargeContainer: true); - - // Verify container has multiple partitions - int pkRangesCount = (await itemsCore.ClientContext.DocumentClient.ReadPartitionKeyRangeFeedAsync(itemsCore.LinkUri)).Count; - Assert.IsTrue(pkRangesCount > 1, "Should have created a multi partition container."); - - Container container = (Container)itemsCore; - - await ToDoActivity.CreateRandomItems( - container: container, - pkCount: 2, - perPKItemCount: 5); - - string sqlQueryText = "SELECT * FROM c"; - - List families = new List(); - - QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); - using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator(queryDefinition)) - { - while (queryResultSetIterator.HasMoreResults) - { - FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); - foreach (object family in currentResultSet) - { - families.Add(family); - } - } - } - - Assert.AreEqual(10, families.Count); - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Query.ToString(), pkRangesCount}, - { Documents.OperationType.Create.ToString(), 10} - }; - - await this.WaitAndAssert( - expectedOperationCount: 4, - expectedOperationRecordCountMap: expectedRecordCountInOperation); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task QueryOperationMutiplePageCrossPartitionTest(ConnectionMode mode) - { - Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); - - ContainerInternal itemsCore = (ContainerInternal)await this.CreateClientAndContainer( - mode: mode, - isLargeContainer: true); - - // Verify container has multiple partitions - int pkRangesCount = (await itemsCore.ClientContext.DocumentClient.ReadPartitionKeyRangeFeedAsync(itemsCore.LinkUri)).Count; - Assert.IsTrue(pkRangesCount > 1, "Should have created a multi partition container."); - - Container container = (Container)itemsCore; - - await ToDoActivity.CreateRandomItems( - container: container, - pkCount: 2, - perPKItemCount: 5); - - string sqlQueryText = "SELECT * FROM c"; - - List families = new List(); - QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); - using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator( - queryDefinition: queryDefinition, - requestOptions: new QueryRequestOptions() - { - MaxItemCount = 1 - })) - { - while (queryResultSetIterator.HasMoreResults) - { - FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); - foreach (object family in currentResultSet) - { - families.Add(family); - } - } - } - - Assert.AreEqual(10, families.Count); - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Query.ToString(), pkRangesCount + 10}, // 10 is number of items - { Documents.OperationType.Create.ToString(), 10} - }; - - await this.WaitAndAssert( - expectedOperationCount: 4, - expectedOperationRecordCountMap: expectedRecordCountInOperation); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - [DataRow(ConnectionMode.Gateway)] - public async Task QueryOperationInvalidContinuationTokenTest(ConnectionMode mode) - { - Container container = await this.CreateClientAndContainer(mode); - - // Create an item : First successful request to load Cache - ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue"); - await container.CreateItemAsync(testItem); - - List results = new List(); - using (FeedIterator resultSetIterator = container.GetItemQueryIterator( - "SELECT * FROM c", - continuationToken: "dummy token")) - { - try - { - while (resultSetIterator.HasMoreResults) - { - FeedResponse response = await resultSetIterator.ReadNextAsync(); - results.AddRange(response); - } - } - catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.BadRequest) - { - string message = ce.ToString(); - Assert.IsNotNull(message); - } - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Create.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 2, - expectedOperationRecordCountMap: expectedRecordCountInOperation); - } - - [TestMethod] - [DataRow(ConnectionMode.Direct)] - public async Task CreateItemWithSubStatusCodeTest(ConnectionMode mode) - { - HttpClientHandlerHelper httpHandler = new HttpClientHandlerHelper(); - HttpClient httpClient = new HttpClient(httpHandler); - - httpHandler.RequestCallBack = (request, cancellation) => - { - if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) - { - HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); - - string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult(); - - lock (this.actualInfo) - { - this.actualInfo.Add(JsonConvert.DeserializeObject(jsonObject)); - } - - return Task.FromResult(result); - } - else if (request.RequestUri.AbsoluteUri.Equals(VmMetadataApiHandler.vmMetadataEndpointUrl.AbsoluteUri)) - { - HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); - - string payload = JsonConvert.SerializeObject(ClientTelemetryTests.jsonObject); - result.Content = new StringContent(payload, Encoding.UTF8, "application/json"); - - return Task.FromResult(result); - } - else if (request.Method == HttpMethod.Get && request.RequestUri.AbsolutePath == "//addresses/") - { - HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.Forbidden); - - // Add a substatus code that is not part of the enum. - // This ensures that if the backend adds a enum the status code is not lost. - result.Headers.Add(WFConstants.BackendHeaders.SubStatus, 999999.ToString(CultureInfo.InvariantCulture)); - - string payload = JsonConvert.SerializeObject(new Error() { Message = "test message" }); - result.Content = new StringContent(payload, Encoding.UTF8, "application/json"); - - return Task.FromResult(result); - } - - return null; - }; - - // Replacing originally initialized cosmos Builder with this one with new handler - this.cosmosClientBuilder = this.cosmosClientBuilder - .WithHttpClientFactory(() => new HttpClient(httpHandler)); - - Container container = await this.CreateClientAndContainer( - mode: mode, - customHttpHandler: httpHandler); - try - { - ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue"); - ItemResponse createResponse = await container.CreateItemAsync(testItem); - Assert.Fail("Request should throw exception."); - } - catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.Forbidden) - { - Assert.AreEqual(999999, ce.SubStatusCode); - } - - IDictionary expectedRecordCountInOperation = new Dictionary - { - { Documents.OperationType.Create.ToString(), 1} - }; - - await this.WaitAndAssert(expectedOperationCount: 2, - expectedOperationRecordCountMap: expectedRecordCountInOperation, - expectedSubstatuscode: 999999, - isExpectedNetworkTelemetry: false); - - } - - /// - /// This method wait for the expected operations to get recorded by telemetry and assert the values - /// - /// Expected number of unique OperationInfo irrespective of response size. - /// Expected Consistency level of the operation recorded by telemetry - /// Expected number of requests recorded for each operation - /// - private async Task WaitAndAssert( - int expectedOperationCount = 0, - Microsoft.Azure.Cosmos.ConsistencyLevel? expectedConsistencyLevel = null, - IDictionary expectedOperationRecordCountMap = null, - int expectedSubstatuscode = 0, - bool? isAzureInstance = null, - string expectedCacheSource = "ClientCollectionCache", - bool isExpectedNetworkTelemetry = true) - { - Assert.IsNotNull(this.actualInfo, "Telemetry Information not available"); - - // As this feature is thread based execution so wait for the results to avoid test flakiness - List localCopyOfActualInfo = null; - ValueStopwatch stopwatch = ValueStopwatch.StartNew(); - - HashSet cacheRefreshInfoSet = new HashSet(); - do - { - await Task.Delay(TimeSpan.FromMilliseconds(1500)); // wait at least for 1 round of telemetry - - HashSet actualOperationSet = new HashSet(); - HashSet requestInfoSet = new HashSet(); - - lock (this.actualInfo) - { - // Setting the number of unique OperationInfo irrespective of response size as response size is varying in case of queries. - this.actualInfo - .ForEach(x => - { - if (x.CacheRefreshInfo != null && x.CacheRefreshInfo.Count > 0) - { - x.CacheRefreshInfo - .ForEach(y => - { - y.GreaterThan1Kb = false; - cacheRefreshInfoSet.Add(y); - }); - - } - - x.OperationInfo - .ForEach(y => - { - y.GreaterThan1Kb = false; - actualOperationSet.Add(y); - }); - }); - - if (actualOperationSet.Count == expectedOperationCount / 2) - { - // Copy the list to avoid it being modified while validating - localCopyOfActualInfo = new List(this.actualInfo); - break; - } - - Assert.IsTrue(stopwatch.Elapsed.TotalMinutes < 1, $"The expected operation count({expectedOperationCount}) was never hit, Actual Operation Count is {actualOperationSet.Count}. ActualInfo:{JsonConvert.SerializeObject(this.actualInfo)}"); - } - } - while (localCopyOfActualInfo == null); - - List actualOperationList = new List(); - List actualSystemInformation = new List(); - List actualRequestInformation = new List(); - - if (localCopyOfActualInfo[0].ConnectionMode == ConnectionMode.Direct.ToString().ToUpperInvariant()) - { - this.expectedMetricNameUnitMap.Add(ClientTelemetryOptions.NumberOfTcpConnectionName, ClientTelemetryOptions.NumberOfTcpConnectionUnit); - } - - ClientTelemetryTests.AssertAccountLevelInformation( - localCopyOfActualInfo: localCopyOfActualInfo, - actualOperationList: actualOperationList, - actualSystemInformation: actualSystemInformation, - actualRequestInformation: actualRequestInformation, - isAzureInstance: isAzureInstance); - - ClientTelemetryTests.AssertOperationLevelInformation( - expectedConsistencyLevel: expectedConsistencyLevel, - expectedOperationRecordCountMap: expectedOperationRecordCountMap, - actualOperationList: actualOperationList, - expectedSubstatuscode: expectedSubstatuscode); - - if(!string.IsNullOrEmpty(expectedCacheSource)) - { - Assert.IsTrue(cacheRefreshInfoSet.Count > 0, "Cache Refresh Information is not there"); - - ClientTelemetryTests.AssertCacheRefreshInfoInformation( - cacheRefreshInfoSet: cacheRefreshInfoSet, - expectedCacheSource: expectedCacheSource); - } - - ClientTelemetryTests.AssertSystemLevelInformation(actualSystemInformation, this.expectedMetricNameUnitMap); - if (localCopyOfActualInfo.First().ConnectionMode == ConnectionMode.Direct.ToString().ToUpperInvariant() - && isExpectedNetworkTelemetry) - { - ClientTelemetryTests.AssertNetworkLevelInformation(actualRequestInformation); - } - else - { - Assert.IsTrue(actualRequestInformation == null || actualRequestInformation.Count == 0, "Request Information is not expected in Gateway mode"); - } - } - - private static void AssertNetworkLevelInformation(List actualRequestInformation) - { - Assert.IsNotNull(actualRequestInformation); - Assert.IsTrue(actualRequestInformation.Count > 0); - - foreach(RequestInfo requestInfo in actualRequestInformation) - { - Assert.IsNotNull(requestInfo.Uri); - Assert.IsNotNull(requestInfo.DatabaseName); - Assert.IsNotNull(requestInfo.ContainerName); - Assert.IsNotNull(requestInfo.Operation); - Assert.IsNotNull(requestInfo.Resource); - Assert.IsNotNull(requestInfo.StatusCode); - Assert.AreNotEqual(0, requestInfo.StatusCode); - Assert.IsNotNull(requestInfo.SubStatusCode); - - Assert.IsNotNull(requestInfo.Metrics, "MetricInfo is null"); - } - } - - private static void AssertSystemLevelInformation(List actualSystemInformation, IDictionary expectedMetricNameUnitMap) - { - IDictionary actualMetricNameUnitMap = new Dictionary(); - - // Asserting If system information list is as expected - foreach (SystemInfo systemInfo in actualSystemInformation) - { - Assert.AreEqual("HostMachine", systemInfo.Resource); - Assert.IsNotNull(systemInfo.MetricInfo, "MetricInfo is null"); - - if(!actualMetricNameUnitMap.TryAdd(systemInfo.MetricInfo.MetricsName, systemInfo.MetricInfo.UnitName)) - { - Assert.AreEqual(systemInfo.MetricInfo.UnitName, actualMetricNameUnitMap[systemInfo.MetricInfo.MetricsName]); - } - - if(!systemInfo.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.IsThreadStarvingName) && - !systemInfo.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.ThreadWaitIntervalInMsName)) - { - Assert.IsTrue(systemInfo.MetricInfo.Count > 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Count is not greater than 0"); - Assert.IsNotNull(systemInfo.MetricInfo.Percentiles, $"Percentiles is null for metrics ({systemInfo.MetricInfo.MetricsName})"); - } - Assert.IsTrue(systemInfo.MetricInfo.Mean >= 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Mean is not greater than or equal to 0"); - Assert.IsTrue(systemInfo.MetricInfo.Max >= 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Max is not greater than or equal to 0"); - Assert.IsTrue(systemInfo.MetricInfo.Min >= 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Min is not greater than or equal to 0"); - if (systemInfo.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.CpuName)) - { - Assert.IsTrue(systemInfo.MetricInfo.Mean <= 100, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Mean is not greater than 100 for CPU Usage"); - Assert.IsTrue(systemInfo.MetricInfo.Max <= 100, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Max is not greater than 100 for CPU Usage"); - Assert.IsTrue(systemInfo.MetricInfo.Min <= 100, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Min is not greater than 100 for CPU Usage"); - }; - } - - Assert.IsTrue(expectedMetricNameUnitMap.EqualsTo(actualMetricNameUnitMap), $"Actual System Information metric i.e {string.Join(", ", actualMetricNameUnitMap)} is not matching with expected System Information Metric i.e. {string.Join(", ", expectedMetricNameUnitMap)}"); - - } - - private static void AssertOperationLevelInformation( - Microsoft.Azure.Cosmos.ConsistencyLevel? expectedConsistencyLevel, - IDictionary expectedOperationRecordCountMap, - List actualOperationList, - int expectedSubstatuscode = 0) - { - IDictionary actualOperationRecordCountMap = new Dictionary(); - // Asserting If operation list is as expected - foreach (OperationInfo operation in actualOperationList) - { - Assert.IsNotNull(operation.Operation, "Operation Type is null"); - Assert.IsNotNull(operation.Resource, "Resource Type is null"); - - Assert.AreEqual(expectedSubstatuscode, operation.SubStatusCode); - Assert.AreEqual(expectedConsistencyLevel?.ToString(), operation.Consistency, $"Consistency is not {expectedConsistencyLevel}"); - - Assert.IsNotNull(operation.MetricInfo, "MetricInfo is null"); - Assert.IsNotNull(operation.MetricInfo.MetricsName, "MetricsName is null"); - Assert.IsNotNull(operation.MetricInfo.UnitName, "UnitName is null"); - Assert.IsNotNull(operation.MetricInfo.Percentiles, "Percentiles is null"); - Assert.IsTrue(operation.MetricInfo.Count > 0, "MetricInfo Count is not greater than 0"); - Assert.IsTrue(operation.MetricInfo.Mean >= 0, "MetricInfo Mean is not greater than or equal to 0"); - Assert.IsTrue(operation.MetricInfo.Max >= 0, "MetricInfo Max is not greater than or equal to 0"); - Assert.IsTrue(operation.MetricInfo.Min >= 0, "MetricInfo Min is not greater than or equal to 0"); - if (operation.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.RequestLatencyName)) // putting this condition to avoid doubling of count as we have same information for each metrics - { - if (!actualOperationRecordCountMap.TryGetValue(operation.Operation.ToString(), out long recordCount)) - { - actualOperationRecordCountMap.Add(operation.Operation.ToString(), operation.MetricInfo.Count); - } - else - { - actualOperationRecordCountMap.Remove(operation.Operation.ToString()); - actualOperationRecordCountMap.Add(operation.Operation.ToString(), recordCount + operation.MetricInfo.Count); - } - } - } - - if (expectedOperationRecordCountMap != null) - { - Assert.IsTrue(expectedOperationRecordCountMap.EqualsTo(actualOperationRecordCountMap), $"actual record i.e. ({actualOperationRecordCountMap}) for operation does not match with expected record i.e. ({expectedOperationRecordCountMap})"); - } - } - - private static void AssertAccountLevelInformation( - List localCopyOfActualInfo, - List actualOperationList, - List actualSystemInformation, - List actualRequestInformation, - bool? isAzureInstance) - { - ISet machineId = new HashSet(); - - // Asserting If basic client telemetry object is as expected - foreach (ClientTelemetryProperties telemetryInfo in localCopyOfActualInfo) - { - if (telemetryInfo.OperationInfo != null) - { - actualOperationList.AddRange(telemetryInfo.OperationInfo); - } - - if (telemetryInfo.SystemInfo != null) - { - foreach (SystemInfo sysInfo in telemetryInfo.SystemInfo) - { - actualSystemInformation.Add(sysInfo); - } - } - - if (telemetryInfo.RequestInfo != null) - { - actualRequestInformation.AddRange(telemetryInfo.RequestInfo); - } - - if (telemetryInfo.ConnectionMode == ConnectionMode.Direct.ToString().ToUpperInvariant()) - { - Assert.AreEqual(6, telemetryInfo.SystemInfo.Count, $"System Information Count doesn't Match; {JsonConvert.SerializeObject(telemetryInfo.SystemInfo)}"); - } - else - { - Assert.AreEqual(5, telemetryInfo.SystemInfo.Count, $"System Information Count doesn't Match; {JsonConvert.SerializeObject(telemetryInfo.SystemInfo)}"); - } - - Assert.IsNotNull(telemetryInfo.GlobalDatabaseAccountName, "GlobalDatabaseAccountName is null"); - Assert.IsNotNull(telemetryInfo.DateTimeUtc, "Timestamp is null"); - Assert.AreEqual(2, telemetryInfo.PreferredRegions.Count); - Assert.AreEqual("region1", telemetryInfo.PreferredRegions[0]); - Assert.AreEqual("region2", telemetryInfo.PreferredRegions[1]); - Assert.AreEqual(1, telemetryInfo.AggregationIntervalInSec); - Assert.IsNull(telemetryInfo.AcceleratedNetworking); - Assert.IsNotNull(telemetryInfo.ClientId); - Assert.IsNotNull(telemetryInfo.ProcessId); - Assert.AreEqual(HashingExtension.ComputeHash(System.Diagnostics.Process.GetCurrentProcess().ProcessName), telemetryInfo.ProcessId); - Assert.IsNotNull(telemetryInfo.UserAgent); - Assert.IsFalse(telemetryInfo.UserAgent.Contains("userAgentSuffix"), "Useragent should not have suffix appended"); // Useragent should not contain useragentsuffix as it can have PII - Assert.IsNotNull(telemetryInfo.ConnectionMode); - - if(!string.IsNullOrEmpty(telemetryInfo.MachineId)) - { - machineId.Add(telemetryInfo.MachineId); - } - } - - if(isAzureInstance.HasValue) - { - if (isAzureInstance.Value) - { - Assert.AreEqual($"{VmMetadataApiHandler.VmIdPrefix}{"d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd"}", machineId.First(), $"Generated Machine id is : {machineId.First()}"); - } - else - { - Assert.AreNotEqual($"{VmMetadataApiHandler.VmIdPrefix}{"d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd"}", machineId.First(), $"Generated Machine id is : {machineId.First()}"); - Assert.AreEqual(1, machineId.Count, $"Multiple Machine Id has been generated i.e {JsonConvert.SerializeObject(machineId)}"); - } - } - } - - - private static void AssertCacheRefreshInfoInformation( - HashSet cacheRefreshInfoSet, - string expectedCacheSource) - { - foreach(CacheRefreshInfo cacheRefreshInfo in cacheRefreshInfoSet) - { - Assert.IsNotNull(cacheRefreshInfo.CacheRefreshSource); - Assert.IsTrue(expectedCacheSource.Contains(cacheRefreshInfo.CacheRefreshSource)); - Assert.IsNotNull(cacheRefreshInfo.Operation, "Operation Type is null"); - Assert.IsNotNull(cacheRefreshInfo.Resource, "Resource Type is null"); - Assert.IsNotNull(cacheRefreshInfo.StatusCode, "StatusCode is null"); - Assert.IsNotNull(cacheRefreshInfo.SubStatusCode); - Assert.IsNull(cacheRefreshInfo.Consistency); - Assert.IsNotNull(cacheRefreshInfo.ContainerName, "ContainerName is null"); - Assert.IsNotNull(cacheRefreshInfo.MetricInfo, "MetricInfo is null"); - Assert.IsNotNull(cacheRefreshInfo.MetricInfo.MetricsName, "MetricsName is null"); - Assert.IsNotNull(cacheRefreshInfo.MetricInfo.UnitName, "UnitName is null"); - Assert.IsNotNull(cacheRefreshInfo.MetricInfo.Percentiles, "Percentiles is null"); - Assert.IsTrue(cacheRefreshInfo.MetricInfo.Count >= 0, "MetricInfo Count is not greater than 0"); - Assert.IsTrue(cacheRefreshInfo.MetricInfo.Mean >= 0, "MetricInfo Mean is not greater than or equal to 0"); - Assert.IsTrue(cacheRefreshInfo.MetricInfo.Max >= 0, "MetricInfo Max is not greater than or equal to 0"); - Assert.IsTrue(cacheRefreshInfo.MetricInfo.Min >= 0, "MetricInfo Min is not greater than or equal to 0"); - } - } - - [TestMethod] - public async Task CheckMisconfiguredTelemetryEndpoint_should_stop_the_job() - { - int retryCounter = 0; - HttpClientHandlerHelper customHttpHandler = new HttpClientHandlerHelper - { - RequestCallBack = (request, cancellation) => - { - if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) - { - retryCounter++; - throw new Exception("Exception while sending telemetry"); - } - - return null; - } - }; - - Container container = await this.CreateClientAndContainer( - mode: ConnectionMode.Direct, - customHttpHandler: customHttpHandler); - - await Task.Delay(TimeSpan.FromMilliseconds(5000)); // wait for 5 sec, ideally telemetry would be sent 5 times but client telemetry endpoint is not functional (in this test), it should try 3 times maximum and after that client telemetry job should be stopped. - - Assert.AreEqual(3, retryCounter); - } - - private static ItemBatchOperation CreateItem(string itemId) - { - var testItem = new { id = itemId, Status = itemId }; - return new ItemBatchOperation(Documents.OperationType.Create, 0, new Cosmos.PartitionKey(itemId), itemId, TestCommon.SerializerCore.ToStream(testItem)); - } - - private async Task CreateClientAndContainer(ConnectionMode mode, - Microsoft.Azure.Cosmos.ConsistencyLevel? consistency = null, - bool isLargeContainer = false, - bool isAzureInstance = false, - HttpClientHandlerHelper customHttpHandler = null) - { - if (consistency.HasValue) - { - this.cosmosClientBuilder = this.cosmosClientBuilder - .WithConsistencyLevel(consistency.Value); - } - - HttpClientHandlerHelper handlerHelper; - if (customHttpHandler == null) - { - handlerHelper = isAzureInstance ? this.httpHandler : this.httpHandlerForNonAzureInstance; - } - else - { - handlerHelper = customHttpHandler; - } - - this.cosmosClientBuilder = this.cosmosClientBuilder - .WithHttpClientFactory(() => new HttpClient(handlerHelper)) - .WithApplicationName("userAgentSuffix"); - - this.SetClient(mode == ConnectionMode.Gateway - ? this.cosmosClientBuilder.WithConnectionModeGateway().Build() - : this.cosmosClientBuilder.Build()); - - this.database = await this.GetClient().CreateDatabaseAsync(Guid.NewGuid().ToString()); - - return await this.database.CreateContainerAsync( - id: Guid.NewGuid().ToString(), - partitionKeyPath: "/id", - throughput: isLargeContainer? 15000 : 400); - - } - - } -} + FieldInfo isInitializedField = typeof(VmMetadataApiHandler).GetField("isInitialized", + BindingFlags.Static | + BindingFlags.NonPublic); + isInitializedField.SetValue(null, false); + + FieldInfo azMetadataField = typeof(VmMetadataApiHandler).GetField("azMetadata", + BindingFlags.Static | + BindingFlags.NonPublic); + azMetadataField.SetValue(null, null); + + await base.TestCleanup(); + + Util.DisableClientTelemetryEnvironmentVariables(); + } + + [ClassCleanup] + public static void FinalCleanup() + { + ClientTelemetryTests.ResetSystemUsageMonitor(false); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct, true)] + [DataRow(ConnectionMode.Gateway, true)] + [DataRow(ConnectionMode.Direct, false)] + [DataRow(ConnectionMode.Gateway, false)] + public async Task PointSuccessOperationsTest(ConnectionMode mode, bool isAzureInstance) + { + Container container = await this.CreateClientAndContainer( + mode: mode, + isAzureInstance: isAzureInstance); + + // Create an item + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue"); + ItemResponse createResponse = await container.CreateItemAsync(testItem); + ToDoActivity testItemCreated = createResponse.Resource; + + // Read an Item + await container.ReadItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); + + // Upsert an Item + await container.UpsertItemAsync(testItem); + + // Replace an Item + await container.ReplaceItemAsync(testItemCreated, testItemCreated.id.ToString()); + + // Patch an Item + List patch = new List() + { + PatchOperation.Add("/new", "patched") + }; + await ((ContainerInternal)container).PatchItemAsync( + testItem.id, + new Cosmos.PartitionKey(testItem.id), + patch); + + // Delete an Item + await container.DeleteItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Create.ToString(), 1}, + { Documents.OperationType.Upsert.ToString(), 1}, + { Documents.OperationType.Read.ToString(), 1}, + { Documents.OperationType.Replace.ToString(), 1}, + { Documents.OperationType.Patch.ToString(), 1}, + { Documents.OperationType.Delete.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 12, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + isAzureInstance: isAzureInstance); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task PointReadFailureOperationsTest(ConnectionMode mode) + { + // Fail Read + try + { + Container container = await this.CreateClientAndContainer(mode, Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix); + + await container.ReadItemAsync( + new Guid().ToString(), + new Cosmos.PartitionKey(new Guid().ToString()), + new ItemRequestOptions() + { + BaseConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual // overriding client level consistency + }); + } + catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.NotFound) + { + string message = ce.ToString(); + Assert.IsNotNull(message); + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Read.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 2, + expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + expectedCacheSource: null, + isExpectedNetworkTelemetry: false); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task StreamReadFailureOperationsTest(ConnectionMode mode) + { + Container container = await this.CreateClientAndContainer(mode); + + // Fail Read + try + { + await container.ReadItemStreamAsync( + new Guid().ToString(), + new Cosmos.PartitionKey(new Guid().ToString()), + new ItemRequestOptions() + { + BaseConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix // Request level consistency + }); + } + catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.NotFound) + { + string message = ce.ToString(); + Assert.IsNotNull(message); + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Read.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 2, + expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + expectedCacheSource: null, + isExpectedNetworkTelemetry: false); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task StreamOperationsTest(ConnectionMode mode) + { + Container container = await this.CreateClientAndContainer(mode); + + // Create an item + var testItem = new { id = "MyTestItemId", partitionKeyPath = "MyTestPkValue", details = "it's working", status = "done" }; + await container + .CreateItemStreamAsync(TestCommon.SerializerCore.ToStream(testItem), + new Cosmos.PartitionKey(testItem.id)); + + //Upsert an Item + await container.UpsertItemStreamAsync(TestCommon.SerializerCore.ToStream(testItem), new Cosmos.PartitionKey(testItem.id)); + + //Read an Item + await container.ReadItemStreamAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); + + //Replace an Item + await container.ReplaceItemStreamAsync(TestCommon.SerializerCore.ToStream(testItem), testItem.id, new Cosmos.PartitionKey(testItem.id)); + + // Patch an Item + List patch = new List() + { + PatchOperation.Add("/new", "patched") + }; + await ((ContainerInternal)container).PatchItemStreamAsync( + partitionKey: new Cosmos.PartitionKey(testItem.id), + id: testItem.id, + patchOperations: patch); + + //Delete an Item + await container.DeleteItemStreamAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Create.ToString(), 1}, + { Documents.OperationType.Upsert.ToString(), 1}, + { Documents.OperationType.Read.ToString(), 1}, + { Documents.OperationType.Replace.ToString(), 1}, + { Documents.OperationType.Patch.ToString(), 1}, + { Documents.OperationType.Delete.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 12, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + expectedCacheSource: null); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task BatchOperationsTest(ConnectionMode mode) + { + Container container = await this.CreateClientAndContainer(mode, Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual); // Client level consistency + using (BatchAsyncContainerExecutor executor = + new BatchAsyncContainerExecutor( + (ContainerInlineCore)container, + ((ContainerInlineCore)container).ClientContext, + 20, + Documents.Constants.MaxDirectModeBatchRequestBodySizeInBytes) + ) + { + List> tasks = new List>(); + for (int i = 0; i < 10; i++) + { + tasks.Add(executor.AddAsync(CreateItem(i.ToString()), NoOpTrace.Singleton, default)); + } + + await Task.WhenAll(tasks); + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Batch.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 2, + expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.Eventual, + expectedOperationRecordCountMap: expectedRecordCountInOperation); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task SingleOperationMultipleTimesTest(ConnectionMode mode) + { + Container container = await this.CreateClientAndContainer(mode); + + // Create an item + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity(); + + await container.CreateItemAsync(testItem, requestOptions: new ItemRequestOptions()); + + for (int count = 0; count < 50; count++) + { + // Read an Item + await container.ReadItemAsync(testItem.id, new Cosmos.PartitionKey(testItem.id)); + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Read.ToString(), 50}, + { Documents.OperationType.Create.ToString(), 1} + }; + + await this.WaitAndAssert( + expectedOperationCount: 4,// 2 (read, requetLatency + requestCharge) + 2 (create, requestLatency + requestCharge) + expectedOperationRecordCountMap: expectedRecordCountInOperation); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task QueryOperationSinglePartitionTest(ConnectionMode mode) + { + Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); + + Container container = await this.CreateClientAndContainer(mode); + + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue", "MyTestItemId"); + ItemRequestOptions requestOptions = new ItemRequestOptions() + { + ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix + }; + + ItemResponse createResponse = await container.CreateItemAsync( + item: testItem, + requestOptions: requestOptions); + + QueryRequestOptions queryRequestOptions = new QueryRequestOptions() + { + ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix, + }; + + List families = new List(); + if (createResponse.StatusCode == HttpStatusCode.Created) + { + string sqlQueryText = "SELECT * FROM c"; + + QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); + using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator( + queryDefinition: queryDefinition, + requestOptions: queryRequestOptions)) + { + while (queryResultSetIterator.HasMoreResults) + { + FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); + foreach (object family in currentResultSet) + { + families.Add(family); + } + } + } + + Assert.AreEqual(1, families.Count); + + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Query.ToString(), 1}, + { Documents.OperationType.Create.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 4, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task QueryMultiPageSinglePartitionOperationTest(ConnectionMode mode) + { + Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); + Container container = await this.CreateClientAndContainer(mode: mode); + + ItemRequestOptions requestOptions = new ItemRequestOptions() + { + ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix + }; + + ToDoActivity testItem1 = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue1", "MyTestItemId1"); + ItemResponse createResponse1 = await container.CreateItemAsync( + item: testItem1, + requestOptions: requestOptions); + ToDoActivity testItem2 = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue2", "MyTestItemId2"); + ItemResponse createResponse2 = await container.CreateItemAsync( + item: testItem2, + requestOptions: requestOptions); + + if (createResponse1.StatusCode == HttpStatusCode.Created && + createResponse2.StatusCode == HttpStatusCode.Created) + { + string sqlQueryText = "SELECT * FROM c"; + + List families = new List(); + QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); + using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator( + queryDefinition: queryDefinition, + requestOptions: new QueryRequestOptions() + { + ConsistencyLevel = Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix, + MaxItemCount = 1 + })) + { + while (queryResultSetIterator.HasMoreResults) + { + FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); + foreach (object family in currentResultSet) + { + families.Add(family); + } + } + } + + Assert.AreEqual(2, families.Count); + + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Query.ToString(), 3}, + { Documents.OperationType.Create.ToString(), 2} + }; + + await this.WaitAndAssert( + expectedOperationCount: 4, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + expectedConsistencyLevel: Microsoft.Azure.Cosmos.ConsistencyLevel.ConsistentPrefix); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task QueryOperationCrossPartitionTest(ConnectionMode mode) + { + Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); + + ContainerInternal itemsCore = (ContainerInternal)await this.CreateClientAndContainer( + mode: mode, + isLargeContainer: true); + + // Verify container has multiple partitions + int pkRangesCount = (await itemsCore.ClientContext.DocumentClient.ReadPartitionKeyRangeFeedAsync(itemsCore.LinkUri)).Count; + Assert.IsTrue(pkRangesCount > 1, "Should have created a multi partition container."); + + Container container = (Container)itemsCore; + + await ToDoActivity.CreateRandomItems( + container: container, + pkCount: 2, + perPKItemCount: 5); + + string sqlQueryText = "SELECT * FROM c"; + + List families = new List(); + + QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); + using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator(queryDefinition)) + { + while (queryResultSetIterator.HasMoreResults) + { + FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); + foreach (object family in currentResultSet) + { + families.Add(family); + } + } + } + + Assert.AreEqual(10, families.Count); + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Query.ToString(), pkRangesCount}, + { Documents.OperationType.Create.ToString(), 10} + }; + + await this.WaitAndAssert( + expectedOperationCount: 4, + expectedOperationRecordCountMap: expectedRecordCountInOperation); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task QueryOperationMutiplePageCrossPartitionTest(ConnectionMode mode) + { + Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetrySchedulingInSeconds, "20"); + + ContainerInternal itemsCore = (ContainerInternal)await this.CreateClientAndContainer( + mode: mode, + isLargeContainer: true); + + // Verify container has multiple partitions + int pkRangesCount = (await itemsCore.ClientContext.DocumentClient.ReadPartitionKeyRangeFeedAsync(itemsCore.LinkUri)).Count; + Assert.IsTrue(pkRangesCount > 1, "Should have created a multi partition container."); + + Container container = (Container)itemsCore; + + await ToDoActivity.CreateRandomItems( + container: container, + pkCount: 2, + perPKItemCount: 5); + + string sqlQueryText = "SELECT * FROM c"; + + List families = new List(); + QueryDefinition queryDefinition = new QueryDefinition(sqlQueryText); + using (FeedIterator queryResultSetIterator = container.GetItemQueryIterator( + queryDefinition: queryDefinition, + requestOptions: new QueryRequestOptions() + { + MaxItemCount = 1 + })) + { + while (queryResultSetIterator.HasMoreResults) + { + FeedResponse currentResultSet = await queryResultSetIterator.ReadNextAsync(); + foreach (object family in currentResultSet) + { + families.Add(family); + } + } + } + + Assert.AreEqual(10, families.Count); + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Query.ToString(), pkRangesCount + 10}, // 10 is number of items + { Documents.OperationType.Create.ToString(), 10} + }; + + await this.WaitAndAssert( + expectedOperationCount: 4, + expectedOperationRecordCountMap: expectedRecordCountInOperation); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + [DataRow(ConnectionMode.Gateway)] + public async Task QueryOperationInvalidContinuationTokenTest(ConnectionMode mode) + { + Container container = await this.CreateClientAndContainer(mode); + + // Create an item : First successful request to load Cache + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue"); + await container.CreateItemAsync(testItem); + + List results = new List(); + using (FeedIterator resultSetIterator = container.GetItemQueryIterator( + "SELECT * FROM c", + continuationToken: "dummy token")) + { + try + { + while (resultSetIterator.HasMoreResults) + { + FeedResponse response = await resultSetIterator.ReadNextAsync(); + results.AddRange(response); + } + } + catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.BadRequest) + { + string message = ce.ToString(); + Assert.IsNotNull(message); + } + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Create.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 2, + expectedOperationRecordCountMap: expectedRecordCountInOperation); + } + + [TestMethod] + [DataRow(ConnectionMode.Direct)] + public async Task CreateItemWithSubStatusCodeTest(ConnectionMode mode) + { + HttpClientHandlerHelper httpHandler = new HttpClientHandlerHelper(); + HttpClient httpClient = new HttpClient(httpHandler); + + httpHandler.RequestCallBack = (request, cancellation) => + { + if (request.RequestUri.AbsoluteUri.Equals(ClientTelemetryOptions.GetClientTelemetryEndpoint().AbsoluteUri)) + { + HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); + + string jsonObject = request.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + + lock (this.actualInfo) + { + this.actualInfo.Add(JsonConvert.DeserializeObject(jsonObject)); + } + + return Task.FromResult(result); + } + else if (request.RequestUri.AbsoluteUri.Equals(VmMetadataApiHandler.vmMetadataEndpointUrl.AbsoluteUri)) + { + HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); + + string payload = JsonConvert.SerializeObject(ClientTelemetryTests.jsonObject); + result.Content = new StringContent(payload, Encoding.UTF8, "application/json"); + + return Task.FromResult(result); + } + else if (request.Method == HttpMethod.Get && request.RequestUri.AbsolutePath == "//addresses/") + { + HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.Forbidden); + + // Add a substatus code that is not part of the enum. + // This ensures that if the backend adds a enum the status code is not lost. + result.Headers.Add(WFConstants.BackendHeaders.SubStatus, 999999.ToString(CultureInfo.InvariantCulture)); + + string payload = JsonConvert.SerializeObject(new Error() { Message = "test message" }); + result.Content = new StringContent(payload, Encoding.UTF8, "application/json"); + + return Task.FromResult(result); + } + + return null; + }; + + // Replacing originally initialized cosmos Builder with this one with new handler + this.cosmosClientBuilder = this.cosmosClientBuilder + .WithHttpClientFactory(() => new HttpClient(httpHandler)); + + Container container = await this.CreateClientAndContainer( + mode: mode, + customHttpHandler: httpHandler); + try + { + ToDoActivity testItem = ToDoActivity.CreateRandomToDoActivity("MyTestPkValue"); + ItemResponse createResponse = await container.CreateItemAsync(testItem); + Assert.Fail("Request should throw exception."); + } + catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.Forbidden) + { + Assert.AreEqual(999999, ce.SubStatusCode); + } + + IDictionary expectedRecordCountInOperation = new Dictionary + { + { Documents.OperationType.Create.ToString(), 1} + }; + + await this.WaitAndAssert(expectedOperationCount: 2, + expectedOperationRecordCountMap: expectedRecordCountInOperation, + expectedSubstatuscode: 999999, + isExpectedNetworkTelemetry: false); + + } + + /// + /// This method wait for the expected operations to get recorded by telemetry and assert the values + /// + /// Expected number of unique OperationInfo irrespective of response size. + /// Expected Consistency level of the operation recorded by telemetry + /// Expected number of requests recorded for each operation + /// + private async Task WaitAndAssert( + int expectedOperationCount = 0, + Microsoft.Azure.Cosmos.ConsistencyLevel? expectedConsistencyLevel = null, + IDictionary expectedOperationRecordCountMap = null, + int expectedSubstatuscode = 0, + bool? isAzureInstance = null, + string expectedCacheSource = "ClientCollectionCache", + bool isExpectedNetworkTelemetry = true) + { + Assert.IsNotNull(this.actualInfo, "Telemetry Information not available"); + + // As this feature is thread based execution so wait for the results to avoid test flakiness + List localCopyOfActualInfo = null; + ValueStopwatch stopwatch = ValueStopwatch.StartNew(); + + HashSet cacheRefreshInfoSet = new HashSet(); + do + { + await Task.Delay(TimeSpan.FromMilliseconds(1500)); // wait at least for 1 round of telemetry + + HashSet actualOperationSet = new HashSet(); + HashSet requestInfoSet = new HashSet(); + + lock (this.actualInfo) + { + // Setting the number of unique OperationInfo irrespective of response size as response size is varying in case of queries. + this.actualInfo + .ForEach(x => + { + if (x.CacheRefreshInfo != null && x.CacheRefreshInfo.Count > 0) + { + x.CacheRefreshInfo + .ForEach(y => + { + y.GreaterThan1Kb = false; + cacheRefreshInfoSet.Add(y); + }); + + } + + x.OperationInfo + .ForEach(y => + { + y.GreaterThan1Kb = false; + actualOperationSet.Add(y); + }); + }); + + if (actualOperationSet.Count == expectedOperationCount / 2) + { + // Copy the list to avoid it being modified while validating + localCopyOfActualInfo = new List(this.actualInfo); + break; + } + + Assert.IsTrue(stopwatch.Elapsed.TotalMinutes < 1, $"The expected operation count({expectedOperationCount}) was never hit, Actual Operation Count is {actualOperationSet.Count}. ActualInfo:{JsonConvert.SerializeObject(this.actualInfo)}"); + } + } + while (localCopyOfActualInfo == null); + + List actualOperationList = new List(); + List actualSystemInformation = new List(); + List actualRequestInformation = new List(); + + if (localCopyOfActualInfo[0].ConnectionMode == ConnectionMode.Direct.ToString().ToUpperInvariant()) + { + this.expectedMetricNameUnitMap.Add(ClientTelemetryOptions.NumberOfTcpConnectionName, ClientTelemetryOptions.NumberOfTcpConnectionUnit); + } + + ClientTelemetryTests.AssertAccountLevelInformation( + localCopyOfActualInfo: localCopyOfActualInfo, + actualOperationList: actualOperationList, + actualSystemInformation: actualSystemInformation, + actualRequestInformation: actualRequestInformation, + isAzureInstance: isAzureInstance); + + ClientTelemetryTests.AssertOperationLevelInformation( + expectedConsistencyLevel: expectedConsistencyLevel, + expectedOperationRecordCountMap: expectedOperationRecordCountMap, + actualOperationList: actualOperationList, + expectedSubstatuscode: expectedSubstatuscode); + + if(!string.IsNullOrEmpty(expectedCacheSource)) + { + Assert.IsTrue(cacheRefreshInfoSet.Count > 0, "Cache Refresh Information is not there"); + + ClientTelemetryTests.AssertCacheRefreshInfoInformation( + cacheRefreshInfoSet: cacheRefreshInfoSet, + expectedCacheSource: expectedCacheSource); + } + + ClientTelemetryTests.AssertSystemLevelInformation(actualSystemInformation, this.expectedMetricNameUnitMap); + if (localCopyOfActualInfo.First().ConnectionMode == ConnectionMode.Direct.ToString().ToUpperInvariant() + && isExpectedNetworkTelemetry) + { + ClientTelemetryTests.AssertNetworkLevelInformation(actualRequestInformation); + } + else + { + Assert.IsTrue(actualRequestInformation == null || actualRequestInformation.Count == 0, "Request Information is not expected in Gateway mode"); + } + } + + private static void AssertNetworkLevelInformation(List actualRequestInformation) + { + Assert.IsNotNull(actualRequestInformation); + Assert.IsTrue(actualRequestInformation.Count > 0); + + foreach(RequestInfo requestInfo in actualRequestInformation) + { + Assert.IsNotNull(requestInfo.Uri); + Assert.IsNotNull(requestInfo.DatabaseName); + Assert.IsNotNull(requestInfo.ContainerName); + Assert.IsNotNull(requestInfo.Operation); + Assert.IsNotNull(requestInfo.Resource); + Assert.IsNotNull(requestInfo.StatusCode); + Assert.AreNotEqual(0, requestInfo.StatusCode); + Assert.IsNotNull(requestInfo.SubStatusCode); + + Assert.IsNotNull(requestInfo.Metrics, "MetricInfo is null"); + } + } + + private static void AssertSystemLevelInformation(List actualSystemInformation, IDictionary expectedMetricNameUnitMap) + { + IDictionary actualMetricNameUnitMap = new Dictionary(); + + // Asserting If system information list is as expected + foreach (SystemInfo systemInfo in actualSystemInformation) + { + Assert.AreEqual("HostMachine", systemInfo.Resource); + Assert.IsNotNull(systemInfo.MetricInfo, "MetricInfo is null"); + + if(!actualMetricNameUnitMap.TryAdd(systemInfo.MetricInfo.MetricsName, systemInfo.MetricInfo.UnitName)) + { + Assert.AreEqual(systemInfo.MetricInfo.UnitName, actualMetricNameUnitMap[systemInfo.MetricInfo.MetricsName]); + } + + if(!systemInfo.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.IsThreadStarvingName) && + !systemInfo.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.ThreadWaitIntervalInMsName)) + { + Assert.IsTrue(systemInfo.MetricInfo.Count > 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Count is not greater than 0"); + Assert.IsNotNull(systemInfo.MetricInfo.Percentiles, $"Percentiles is null for metrics ({systemInfo.MetricInfo.MetricsName})"); + } + Assert.IsTrue(systemInfo.MetricInfo.Mean >= 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Mean is not greater than or equal to 0"); + Assert.IsTrue(systemInfo.MetricInfo.Max >= 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Max is not greater than or equal to 0"); + Assert.IsTrue(systemInfo.MetricInfo.Min >= 0, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Min is not greater than or equal to 0"); + if (systemInfo.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.CpuName)) + { + Assert.IsTrue(systemInfo.MetricInfo.Mean <= 100, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Mean is not greater than 100 for CPU Usage"); + Assert.IsTrue(systemInfo.MetricInfo.Max <= 100, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Max is not greater than 100 for CPU Usage"); + Assert.IsTrue(systemInfo.MetricInfo.Min <= 100, $"MetricInfo ({systemInfo.MetricInfo.MetricsName}) Min is not greater than 100 for CPU Usage"); + }; + } + + Assert.IsTrue(expectedMetricNameUnitMap.EqualsTo(actualMetricNameUnitMap), $"Actual System Information metric i.e {string.Join(", ", actualMetricNameUnitMap)} is not matching with expected System Information Metric i.e. {string.Join(", ", expectedMetricNameUnitMap)}"); + + } + + private static void AssertOperationLevelInformation( + Microsoft.Azure.Cosmos.ConsistencyLevel? expectedConsistencyLevel, + IDictionary expectedOperationRecordCountMap, + List actualOperationList, + int expectedSubstatuscode = 0) + { + IDictionary actualOperationRecordCountMap = new Dictionary(); + // Asserting If operation list is as expected + foreach (OperationInfo operation in actualOperationList) + { + Assert.IsNotNull(operation.Operation, "Operation Type is null"); + Assert.IsNotNull(operation.Resource, "Resource Type is null"); + + Assert.AreEqual(expectedSubstatuscode, operation.SubStatusCode); + Assert.AreEqual(expectedConsistencyLevel?.ToString(), operation.Consistency, $"Consistency is not {expectedConsistencyLevel}"); + + Assert.IsNotNull(operation.MetricInfo, "MetricInfo is null"); + Assert.IsNotNull(operation.MetricInfo.MetricsName, "MetricsName is null"); + Assert.IsNotNull(operation.MetricInfo.UnitName, "UnitName is null"); + Assert.IsNotNull(operation.MetricInfo.Percentiles, "Percentiles is null"); + Assert.IsTrue(operation.MetricInfo.Count > 0, "MetricInfo Count is not greater than 0"); + Assert.IsTrue(operation.MetricInfo.Mean >= 0, "MetricInfo Mean is not greater than or equal to 0"); + Assert.IsTrue(operation.MetricInfo.Max >= 0, "MetricInfo Max is not greater than or equal to 0"); + Assert.IsTrue(operation.MetricInfo.Min >= 0, "MetricInfo Min is not greater than or equal to 0"); + if (operation.MetricInfo.MetricsName.Equals(ClientTelemetryOptions.RequestLatencyName)) // putting this condition to avoid doubling of count as we have same information for each metrics + { + if (!actualOperationRecordCountMap.TryGetValue(operation.Operation.ToString(), out long recordCount)) + { + actualOperationRecordCountMap.Add(operation.Operation.ToString(), operation.MetricInfo.Count); + } + else + { + actualOperationRecordCountMap.Remove(operation.Operation.ToString()); + actualOperationRecordCountMap.Add(operation.Operation.ToString(), recordCount + operation.MetricInfo.Count); + } + } + } + + if (expectedOperationRecordCountMap != null) + { + Assert.IsTrue(expectedOperationRecordCountMap.EqualsTo(actualOperationRecordCountMap), $"actual record i.e. ({actualOperationRecordCountMap}) for operation does not match with expected record i.e. ({expectedOperationRecordCountMap})"); + } + } + + private static void AssertAccountLevelInformation( + List localCopyOfActualInfo, + List actualOperationList, + List actualSystemInformation, + List actualRequestInformation, + bool? isAzureInstance) + { + ISet machineId = new HashSet(); + + // Asserting If basic client telemetry object is as expected + foreach (ClientTelemetryProperties telemetryInfo in localCopyOfActualInfo) + { + if (telemetryInfo.OperationInfo != null) + { + actualOperationList.AddRange(telemetryInfo.OperationInfo); + } + + if (telemetryInfo.SystemInfo != null) + { + foreach (SystemInfo sysInfo in telemetryInfo.SystemInfo) + { + actualSystemInformation.Add(sysInfo); + } + } + + if (telemetryInfo.RequestInfo != null) + { + actualRequestInformation.AddRange(telemetryInfo.RequestInfo); + } + + if (telemetryInfo.ConnectionMode == ConnectionMode.Direct.ToString().ToUpperInvariant()) + { + Assert.AreEqual(6, telemetryInfo.SystemInfo.Count, $"System Information Count doesn't Match; {JsonConvert.SerializeObject(telemetryInfo.SystemInfo)}"); + } + else + { + Assert.AreEqual(5, telemetryInfo.SystemInfo.Count, $"System Information Count doesn't Match; {JsonConvert.SerializeObject(telemetryInfo.SystemInfo)}"); + } + + Assert.IsNotNull(telemetryInfo.GlobalDatabaseAccountName, "GlobalDatabaseAccountName is null"); + Assert.IsNotNull(telemetryInfo.DateTimeUtc, "Timestamp is null"); + Assert.AreEqual(2, telemetryInfo.PreferredRegions.Count); + Assert.AreEqual("region1", telemetryInfo.PreferredRegions[0]); + Assert.AreEqual("region2", telemetryInfo.PreferredRegions[1]); + Assert.AreEqual(1, telemetryInfo.AggregationIntervalInSec); + Assert.IsNull(telemetryInfo.AcceleratedNetworking); + Assert.IsNotNull(telemetryInfo.ClientId); + Assert.IsNotNull(telemetryInfo.ProcessId); + Assert.AreEqual(HashingExtension.ComputeHash(System.Diagnostics.Process.GetCurrentProcess().ProcessName), telemetryInfo.ProcessId); + Assert.IsNotNull(telemetryInfo.UserAgent); + Assert.IsFalse(telemetryInfo.UserAgent.Contains("userAgentSuffix"), "Useragent should not have suffix appended"); // Useragent should not contain useragentsuffix as it can have PII + Assert.IsNotNull(telemetryInfo.ConnectionMode); + + if(!string.IsNullOrEmpty(telemetryInfo.MachineId)) + { + machineId.Add(telemetryInfo.MachineId); + } + } + + if(isAzureInstance.HasValue) + { + if (isAzureInstance.Value) + { + Assert.AreEqual($"{VmMetadataApiHandler.VmIdPrefix}{"d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd"}", machineId.First(), $"Generated Machine id is : {machineId.First()}"); + } + else + { + Assert.AreNotEqual($"{VmMetadataApiHandler.VmIdPrefix}{"d0cb93eb-214b-4c2b-bd3d-cc93e90d9efd"}", machineId.First(), $"Generated Machine id is : {machineId.First()}"); + Assert.AreEqual(1, machineId.Count, $"Multiple Machine Id has been generated i.e {JsonConvert.SerializeObject(machineId)}"); + } + } + } + + + private static void AssertCacheRefreshInfoInformation( + HashSet cacheRefreshInfoSet, + string expectedCacheSource) + { + foreach(CacheRefreshInfo cacheRefreshInfo in cacheRefreshInfoSet) + { + Assert.IsNotNull(cacheRefreshInfo.CacheRefreshSource); + Assert.IsTrue(expectedCacheSource.Contains(cacheRefreshInfo.CacheRefreshSource)); + Assert.IsNotNull(cacheRefreshInfo.Operation, "Operation Type is null"); + Assert.IsNotNull(cacheRefreshInfo.Resource, "Resource Type is null"); + Assert.IsNotNull(cacheRefreshInfo.StatusCode, "StatusCode is null"); + Assert.IsNotNull(cacheRefreshInfo.SubStatusCode); + Assert.IsNull(cacheRefreshInfo.Consistency); + Assert.IsNotNull(cacheRefreshInfo.ContainerName, "ContainerName is null"); + Assert.IsNotNull(cacheRefreshInfo.MetricInfo, "MetricInfo is null"); + Assert.IsNotNull(cacheRefreshInfo.MetricInfo.MetricsName, "MetricsName is null"); + Assert.IsNotNull(cacheRefreshInfo.MetricInfo.UnitName, "UnitName is null"); + Assert.IsNotNull(cacheRefreshInfo.MetricInfo.Percentiles, "Percentiles is null"); + Assert.IsTrue(cacheRefreshInfo.MetricInfo.Count >= 0, "MetricInfo Count is not greater than 0"); + Assert.IsTrue(cacheRefreshInfo.MetricInfo.Mean >= 0, "MetricInfo Mean is not greater than or equal to 0"); + Assert.IsTrue(cacheRefreshInfo.MetricInfo.Max >= 0, "MetricInfo Max is not greater than or equal to 0"); + Assert.IsTrue(cacheRefreshInfo.MetricInfo.Min >= 0, "MetricInfo Min is not greater than or equal to 0"); + } + } + + private static ItemBatchOperation CreateItem(string itemId) + { + var testItem = new { id = itemId, Status = itemId }; + return new ItemBatchOperation(Documents.OperationType.Create, 0, new Cosmos.PartitionKey(itemId), itemId, TestCommon.SerializerCore.ToStream(testItem)); + } + + private async Task CreateClientAndContainer(ConnectionMode mode, + Microsoft.Azure.Cosmos.ConsistencyLevel? consistency = null, + bool isLargeContainer = false, + bool isAzureInstance = false, + HttpClientHandlerHelper customHttpHandler = null) + { + if (consistency.HasValue) + { + this.cosmosClientBuilder = this.cosmosClientBuilder + .WithConsistencyLevel(consistency.Value); + } + + HttpClientHandlerHelper handlerHelper; + if (customHttpHandler == null) + { + handlerHelper = isAzureInstance ? this.httpHandler : this.httpHandlerForNonAzureInstance; + } + else + { + handlerHelper = customHttpHandler; + } + + this.cosmosClientBuilder = this.cosmosClientBuilder + .WithHttpClientFactory(() => new HttpClient(handlerHelper)) + .WithApplicationName("userAgentSuffix"); + + this.SetClient(mode == ConnectionMode.Gateway + ? this.cosmosClientBuilder.WithConnectionModeGateway().Build() + : this.cosmosClientBuilder.Build()); + + this.database = await this.GetClient().CreateDatabaseAsync(Guid.NewGuid().ToString()); + + return await this.database.CreateContainerAsync( + id: Guid.NewGuid().ToString(), + partitionKeyPath: "/id", + throughput: isLargeContainer? 15000 : 400); + + } + + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs index 1f419c4eb8..c8a9a0aff7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ClientTests.cs @@ -486,7 +486,6 @@ public async Task Verify_CertificateCallBackGetsCalled_ForTCP_HTTP() { await database?.DeleteStreamAsync(); } - } [TestMethod] @@ -878,7 +877,7 @@ public async Task HttpClientConnectionLimitTest() )) { CosmosHttpClient cosmosHttpClient = cosmosClient.DocumentClient.httpClient; - HttpClientHandler httpClientHandler = (HttpClientHandler)cosmosHttpClient.HttpMessageHandler; + SocketsHttpHandler httpClientHandler = (SocketsHttpHandler)cosmosHttpClient.HttpMessageHandler; Assert.AreEqual(gatewayConnectionLimit, httpClientHandler.MaxConnectionsPerServer); Cosmos.Database database = await cosmosClient.CreateDatabaseAsync(Guid.NewGuid().ToString()); @@ -895,7 +894,7 @@ public async Task HttpClientConnectionLimitTest() await Task.WhenAll(creates); - // Clean up the database and container + // Clean up the database await database.DeleteAsync(); } @@ -907,6 +906,20 @@ public async Task HttpClientConnectionLimitTest() $"Before connections: {JsonConvert.SerializeObject(excludeConnections)}; After connections: {JsonConvert.SerializeObject(afterConnections)}"); } + [TestMethod] + public void PooledConnectionLifetimeTest() + { + //Create Cosmos Client + using CosmosClient cosmosClient = new CosmosClient( + accountEndpoint: "https://localhost:8081", + authKeyOrResourceToken: Convert.ToBase64String(Encoding.UTF8.GetBytes(Guid.NewGuid().ToString()))); + + //Assert type of message handler + Type socketHandlerType = Type.GetType("System.Net.Http.SocketsHttpHandler, System.Net.Http"); + Type clientMessageHandlerType = cosmosClient.ClientContext.DocumentClient.httpClient.HttpMessageHandler.GetType(); + Assert.AreEqual(socketHandlerType, clientMessageHandlerType); + } + public static IReadOnlyList GetActiveConnections() { string testPid = Process.GetCurrentProcess().Id.ToString(); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ComputedPropertyComparer.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ComputedPropertyComparer.cs new file mode 100644 index 0000000000..486e785978 --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ComputedPropertyComparer.cs @@ -0,0 +1,45 @@ +namespace Microsoft.Azure.Cosmos +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Diagnostics.CodeAnalysis; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + class ComputedPropertyComparer : IEqualityComparer + { + public static void AssertAreEqual(Collection expected, Collection actual) + { + int expectedCount = expected?.Count ?? 0; + int actualCount = actual?.Count ?? 0; + Assert.AreEqual(expectedCount, actualCount); + + for (int i = 0; i < expectedCount; i++) + { + AssertAreEqual(expected[i], actual[i]); + } + } + + public static void AssertAreEqual(ComputedProperty expected, ComputedProperty actual) + { + ComputedPropertyComparer comparer = new ComputedPropertyComparer(); + Assert.IsTrue(comparer.Equals(expected, actual), $"Expected: {ToString(expected)}{Environment.NewLine}Actual:{ToString(actual)}"); + } + + private static string ToString(ComputedProperty computedProperty) => $@"""Name"":""{computedProperty.Name}"", ""Query"":""{computedProperty.Query}"""; + + public bool Equals(ComputedProperty x, ComputedProperty y) + { + if (x == null) return y == null; + if (y == null) return false; + + return (x.Name?.Equals(y.Name) == true) && + (x.Query?.Equals(y.Query) == true); + } + + public int GetHashCode([DisallowNull] ComputedProperty obj) + { + return obj.GetHashCode(); + } + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ComputedPropertyTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ComputedPropertyTests.cs new file mode 100644 index 0000000000..a2c7f552ee --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/ComputedPropertyTests.cs @@ -0,0 +1,549 @@ +namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests +{ + using System; + using System.Collections.Generic; + using System.Collections.ObjectModel; + using System.Diagnostics; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + using global::Azure; + using Microsoft.Azure.Cosmos.CosmosElements; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class ComputedPropertyTests + { + private static readonly CosmosClient cosmosClient; + private static readonly Database database; + + private static readonly ComputedProperty LowerName; + private static readonly ComputedProperty ParentsFullName; + private static readonly Collection AllComputedProperties; + + private static readonly IndexingPolicy IndexAllComputedProperties_IncludeAll; + private static readonly IndexingPolicy IndexAllComputedProperties_ExcludeAll; + private static readonly IndexingPolicy IndexDefault_IncludeAll; + private static readonly IndexingPolicy IndexDefault_ExcludeAll; + + private static readonly string SelectAllComputedPropertiesQuery; + private static readonly List AllComputedPropertiesResult; + private static readonly List EmptyResult; + + static ComputedPropertyTests() + { + cosmosClient = TestCommon.CreateCosmosClient(); + database = cosmosClient.CreateDatabaseAsync(Guid.NewGuid().ToString()).Result; + + LowerName = new ComputedProperty + { + Name = "lowerLastName", + Query = "SELECT VALUE LOWER(IS_DEFINED(c.lastName) ? c.lastName : c.parents[0].familyName) FROM c" + }; + ParentsFullName = new ComputedProperty + { + Name = "parentsFullName", + Query = "SELECT VALUE CONCAT(CONCAT(c.parents[0].firstName, ' ', c.lastName), ' & ', CONCAT(c.parents[1].firstName, ' ', c.lastName)) FROM c" + }; + AllComputedProperties = new Collection { { LowerName }, { ParentsFullName } }; + + IndexAllComputedProperties_IncludeAll = new IndexingPolicy + { + IncludedPaths = new Collection + { + { new IncludedPath { Path = $"/{LowerName.Name}/*" } }, + { new IncludedPath { Path = $"/{ParentsFullName.Name}/*" } }, + { new IncludedPath { Path = $"/*" } }, + } + }; + IndexAllComputedProperties_ExcludeAll = new IndexingPolicy + { + IncludedPaths = new Collection + { + { new IncludedPath { Path = $"/{LowerName.Name}/*" } }, + { new IncludedPath { Path = $"/{ParentsFullName.Name}/*" } }, + }, + ExcludedPaths = new Collection + { + { new ExcludedPath { Path = $"/*" } } + } + }; + IndexDefault_IncludeAll = new IndexingPolicy + { + IncludedPaths = new Collection + { + { new IncludedPath { Path = $"/*" } }, + } + }; + IndexDefault_ExcludeAll = new IndexingPolicy + { + ExcludedPaths = new Collection + { + { new ExcludedPath { Path = $"/*" } } + } + }; + + SelectAllComputedPropertiesQuery = @"SELECT c.lowerLastName, c.parentsFullName FROM c"; + AllComputedPropertiesResult = new List + { + $@"{{{Environment.NewLine} ""lowerLastName"": ""andersen"",{Environment.NewLine} ""parentsFullName"": ""Thomas Andersen & Mary Kay Andersen""{Environment.NewLine}}}", + $@"{{{Environment.NewLine} ""lowerLastName"": ""wakefield""{Environment.NewLine}}}" + }; + EmptyResult = new List + { + @"{}", + @"{}" + }; + } + + [ClassCleanup] + public static async Task Cleanup() + { + await database?.DeleteAsync(); + } + + [Ignore] + [TestMethod] + public async Task TestComputedProperties() + { + TestVariation[] variations = new TestVariation[] + { + ///////////////// + // Create tests + ///////////////// + new TestVariation + { + Description = "V1: null; V2: Empty", + V1 = new ContainerState + { + ComputedProperties = null, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + }, + V2 = new ContainerState + { + ComputedProperties = new Collection(), + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + } + }, + new TestVariation + { + Description = "V1: default; V2: All computed properties, no indexing", + V1 = new ContainerState(), + V2 = new ContainerState + { + ComputedProperties = AllComputedProperties, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + } + }, + new TestVariation + { + Description = "V1: default; V2: All computed properties, indexed, exclude /*", + V1 = new ContainerState(), + V2 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexAllComputedProperties_ExcludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + } + }, + new TestVariation + { + Description = "V1: default; V2: All computed properties, indexed, include /*", + V1 = new ContainerState(), + V2 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexAllComputedProperties_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + }, + new TestVariation + { + Description = "V1: default; V2: All computed properties, not indexed, exclude /*", + V1 = new ContainerState(), + V2 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexDefault_ExcludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + }, + new TestVariation + { + Description = "V1: default; V2: All computed properties, not indexed, include /*", + V1 = new ContainerState(), + V2 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + } + }, + new TestVariation + { + Description = "V1: one computed property; V2: All computed properties, not indexed, include /*", + V1 = new ContainerState() + { + ComputedProperties = new Collection{ LowerName }, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = new List + { + $@"{{{Environment.NewLine} ""lowerLastName"": ""andersen""{Environment.NewLine}}}", + $@"{{{Environment.NewLine} ""lowerLastName"": ""wakefield""{Environment.NewLine}}}" + } + }, + V2 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + } + }, + + ///////////////// + // Replace tests + ///////////////// + new TestVariation + { + Description = "V1: one computed property; V2: other computed property, not indexed, include /*", + V1 = new ContainerState() + { + ComputedProperties = new Collection{ LowerName }, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = new List + { + $@"{{{Environment.NewLine} ""lowerLastName"": ""andersen""{Environment.NewLine}}}", + $@"{{{Environment.NewLine} ""lowerLastName"": ""wakefield""{Environment.NewLine}}}" + } + }, + V2 = new ContainerState + { + ComputedProperties = new Collection{ ParentsFullName }, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = new List + { + $@"{{{Environment.NewLine} ""parentsFullName"": ""Thomas Andersen & Mary Kay Andersen""{Environment.NewLine}}}", + @"{}" + } + } + }, + new TestVariation + { + Description = "V1: one computed property; V2: updated computed property definition, not indexed, include /*", + V1 = new ContainerState() + { + ComputedProperties = new Collection{ LowerName }, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = new List + { + $@"{{{Environment.NewLine} ""lowerLastName"": ""andersen""{Environment.NewLine}}}", + $@"{{{Environment.NewLine} ""lowerLastName"": ""wakefield""{Environment.NewLine}}}" + } + }, + V2 = new ContainerState + { + ComputedProperties = new Collection + { + new ComputedProperty + { + Name = "lowerLastName", + Query = "SELECT VALUE LOWER(c.lastName) FROM c" + } + }, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = new List + { + $@"{{{Environment.NewLine} ""lowerLastName"": ""andersen""{Environment.NewLine}}}", + @"{}" + } + } + }, + + ///////////////// + // Drop tests + ///////////////// + new TestVariation + { + Description = "V1: All computed properties; V2: null", + V1 = new ContainerState + { + ComputedProperties = AllComputedProperties, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + V2 = new ContainerState + { + ComputedProperties = null, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + } + }, + new TestVariation + { + Description = "V1: All computed properties; V2: only 1 computed property", + V1 = new ContainerState + { + ComputedProperties = AllComputedProperties, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + V2 = new ContainerState + { + ComputedProperties = new Collection{ LowerName }, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = new List + { + $@"{{{Environment.NewLine} ""lowerLastName"": ""andersen""{Environment.NewLine}}}", + $@"{{{Environment.NewLine} ""lowerLastName"": ""wakefield""{Environment.NewLine}}}" + } + } + }, + new TestVariation + { + Description = "V1: All computed properties, indexed, exclude /*; V2: null", + V1 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexAllComputedProperties_ExcludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + V2 = new ContainerState + { + ComputedProperties = null, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + } + }, + new TestVariation + { + Description = "V1: All computed properties, indexed, include /*; V2: null", + V1 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexAllComputedProperties_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + V2 = new ContainerState + { + ComputedProperties = null, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + } + }, + new TestVariation + { + Description = "V1: All computed properties, not indexed, exclude /*; V2: null", + V1 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexDefault_ExcludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + V2 = new ContainerState + { + ComputedProperties = null, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + } + }, + new TestVariation + { + Description = "V1: All computed properties, not indexed, include /*; V2: null", + V1 = new ContainerState + { + ComputedProperties = AllComputedProperties, + IndexingPolicy = IndexDefault_IncludeAll, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = AllComputedPropertiesResult + }, + V2 = new ContainerState + { + ComputedProperties = null, + Query = SelectAllComputedPropertiesQuery, + ExpectedDocuments = EmptyResult + } + } + }; + + int i = 0; + foreach (TestVariation variation in variations) + { + Console.WriteLine($"Variation {i++} : {variation.Description}"); + await this.RunTest(variation); + } + } + + private async Task RunTest(TestVariation variation) + { + Container container = await this.CreateOrReplace(container: null, containerState: variation.V1); + return await this.CreateOrReplace(container, containerState: variation.V2); + } + + private async Task CreateOrReplace(Container container, ContainerState containerState) + { + ContainerProperties containerProperties = new ContainerProperties(container?.Id ?? Guid.NewGuid().ToString(), "/id") + { + IndexingPolicy = containerState.IndexingPolicy ?? new IndexingPolicy(), + ComputedProperties = containerState.ComputedProperties ?? new Collection(), + }; + + ContainerResponse response = container == null ? + await database.CreateContainerAsync(containerProperties) : + await container.ReplaceContainerAsync(containerProperties); + + this.ValidateComputedProperties(containerState.ComputedProperties, response.Resource.ComputedProperties); + + if (container == null) + { + await this.InsertDocuments(response.Container); + } + else + { + // Sometimes the container changes are not immediately reflected in the query. + // We force a insert-delete after container replacement, which seems to help with this problem. + // If this still doesn't help with the flakiness, we need to find other ways of running the query scenario. + // One alternative is to wait for V2 for all test variations to take effect + // and then run queries separately on each container. + await this.DeleteReinsertDocuments(response.Container); + } + + if (!string.IsNullOrEmpty(containerState.Query)) + { + List results = await this.QueryItems(response.Container, containerState.Query); + + Assert.AreEqual(containerState.ExpectedDocuments.Count, results.Count); + for (int i = 0; i < containerState.ExpectedDocuments.Count; i++) + { + Assert.AreEqual(containerState.ExpectedDocuments[i], results[i]); + } + } + + return response.Container; + } + + private async Task DeleteReinsertDocuments(Container container) + { + foreach (CosmosObject document in Documents) + { + string id = ((CosmosString)document["id"]).Value; + await container.DeleteItemAsync(id, new PartitionKey(id)); + } + + await this.InsertDocuments(container); + } + + private async Task InsertDocuments(Container container) + { + foreach(CosmosObject document in Documents) + { + await container.CreateItemAsync(document); + } + } + + private async Task> QueryItems(Container container, string query) + { + List results = new List(); + FeedIterator iterator = container.GetItemQueryIterator(query); + do + { + FeedResponse page = await iterator.ReadNextAsync(); + results.AddRange(page.Select(item => item.ToString())); + } while (iterator.HasMoreResults); + + return results; + } + + private void ValidateComputedProperties(Collection expected, Collection actual) + { + ComputedPropertyComparer.AssertAreEqual(expected, actual); + } + + private class TestVariation + { + public string Description { get; set; } + public ContainerState V1 { get; set; } + public ContainerState V2 { get; set; } + } + + private class ContainerState + { + public Collection ComputedProperties { get; set; } + public IndexingPolicy IndexingPolicy { get; set; } + public List ExpectedDocuments { get; set; } + public string Query { get; set; } + } + + private static readonly CosmosObject AndersenFamily = CosmosObject.Parse(@" + { + ""id"": ""AndersenFamily"", + ""lastName"": ""Andersen"", + ""parents"": [ + { ""firstName"": ""Thomas"" }, + { ""firstName"": ""Mary Kay""} + ], + ""children"": [ + { + ""firstName"": ""Henriette Thaulow"", + ""gender"": ""female"", + ""grade"": 5, + ""pets"": [{ ""givenName"": ""Fluffy"" }] + } + ], + ""address"": { ""state"": ""WA"", ""county"": ""King"", ""city"": ""seattle"" }, + ""creationDate"": 1431620472, + ""isRegistered"": true, + ""_rid"": ""0fomAIxnukU1AQAAAAAAAA=="" + }"); + + private static readonly CosmosObject WakefieldFamily = CosmosObject.Parse(@" + { + ""id"": ""WakefieldFamily"", + ""parents"": [ + { ""familyName"": ""Wakefield"", ""givenName"": ""Robin"" }, + { ""familyName"": ""Miller"", ""givenName"": ""Ben"" } + ], + ""children"": [ + { + ""familyName"": ""Merriam"", + ""givenName"": ""Jesse"", + ""gender"": ""female"", ""grade"": 1, + ""pets"": [ + { ""givenName"": ""Goofy"" }, + { ""givenName"": ""Shadow"" } + ] + }, + { + ""familyName"": ""Miller"", + ""givenName"": ""Lisa"", + ""gender"": ""female"", + ""grade"": 8 } + ], + ""address"": { ""state"": ""NY"", ""county"": ""Manhattan"", ""city"": ""NY"" }, + ""creationDate"": 1431620462, + ""isRegistered"": false, + ""_rid"": ""0fomAIxnukU1AQAAAAAAAB=="" + }"); + + private static readonly CosmosElement[] Documents = new CosmosElement[] + { + AndersenFamily, + WakefieldFamily, + }; + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs index c5d6347dd1..b237c68c2a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosItemTests.cs @@ -1984,7 +1984,6 @@ public async Task ItemPatchSuccessTest() patchOperations.Clear(); patchOperations.Add(PatchOperation.Add("/children/0/cost", 1)); - //patchOperations.Add(PatchOperation.Set("/random", value)); // with content response response = await containerInternal.PatchItemAsync( id: testItem.id, @@ -2006,6 +2005,22 @@ public async Task ItemPatchSuccessTest() Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); Assert.IsNotNull(response.Resource); Assert.AreEqual(null, response.Resource.children[0].id); + + patchOperations.Clear(); + patchOperations.Add(PatchOperation.Add("/children/1/description","Child#1")); + patchOperations.Add(PatchOperation.Move("/children/0/description", "/description")); + patchOperations.Add(PatchOperation.Move("/children/1/description", "/children/0/description")); + // with content response + response = await containerInternal.PatchItemAsync( + id: testItem.id, + partitionKey: new Cosmos.PartitionKey(testItem.pk), + patchOperations: patchOperations); + + Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); + Assert.IsNotNull(response.Resource); + Assert.AreEqual("testSet", response.Resource.description); + Assert.AreEqual("Child#1", response.Resource.children[0].description); + Assert.IsNull(response.Resource.children[1].description); } [TestMethod] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs index 9de85f9f7e..8eb72cac25 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Fluent/ContainerSettingsTests.cs @@ -7,6 +7,7 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using System; + using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; using System.Linq; @@ -98,6 +99,11 @@ public async Task ContainerContractTest() } } }, + // ComputedProperties = new Collection + // { + // { new ComputedProperty{ Name = "lowerName", Query = "SELECT VALUE LOWER(c.Name) FROM c" } }, + // { new ComputedProperty{ Name = "fullName", Query = "SELECT VALUE CONCAT(c.Name, ' ', c.LastName) FROM c" } } + // }, ClientEncryptionPolicy = new ClientEncryptionPolicy(paths) }; @@ -140,6 +146,129 @@ public async Task ContainerContractTest() Assert.IsTrue(responseProperties.ClientEncryptionPolicy.PolicyFormatVersion <= 2); ClientEncryptionIncludedPath clientEncryptionIncludedPath = responseProperties.ClientEncryptionPolicy.IncludedPaths.First(); Assert.IsTrue(this.VerifyClientEncryptionIncludedPath(clientEncryptionIncludedPath1, clientEncryptionIncludedPath)); + + ComputedPropertyComparer.AssertAreEqual(containerProperties.ComputedProperties, responseProperties.ComputedProperties); + ComputedPropertyComparer.AssertAreEqual(containerProperties.ComputedProperties, deserialziedTest.ComputedProperties); + } + + [Ignore] + [TestMethod] + public async Task ContainerNegativeComputedPropertyTest() + { + string query = "SELECT VALUE LOWER(c.name) FROM c"; + var variations = new[] + { + new + { + ComputedProperties = new Collection + { + new ComputedProperty {Name = "lowerName", Query = @"SELECT VALUE LOWER(c.name) FROM c"}, + new ComputedProperty {Name = "lowerName", Query = @"SELECT VALUE LOWER(c.lastName) FROM c"} + }, + Error = @"""Errors"":[""Computed property name 'lowerName' cannot be used in multiple definitions.""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty { Query = query } }, + Error = @"""Errors"":[""One of the specified inputs is invalid""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty { Name = "", Query = query } }, + Error = @"""Errors"":[""Computed property 'name' is either empty or unspecified.""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty { Name = "lowerName" } }, + Error = @"""Errors"":[""One of the specified inputs is invalid""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty { Name = "lowerName", Query = "" } }, + Error = @"""Errors"":[""Computed property 'query' is either empty or unspecified.""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty { Name = "id", Query = query } }, + Error = @"""Errors"":[""The system property name 'id' cannot be used as a computed property name.""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty { Name = "spatial", Query = query } }, + Error = @"""Errors"":[""Computed property 'spatial' at index (0) has a spatial index. Remove the spatial index on this path.""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty {Name = "lowerName", Query = @"SELECT LOWER(c.name) FROM c"} }, + Error = @"""Errors"":[""Required VALUE expression missing from computed property query 'SELECT LOWER(c.name) FROM c' at index (0).""]" + }, + new + { + ComputedProperties = new Collection{ new ComputedProperty {Name = "lowerName", Query = @"SELECT LOWER(c.name) FROM r"} }, + Error = @"""Errors"":[""Computed property at index (0) has a malformed query: 'SELECT LOWER(c.name) FROM r' Error details: '{\""errors\"":[{\""severity\"":\""Error\"",\""code\"":2001,\""message\"":\""Identifier 'c' could not be resolved.\""}]}'""]" + }, + }; + + IndexingPolicy indexingPolicy = new IndexingPolicy + { + SpatialIndexes = new Collection + { + new SpatialPath + { + Path = "/spatial/*", + SpatialTypes = new Collection() + { + Cosmos.SpatialType.LineString, + Cosmos.SpatialType.MultiPolygon, + Cosmos.SpatialType.Point, + Cosmos.SpatialType.Polygon, + } + } + } + }; + + // Create + foreach (var variation in variations) + { + ContainerProperties containerProperties = new ContainerProperties(Guid.NewGuid().ToString(), "/users") + { + IndexingPolicy = indexingPolicy, + GeospatialConfig = new GeospatialConfig(GeospatialType.Geography), + ComputedProperties = variation.ComputedProperties + }; + + try + { + ContainerResponse response = await this.database.CreateContainerAsync(containerProperties); + Assert.Fail($@"Computed Property '{variation.ComputedProperties.Last().Name}' Query '{variation.ComputedProperties.Last().Query}' was expected to fail with error '{variation.Error}'."); + } + catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.BadRequest) + { + Assert.IsTrue(ce.Message.Contains(variation.Error), $"Message expected to contain:'{variation.Error}'{Environment.NewLine}Actual Message: '{ce.Message}'"); + } + } + + // Replace + Container containerToReplace = await this.database.CreateContainerAsync(new ContainerProperties(Guid.NewGuid().ToString(), "/users")); + foreach (var variation in variations) + { + ContainerProperties containerProperties = new ContainerProperties(Guid.NewGuid().ToString(), "/users") + { + IndexingPolicy = indexingPolicy, + GeospatialConfig = new GeospatialConfig(GeospatialType.Geography), + ComputedProperties = variation.ComputedProperties + }; + + try + { + ContainerResponse response = await containerToReplace.ReplaceContainerAsync(containerProperties); + Assert.Fail($@"Computed Property '{variation.ComputedProperties.Last().Name}' Query '{variation.ComputedProperties.Last().Query}' was expected to fail with error '{variation.Error}'."); + } + catch (CosmosException ce) when (ce.StatusCode == HttpStatusCode.BadRequest) + { + Assert.IsTrue(ce.Message.Contains(variation.Error), $"Message expected to contain:'{variation.Error}'{Environment.NewLine}Actual Message: '{ce.Message}'"); + } + } } [TestMethod] @@ -230,6 +359,17 @@ public async Task ContainerMigrationTest() SpatialTypes = new Collection() { SpatialType.Point } }); + // List computedProperties = new List + // { + // new ComputedProperty() { Name = "lowerName", Query = "SELECT VALUE LOWER(c.name) FROM c" }, + // new ComputedProperty() { Name = "estimatedTax", Query = "SELECT VALUE c.salary * 0.2 FROM c" } + // }; + + // foreach (ComputedProperty computedProperty in computedProperties) + // { + // containerProperties.ComputedProperties.Add(computedProperty); + // } + ContainerProperties propertiesAfterReplace = await container.ReplaceContainerAsync(containerProperties); Assert.AreEqual(0, propertiesAfterReplace.IndexingPolicy.IncludedPaths.First().Indexes.Count); Assert.AreEqual(1, propertiesAfterReplace.IndexingPolicy.CompositeIndexes.Count); @@ -242,6 +382,8 @@ public async Task ContainerMigrationTest() Assert.AreEqual(1, propertiesAfterReplace.IndexingPolicy.SpatialIndexes.Count); Assert.AreEqual("/address/test/*", propertiesAfterReplace.IndexingPolicy.SpatialIndexes.First().Path); + + ComputedPropertyComparer.AssertAreEqual(containerProperties.ComputedProperties, propertiesAfterReplace.ComputedProperties); } [TestMethod] @@ -449,6 +591,52 @@ await this.database.DefineContainer(containerName, partitionKeyPath) Assert.AreEqual(HttpStatusCode.NoContent, containerResponse.StatusCode); } + [Ignore] + [TestMethod] + public async Task WithComputedProperties() + { + string containerName = Guid.NewGuid().ToString(); + string partitionKeyPath = "/users"; + + var definitions = new[] + { + new { Name = "lowerName", Query = "SELECT VALUE LOWER(c.name) FROM c" }, + new { Name = "estimatedTax", Query = "SELECT VALUE c.salary * 0.2 FROM c" } + }; + ContainerResponse containerResponse = + await this.database.DefineContainer(containerName, partitionKeyPath) + .WithComputedProperties() + .WithComputedProperty(definitions[0].Name, definitions[0].Query) + .WithComputedProperty(definitions[1].Name, definitions[1].Query) + .Attach() + .CreateAsync(); + + Assert.AreEqual(HttpStatusCode.Created, containerResponse.StatusCode); + Assert.AreEqual(containerName, containerResponse.Resource.Id); + Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); + + Assert.AreEqual(2, containerResponse.Resource.ComputedProperties.Count); + Assert.AreEqual(definitions[0].Name, containerResponse.Resource.ComputedProperties[0].Name); + Assert.AreEqual(definitions[0].Query, containerResponse.Resource.ComputedProperties[0].Query); + Assert.AreEqual(definitions[1].Name, containerResponse.Resource.ComputedProperties[1].Name); + Assert.AreEqual(definitions[1].Query, containerResponse.Resource.ComputedProperties[1].Query); + + Container container = containerResponse; + containerResponse = await container.ReadContainerAsync(); + Assert.AreEqual(HttpStatusCode.OK, containerResponse.StatusCode); + Assert.AreEqual(containerName, containerResponse.Resource.Id); + Assert.AreEqual(partitionKeyPath, containerResponse.Resource.PartitionKey.Paths.First()); + + Assert.AreEqual(2, containerResponse.Resource.ComputedProperties.Count); + Assert.AreEqual(definitions[0].Name, containerResponse.Resource.ComputedProperties[0].Name); + Assert.AreEqual(definitions[0].Query, containerResponse.Resource.ComputedProperties[0].Query); + Assert.AreEqual(definitions[1].Name, containerResponse.Resource.ComputedProperties[1].Name); + Assert.AreEqual(definitions[1].Query, containerResponse.Resource.ComputedProperties[1].Query); + + containerResponse = await containerResponse.Container.DeleteContainerAsync(); + Assert.AreEqual(HttpStatusCode.NoContent, containerResponse.StatusCode); + } + [TestMethod] public async Task ThroughputTest() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqGeneralBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqGeneralBaselineTests.cs index a9782bb26b..3fc3aff900 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqGeneralBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqGeneralBaselineTests.cs @@ -1272,6 +1272,25 @@ orderby f.FamilyId descending this.ExecuteTestSuite(inputs); } + [TestMethod] + public void TestLambdaReuse() + { + List inputs = new List(); + + System.Linq.Expressions.Expression> predicate = f => f.Int == 5; + inputs.Add(new LinqTestInput("Where -> Where with same predicate instance", b => getQuery(b).Where(predicate).Where(predicate))); + inputs.Add(new LinqTestInput("Where -> Select with same predicate instance", b => getQuery(b).Where(predicate).Select(predicate))); + + System.Linq.Expressions.Expression> predicate2 = f => f.ToString() == "a"; + inputs.Add(new LinqTestInput("Where -> Select -> Where with same predicate instance", + b => getQuery(b) + .Where(predicate2) + .Select(c => new { Int = 10, Result = c }) + .Where(predicate2))); + + this.ExecuteTestSuite(inputs); + } + [TestMethod] public void TestThenByTranslation() { @@ -1922,7 +1941,7 @@ public async Task ValidateLinqQueries() Gender = "female", Grade = 1, Pets = new List() { pet, new Pet() { GivenName = "koko" } }, - Things = new Dictionary() { { "A", "B" }, { "C", "D" } }, + Things = new Dictionary() { { "A", "B" }, { "C", "D" } } }; Address address = new Address { State = "NY", County = "Manhattan", City = "NY" }; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs index 14aadd354f..5a46a2d118 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/LinqTranslationBaselineTests.cs @@ -116,6 +116,7 @@ internal class DataObject : LinqTestObject public int? NullableField; #pragma warning disable CS0649 // Field is never assigned to, and will always have its default value false public bool BooleanField; + public SimpleObject ObjectField = new SimpleObject(); public Guid GuidField; #pragma warning restore // Field is never assigned to, and will always have its default value false @@ -155,6 +156,11 @@ internal class DataObject : LinqTestObject public string Pk; } + internal class SimpleObject + { + public string Field { get; set; } + } + class DateJsonConverter : IsoDateTimeConverter { public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) @@ -257,7 +263,7 @@ public void TestLiteralSerialization() [TestMethod] public void TestTypeCheckFunctions() { - // IsDefined, IsNull, and IsPrimitive are not supported on the client side. + // IsArray, IsBool, IsDefined, IsNull, IsNumber, IsObject, IsPrimitive, and IsString are not supported on the client side. // Partly because IsPrimitive is not trivial to implement. // Therefore these methods are verified with baseline only. List data = new List(); @@ -266,12 +272,22 @@ public void TestTypeCheckFunctions() List inputs = new List { + new LinqTestInput("IsArray array", b => getQuery(b).Where(doc => doc.ArrayField.IsArray())), + new LinqTestInput("IsArray string", b => getQuery(b).Where(doc => doc.StringField.IsArray())), + new LinqTestInput("IsBool bool", b => getQuery(b).Where(doc => doc.BooleanField.IsBool())), + new LinqTestInput("IsBool string", b => getQuery(b).Where(doc => doc.StringField.IsBool())), new LinqTestInput("IsDefined array", b => getQuery(b).Select(doc => doc.ArrayField.IsDefined())), new LinqTestInput("IsDefined string", b => getQuery(b).Where(doc => doc.StringField.IsDefined())), new LinqTestInput("IsNull array", b => getQuery(b).Select(doc => doc.ArrayField.IsNull())), new LinqTestInput("IsNull string", b => getQuery(b).Where(doc => doc.StringField.IsNull())), + new LinqTestInput("IsNumber number", b => getQuery(b).Select(doc => doc.NumericField.IsNumber())), + new LinqTestInput("IsNumber string", b => getQuery(b).Where(doc => doc.StringField.IsNumber())), + new LinqTestInput("IsObject object", b => getQuery(b).Select(doc => doc.ObjectField.IsObject())), + new LinqTestInput("IsObject string", b => getQuery(b).Where(doc => doc.StringField.IsObject())), new LinqTestInput("IsPrimitive array", b => getQuery(b).Select(doc => doc.ArrayField.IsPrimitive())), - new LinqTestInput("IsPrimitive string", b => getQuery(b).Where(doc => doc.StringField.IsPrimitive())) + new LinqTestInput("IsPrimitive string", b => getQuery(b).Where(doc => doc.StringField.IsPrimitive())), + new LinqTestInput("IsString string", b => getQuery(b).Where(doc => doc.StringField.IsString())), + new LinqTestInput("IsString number", b => getQuery(b).Select(doc => doc.NumericField.IsString())), }; this.ExecuteTestSuite(inputs); } @@ -744,15 +760,26 @@ public void TestStringFunctions() new LinqTestInput("IndexOf string w/ startIndex", b => getQuery(b).Select(doc => doc.StringField.IndexOf("str", 0))), // Count new LinqTestInput("Count", b => getQuery(b).Select(doc => doc.StringField.Count())), - // ToLower - new LinqTestInput("ToLower", b => getQuery(b).Select(doc => doc.StringField.ToLower())), - // TrimStart - new LinqTestInput("TrimStart", b => getQuery(b).Select(doc => doc.StringField.TrimStart())), // Replace new LinqTestInput("Replace char", b => getQuery(b).Select(doc => doc.StringField.Replace('c', 'a'))), new LinqTestInput("Replace string", b => getQuery(b).Select(doc => doc.StringField.Replace("str", "str2"))), + // ToLower + new LinqTestInput("ToLower", b => getQuery(b).Select(doc => doc.StringField.ToLower())), + // Trim + new LinqTestInput("Trim", b => getQuery(b).Select(doc => doc.StringField.Trim())), + new LinqTestInput("Trim with Literal", b => getQuery(b).Select(doc => " abc ".Trim())), + new LinqTestInput("Trim with EmptyCharArray", b => getQuery(b).Select(doc => doc.StringField.Trim(new char[]{ }))), + new LinqTestInput("Trim with Literal and EmptyCharArray", b => getQuery(b).Select(doc => " abc ".Trim(new char[]{ }))), // TrimEnd new LinqTestInput("TrimEnd", b => getQuery(b).Select(doc => doc.StringField.TrimEnd())), + new LinqTestInput("TrimEnd with Literal", b => getQuery(b).Select(doc => " abc ".TrimEnd())), + new LinqTestInput("TrimEnd with EmptyCharArray", b => getQuery(b).Select(doc => doc.StringField.TrimEnd(new char[]{ }))), + new LinqTestInput("TrimEnd with Literal and EmptyCharArray", b => getQuery(b).Select(doc => " abc ".TrimEnd(new char[]{ }))), + // TrimStart + new LinqTestInput("TrimStart", b => getQuery(b).Select(doc => doc.StringField.TrimStart())), + new LinqTestInput("TrimStart with Literal", b => getQuery(b).Select(doc => " abc ".TrimStart())), + new LinqTestInput("TrimStart with EmptyCharArray", b => getQuery(b).Select(doc => doc.StringField.TrimStart(new char[]{ }))), + new LinqTestInput("TrimStart with Literal and EmptyCharArray", b => getQuery(b).Select(doc => " abc ".TrimStart(new char[]{ }))), //StartsWith new LinqTestInput("StartsWith", b => getQuery(b).Select(doc => doc.StringField.StartsWith("str"))), new LinqTestInput("String constant StartsWith", b => getQuery(b).Select(doc => "str".StartsWith(doc.StringField))), diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj index 710c582448..eb0e07c4d3 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Microsoft.Azure.Cosmos.EmulatorTests.csproj @@ -34,6 +34,7 @@ + @@ -282,6 +283,11 @@ + + + PreserveNewest + + PreserveNewest diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SummaryDiagnosticsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SummaryDiagnosticsTests.cs index ae94a7220d..1948411400 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SummaryDiagnosticsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/SummaryDiagnosticsTests.cs @@ -128,5 +128,38 @@ public async Task DirectPointOperationsWithTransportErrors() Assert.AreEqual(summaryDiagnostics.DirectRequestsSummary.Value[(410, (int)SubStatusCodes.TransportGenerated410)], 3); Assert.AreEqual(summaryDiagnostics.DirectRequestsSummary.Value[(201, 0)], 1); } + + /// + /// Test to validate that when a read operation is done on a database and a container that + /// does not exists, then the should capture the sub status + /// codes successfully. + /// + [TestMethod] + [Owner("dkunda")] + public async Task SummaryDiagnostics_WhenContainerDoesNotExists_ShouldRecordSubStatusCode() + { + string partitionKey = "/pk"; + int notFoundStatusCode = 404, notFoundSubStatusCode = 1003; + using CosmosClient cosmosClient = TestCommon.CreateCosmosClient(useGateway: false); + + try + { + Container container = cosmosClient.GetContainer( + databaseId: Guid.NewGuid().ToString(), + containerId: Guid.NewGuid().ToString()); + + ItemResponse readResponse = await container.ReadItemAsync( + partitionKey, + new Cosmos.PartitionKey(partitionKey)); + } + catch (CosmosException ex) + { + ITrace trace = ((CosmosTraceDiagnostics)ex.Diagnostics).Value; + SummaryDiagnostics summaryDiagnostics = new(trace); + + Assert.IsNotNull(value: summaryDiagnostics); + Assert.IsTrue(condition: summaryDiagnostics.GatewayRequestsSummary.Value.ContainsKey((notFoundStatusCode, notFoundSubStatusCode))); + } + } } } \ No newline at end of file diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/AssertActivity.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/AssertActivity.cs index d19b330d98..f4983c10a7 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/AssertActivity.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/AssertActivity.cs @@ -32,6 +32,7 @@ public static void IsValid(Activity activity) IList expectedTags = new List { "az.namespace", + "az.schema_url", "kind", "db.system", "db.name", @@ -39,7 +40,7 @@ public static void IsValid(Activity activity) "net.peer.name", "db.cosmosdb.client_id", "db.cosmosdb.machine_id", - "db.cosmosdb.user_agent", + "user_agent.original", "db.cosmosdb.connection_mode", "db.cosmosdb.operation_type", "db.cosmosdb.container", diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/CustomListener.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/CustomListener.cs index 1f192bb086..5f98a6191a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/CustomListener.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/CustomListener.cs @@ -33,15 +33,27 @@ internal class CustomListener : public static ConcurrentBag CollectedActivities { private set; get; } = new(); private static ConcurrentBag CollectedEvents { set; get; } = new(); + private string SourceType { set; get; } + + // Regex is used to match string 'n' against diagnosticNameSpace string + // which is constructed by combining first two parts of name. + // Eg: Azure.Cosmos.Operation where diagnosticNameSpace is Azure.Cosmos and Operation is the sourceType public CustomListener(string name, string eventName) - : this(n => Regex.Match(n, name).Success, eventName) + : this(n => + { + string[] nameParts = name.Split("."); + string diagnosticNameSpace = $"{nameParts[0]}.{nameParts[1]}"; + return Regex.Match(n, diagnosticNameSpace).Success; + }, name.Split(".")[2], eventName) + { } - public CustomListener(Func filter, string eventName) + public CustomListener(Func filter, string sourceType, string eventName) { this.sourceNameFilter = filter; this.eventName = eventName; + this.SourceType = sourceType; DiagnosticListener.AllListeners.Subscribe(this); } @@ -76,6 +88,11 @@ public void OnNext(KeyValuePair value) string stopSuffix = ".Stop"; string exceptionSuffix = ".Exception"; + if(!this.SourceType.Contains("*") && !Activity.Current.OperationName.Contains(this.SourceType)) + { + return; + } + if (value.Key.EndsWith(startSuffix)) { string name = value.Key[..^startSuffix.Length]; @@ -89,7 +106,6 @@ public void OnNext(KeyValuePair value) Links = links.Select(a => new ProducedLink(a.ParentId, a.TraceStateString)).ToList(), LinkedActivities = links.ToList() }; - this.Scopes.Add(scope); } else if (value.Key.EndsWith(stopSuffix)) @@ -100,7 +116,6 @@ public void OnNext(KeyValuePair value) if (producedDiagnosticScope.Activity.Id == Activity.Current.Id) { AssertActivity.IsValid(producedDiagnosticScope.Activity); - CustomListener.CollectedActivities.Add(producedDiagnosticScope.Activity); producedDiagnosticScope.IsCompleted = true; @@ -120,7 +135,6 @@ public void OnNext(KeyValuePair value) { throw new InvalidOperationException("Scope should not be stopped when calling Failed"); } - producedDiagnosticScope.Exception = (Exception)value.Value; } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs index e81eda0d01..ba7e828edf 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Tracing/EndToEndTraceWriterBaselineTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.Azure.Cosmos.EmulatorTests.Tracing using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using static Microsoft.Azure.Cosmos.SDK.EmulatorTests.TransportClientHelper; - + [VisualStudio.TestTools.UnitTesting.TestClass] [TestCategory("UpdateContract")] public sealed class EndToEndTraceWriterBaselineTests : BaselineTests @@ -41,10 +41,14 @@ public sealed class EndToEndTraceWriterBaselineTests : BaselineTests m.GetCustomAttributes(typeof(TestMethodAttribute), false).Length > 0).Count(); + + private static int MethodCount = 0; + + [ClassInitialize] public static async Task ClassInitAsync(TestContext context) { - testListener = Util.ConfigureOpenTelemetryAndCustomListeners(); + EndToEndTraceWriterBaselineTests.testListener = Util.ConfigureOpenTelemetryAndCustomListeners(); client = Microsoft.Azure.Cosmos.SDK.EmulatorTests.TestCommon.CreateCosmosClient( useGateway: false, @@ -88,29 +92,40 @@ public static async Task ClassInitAsync(TestContext context) EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } - [ClassCleanup()] + [TestCleanup] + public async Task CleanUp() + { + await EndToEndTraceWriterBaselineTests.ClassCleanupAsync(); + } + public static async Task ClassCleanupAsync() { - if(database != null) - { - await EndToEndTraceWriterBaselineTests.database.DeleteStreamAsync(); - } + EndToEndTraceWriterBaselineTests.MethodCount++; - Util.DisposeOpenTelemetryAndCustomListeners(); + if (EndToEndTraceWriterBaselineTests.MethodCount == EndToEndTraceWriterBaselineTests.TotalTestMethod) + { + if (database != null) + { + await EndToEndTraceWriterBaselineTests.database.DeleteStreamAsync(); + } + + EndToEndTraceWriterBaselineTests.client?.Dispose(); + EndToEndTraceWriterBaselineTests.bulkClient?.Dispose(); + EndToEndTraceWriterBaselineTests.miscCosmosClient?.Dispose(); - EndToEndTraceWriterBaselineTests.client?.Dispose(); - EndToEndTraceWriterBaselineTests.bulkClient?.Dispose(); - EndToEndTraceWriterBaselineTests.miscCosmosClient?.Dispose(); + Util.DisposeOpenTelemetryAndCustomListeners(); - await Task.Delay(5000); + EndToEndTraceWriterBaselineTests.testListener.Dispose(); + + } } - + private static void AssertAndResetActivityInformation() { AssertActivity.AreEqualAcrossListeners(); CustomOtelExporter.CollectedActivities = new(); - testListener?.ResetAttributes(); + EndToEndTraceWriterBaselineTests.testListener?.ResetAttributes(); } [TestMethod] @@ -147,10 +162,9 @@ public async Task ReadFeedAsync() trace: traceForest, startLineNumber: startLineNumber, endLineNumber: endLineNumber, - oTelActivities: testListener?.GetRecordedAttributes())); + oTelActivities: EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); - } //---------------------------------------------------------------- @@ -178,7 +192,7 @@ public async Task ReadFeedAsync() trace: traceForest, startLineNumber: startLineNumber, endLineNumber: endLineNumber, - oTelActivities: testListener?.GetRecordedAttributes())); + oTelActivities: EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -209,7 +223,7 @@ public async Task ReadFeedAsync() trace: traceForest, startLineNumber: startLineNumber, endLineNumber: endLineNumber, - oTelActivities: testListener?.GetRecordedAttributes())); + oTelActivities: EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -235,7 +249,7 @@ public async Task ReadFeedAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("ReadFeed Public API Typed", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("ReadFeed Public API Typed", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -277,7 +291,7 @@ public async Task ChangeFeedAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("ChangeFeed", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("ChangeFeed", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -309,7 +323,7 @@ public async Task ChangeFeedAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("ChangeFeed Typed", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("ChangeFeed Typed", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -342,7 +356,7 @@ public async Task ChangeFeedAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("ChangeFeed Public API", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("ChangeFeed Public API", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -375,7 +389,7 @@ public async Task ChangeFeedAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("ChangeFeed Public API Typed", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("ChangeFeed Public API Typed", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -436,7 +450,7 @@ public async Task ChangeFeedAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Change Feed Estimator", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Change Feed Estimator", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -472,7 +486,7 @@ public async Task QueryAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -497,7 +511,7 @@ public async Task QueryAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query Typed", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query Typed", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -523,7 +537,7 @@ public async Task QueryAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query Public API", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query Public API", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -549,7 +563,7 @@ public async Task QueryAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query Public API Typed", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query Public API Typed", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -578,7 +592,7 @@ public async Task QueryAsync() Documents.ServiceInteropWrapper.AssembliesExist = currentLazy; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query - Without ServiceInterop", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query - Without ServiceInterop", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -606,7 +620,7 @@ public async Task QueryAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query Public API with FeedRanges", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query Public API with FeedRanges", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -634,7 +648,7 @@ public async Task QueryAsync() ITrace traceForest = TraceJoiner.JoinTraces(traces); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Query Public API Typed with FeedRanges", traceForest, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Query Public API Typed with FeedRanges", traceForest, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -650,9 +664,17 @@ public async Task ValidateInvalidCredentialsTraceAsync() string endpoint = Utils.ConfigurationManager.AppSettings["GatewayEndpoint"]; AzureKeyCredential masterKeyCredential = new AzureKeyCredential(authKey); + + // It is not baseline test hence disable distributed tracing for this test + CosmosClientOptions clientOptions = new CosmosClientOptions() + { + IsDistributedTracingEnabled = false + }; + using (CosmosClient client = new CosmosClient( endpoint, - masterKeyCredential)) + masterKeyCredential, + clientOptions)) { try @@ -705,7 +727,7 @@ public async Task TypedPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Write", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Write", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -723,7 +745,7 @@ public async Task TypedPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Read", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Read", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -749,7 +771,7 @@ public async Task TypedPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Replace", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Replace", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -791,7 +813,7 @@ public async Task TypedPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Delete", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Delete", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -826,7 +848,7 @@ public async Task StreamPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Write", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Write", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -844,7 +866,7 @@ public async Task StreamPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Read", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Read", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -870,7 +892,7 @@ public async Task StreamPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Replace", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Replace", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -915,7 +937,7 @@ public async Task StreamPointOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)itemResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Delete", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Delete", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -964,7 +986,7 @@ public async Task PointOperationsExceptionsAsync() } endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Operation with Request Timeout", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Operation with Request Timeout", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1016,7 +1038,7 @@ public async Task PointOperationsExceptionsAsync() } endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Operation With Throttle", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Operation With Throttle", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1096,7 +1118,7 @@ void interceptor(Uri uri, Documents.ResourceOperation operation, Documents.Docum } endLineNumber = GetLineNumber(); - inputs.Add(new Input($"Point Operation With Forbidden + Max Count = {maxCount}", trace, startLineNumber, endLineNumber, testListener.GetRecordedAttributes())); + inputs.Add(new Input($"Point Operation With Forbidden + Max Count = {maxCount}", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1147,7 +1169,7 @@ void interceptor(Uri uri, Documents.ResourceOperation operation, Documents.Docum } endLineNumber = GetLineNumber(); - inputs.Add(new Input("Point Operation with Service Unavailable", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Point Operation with Service Unavailable", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1198,7 +1220,7 @@ public async Task BatchOperationsAsync() ITrace trace = ((CosmosTraceDiagnostics)response.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Batch Operation", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Batch Operation", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1248,7 +1270,7 @@ public async Task BulkOperationsAsync() foreach (ITrace trace in traces) { - inputs.Add(new Input("Bulk Operation", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Bulk Operation", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); } EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); @@ -1302,7 +1324,7 @@ public async Task BulkOperationsAsync() endLineNumber = GetLineNumber(); - inputs.Add(new Input("Bulk Operation With Throttle", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Bulk Operation With Throttle", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1334,7 +1356,7 @@ public async Task MiscellanousAsync() await databaseResponse.Database.DeleteAsync(); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Custom Handler", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Custom Handler", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1353,7 +1375,7 @@ public async Task MiscellanousAsync() await databaseResponse.Database.DeleteAsync(); endLineNumber = GetLineNumber(); - inputs.Add(new Input("Custom Handler", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Custom Handler", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1382,6 +1404,8 @@ public async Task ReadManyAsync() itemList.Add(("id" + i, new PartitionKey(i.ToString()))); } + EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); + //---------------------------------------------------------------- // Read Many Stream //---------------------------------------------------------------- @@ -1394,7 +1418,7 @@ public async Task ReadManyAsync() } endLineNumber = GetLineNumber(); - inputs.Add(new Input("Read Many Stream Api", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Read Many Stream Api", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } @@ -1409,7 +1433,7 @@ public async Task ReadManyAsync() ITrace trace = ((CosmosTraceDiagnostics)feedResponse.Diagnostics).Value; endLineNumber = GetLineNumber(); - inputs.Add(new Input("Read Many Typed Api", trace, startLineNumber, endLineNumber, testListener?.GetRecordedAttributes())); + inputs.Add(new Input("Read Many Typed Api", trace, startLineNumber, endLineNumber, EndToEndTraceWriterBaselineTests.testListener?.GetRecordedAttributes())); EndToEndTraceWriterBaselineTests.AssertAndResetActivityInformation(); } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/Util.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/Util.cs index 8c71a6b168..59172beb33 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/Util.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/Utils/Util.cs @@ -22,7 +22,8 @@ namespace Microsoft.Azure.Cosmos.SDK.EmulatorTests using Microsoft.VisualStudio.TestTools.UnitTesting; using OpenTelemetry; using OpenTelemetry.Trace; - + using AzureCore = global::Azure.Core; + internal enum DocumentClientType { Gateway, @@ -542,14 +543,16 @@ internal static CustomListener ConfigureOpenTelemetryAndCustomListeners() { AppContext.SetSwitch("Azure.Experimental.EnableActivitySource", true); + AzureCore.ActivityExtensions.ResetFeatureSwitch(); + // Open Telemetry Listener Util.OTelTracerProvider = Sdk.CreateTracerProviderBuilder() .AddCustomOtelExporter() // use any exporter here - .AddSource($"{OpenTelemetryAttributeKeys.DiagnosticNamespace}.*") // Right now, it will capture only "Azure.Cosmos.Operation" + .AddSource($"{OpenTelemetryAttributeKeys.DiagnosticNamespace}.Operation") // Right now, it will capture only "Azure.Cosmos.Operation" .Build(); // Custom Listener - Util.TestListener = new CustomListener($"{OpenTelemetryAttributeKeys.DiagnosticNamespace}.*", "Azure-Cosmos-Operation-Request-Diagnostics"); + Util.TestListener = new CustomListener($"{OpenTelemetryAttributeKeys.DiagnosticNamespace}.Operation", "Azure-Cosmos-Operation-Request-Diagnostics"); return Util.TestListener; @@ -567,6 +570,8 @@ internal static void DisposeOpenTelemetryAndCustomListeners() Util.TestListener = null; AppContext.SetSwitch("Azure.Experimental.EnableActivitySource", false); + + AzureCore.ActivityExtensions.ResetFeatureSwitch(); } /// diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/BenchmarkResults.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/BenchmarkResults.json index b54d4f0624..c97e0b5b2c 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/BenchmarkResults.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/BenchmarkResults.json @@ -1,79 +1,79 @@ { - "MasterKeyAuthorizationBenchmark.CreateSignatureGeneration;": 534.0, - "MasterKeyAuthorizationBenchmark.ReadSignatureGeneration;": 532.0, - "MockedItemBenchmark.CreateItem;[Type=OfT]": 45302.0, - "MockedItemBenchmark.CreateItem;[Type=OfTCustom]": 45320.0, - "MockedItemBenchmark.CreateItem;[Type=OfTWithClientTelemetryEnabled]": 48140.0, - "MockedItemBenchmark.CreateItem;[Type=OfTWithDiagnosticsToString]": 83798.0, - "MockedItemBenchmark.CreateItem;[Type=Stream]": 29766.0, - "MockedItemBenchmark.DeleteItemExists;[Type=OfT]": 37154.0, - "MockedItemBenchmark.DeleteItemExists;[Type=OfTCustom]": 37154.0, - "MockedItemBenchmark.DeleteItemExists;[Type=OfTWithClientTelemetryEnabled]": 39840.0, - "MockedItemBenchmark.DeleteItemExists;[Type=OfTWithDiagnosticsToString]": 74758.0, - "MockedItemBenchmark.DeleteItemExists;[Type=Stream]": 29872.0, - "MockedItemBenchmark.DeleteItemNotExists;[Type=OfT]": 42786.0, - "MockedItemBenchmark.DeleteItemNotExists;[Type=OfTCustom]": 43144.0, - "MockedItemBenchmark.DeleteItemNotExists;[Type=OfTWithClientTelemetryEnabled]": 44694.0, - "MockedItemBenchmark.DeleteItemNotExists;[Type=OfTWithDiagnosticsToString]": 80098.0, - "MockedItemBenchmark.DeleteItemNotExists;[Type=Stream]": 37610.0, + "MasterKeyAuthorizationBenchmark.CreateSignatureGeneration;": 534, + "MasterKeyAuthorizationBenchmark.ReadSignatureGeneration;": 544, + "MockedItemBenchmark.CreateItem;[Type=OfT]": 36356, + "MockedItemBenchmark.CreateItem;[Type=OfTCustom]": 36362, + "MockedItemBenchmark.CreateItem;[Type=OfTWithClientTelemetryEnabled]": 36359.5, + "MockedItemBenchmark.CreateItem;[Type=OfTWithDiagnosticsToString]": 57472.25, + "MockedItemBenchmark.CreateItem;[Type=Stream]": 24673.25, + "MockedItemBenchmark.DeleteItemExists;[Type=OfT]": 32308.5, + "MockedItemBenchmark.DeleteItemExists;[Type=OfTCustom]": 32328, + "MockedItemBenchmark.DeleteItemExists;[Type=OfTWithClientTelemetryEnabled]": 32321.25, + "MockedItemBenchmark.DeleteItemExists;[Type=OfTWithDiagnosticsToString]": 53231.25, + "MockedItemBenchmark.DeleteItemExists;[Type=Stream]": 24696, + "MockedItemBenchmark.DeleteItemNotExists;[Type=OfT]": 42172.5, + "MockedItemBenchmark.DeleteItemNotExists;[Type=OfTCustom]": 42174.75, + "MockedItemBenchmark.DeleteItemNotExists;[Type=OfTWithClientTelemetryEnabled]": 42166.5, + "MockedItemBenchmark.DeleteItemNotExists;[Type=OfTWithDiagnosticsToString]": 56695.5, + "MockedItemBenchmark.DeleteItemNotExists;[Type=Stream]": 37610, "MockedItemBenchmark.QuerySinglePartitionMultiplePages;[Type=OfT]": 13342232, "MockedItemBenchmark.QuerySinglePartitionMultiplePages;[Type=OfTCustom]": 13341058, "MockedItemBenchmark.QuerySinglePartitionMultiplePages;[Type=OfTWithClientTelemetryEnabled]": 13355160, "MockedItemBenchmark.QuerySinglePartitionMultiplePages;[Type=OfTWithDiagnosticsToString]": 13612338, "MockedItemBenchmark.QuerySinglePartitionMultiplePages;[Type=Stream]": 5920952, - "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfT]": 2241814.0, - "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfTCustom]": 2241810.0, - "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfTWithClientTelemetryEnabled]": 2244658.0, - "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfTWithDiagnosticsToString]": 2310842.0, - "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=Stream]": 1005038.0, - "MockedItemBenchmark.ReadFeed;[Type=OfT]": 560692.0, - "MockedItemBenchmark.ReadFeed;[Type=OfTCustom]": 571334.0, - "MockedItemBenchmark.ReadFeed;[Type=OfTWithClientTelemetryEnabled]": 565196.0, - "MockedItemBenchmark.ReadFeed;[Type=OfTWithDiagnosticsToString]": 609704.0, - "MockedItemBenchmark.ReadFeed;[Type=Stream]": 39140.0, - "MockedItemBenchmark.ReadItemExists;[Type=OfT]": 38622.0, - "MockedItemBenchmark.ReadItemExists;[Type=OfTCustom]": 37992.0, - "MockedItemBenchmark.ReadItemExists;[Type=OfTWithClientTelemetryEnabled]": 39918.0, - "MockedItemBenchmark.ReadItemExists;[Type=OfTWithDiagnosticsToString]": 74370.0, - "MockedItemBenchmark.ReadItemExists;[Type=Stream]": 31018.0, - "MockedItemBenchmark.ReadItemNotExists;[Type=OfT]": 43438.0, - "MockedItemBenchmark.ReadItemNotExists;[Type=OfTCustom]": 43860.0, - "MockedItemBenchmark.ReadItemNotExists;[Type=OfTWithClientTelemetryEnabled]": 45502.0, - "MockedItemBenchmark.ReadItemNotExists;[Type=OfTWithDiagnosticsToString]": 83760.0, - "MockedItemBenchmark.ReadItemNotExists;[Type=Stream]": 38266.0, - "MockedItemBenchmark.UpdateItem;[Type=OfT]": 46690.0, - "MockedItemBenchmark.UpdateItem;[Type=OfTCustom]": 45532.0, - "MockedItemBenchmark.UpdateItem;[Type=OfTWithClientTelemetryEnabled]": 48372.0, - "MockedItemBenchmark.UpdateItem;[Type=OfTWithDiagnosticsToString]": 84694.0, - "MockedItemBenchmark.UpdateItem;[Type=Stream]": 30026.0, - "MockedItemBenchmark.UpsertItem;[Type=OfT]": 45448.0, - "MockedItemBenchmark.UpsertItem;[Type=OfTCustom]": 45458.0, - "MockedItemBenchmark.UpsertItem;[Type=OfTWithClientTelemetryEnabled]": 48298.0, - "MockedItemBenchmark.UpsertItem;[Type=OfTWithDiagnosticsToString]": 83938.0, - "MockedItemBenchmark.UpsertItem;[Type=Stream]": 29934.0, - "MockedItemBulkBenchmark.CreateItem;[Type=OfT]": 1196168.0, - "MockedItemBulkBenchmark.CreateItem;[Type=OfTCustom]": 1195808.0, - "MockedItemBulkBenchmark.CreateItem;[Type=OfTWithClientTelemetryEnabled]": 1235418.0, - "MockedItemBulkBenchmark.CreateItem;[Type=OfTWithDiagnosticsToString]": 1231120.0, - "MockedItemBulkBenchmark.CreateItem;[Type=Stream]": 772810.0, - "MockedItemBulkBenchmark.DeleteItem;[Type=OfT]": 1187168.0, - "MockedItemBulkBenchmark.DeleteItem;[Type=OfTCustom]": 1187224.0, - "MockedItemBulkBenchmark.DeleteItem;[Type=OfTWithClientTelemetryEnabled]": 1226488.0, - "MockedItemBulkBenchmark.DeleteItem;[Type=OfTWithDiagnosticsToString]": 1222124.0, - "MockedItemBulkBenchmark.DeleteItem;[Type=Stream]": 771414.0, - "MockedItemBulkBenchmark.ReadItem;[Type=OfT]": 1186594.0, - "MockedItemBulkBenchmark.ReadItem;[Type=OfTCustom]": 1187192.0, - "MockedItemBulkBenchmark.ReadItem;[Type=OfTWithClientTelemetryEnabled]": 1226502.0, - "MockedItemBulkBenchmark.ReadItem;[Type=OfTWithDiagnosticsToString]": 1222342.0, - "MockedItemBulkBenchmark.ReadItem;[Type=Stream]": 770894.0, - "MockedItemBulkBenchmark.UpdateItem;[Type=OfT]": 1196464.0, - "MockedItemBulkBenchmark.UpdateItem;[Type=OfTCustom]": 1195778.0, - "MockedItemBulkBenchmark.UpdateItem;[Type=OfTWithClientTelemetryEnabled]": 1235738.0, - "MockedItemBulkBenchmark.UpdateItem;[Type=OfTWithDiagnosticsToString]": 1231486.0, - "MockedItemBulkBenchmark.UpdateItem;[Type=Stream]": 773284.0, - "MockedItemBulkBenchmark.UpsertItem;[Type=OfT]": 1196210.0, - "MockedItemBulkBenchmark.UpsertItem;[Type=OfTCustom]": 1195590.0, - "MockedItemBulkBenchmark.UpsertItem;[Type=OfTWithClientTelemetryEnabled]": 1235596.0, - "MockedItemBulkBenchmark.UpsertItem;[Type=OfTWithDiagnosticsToString]": 1231380.0, - "MockedItemBulkBenchmark.UpsertItem;[Type=Stream]": 773312.0 + "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfT]": 2241814, + "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfTCustom]": 2241810, + "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfTWithClientTelemetryEnabled]": 2244658, + "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=OfTWithDiagnosticsToString]": 2310842, + "MockedItemBenchmark.QuerySinglePartitionOnePage;[Type=Stream]": 1005038, + "MockedItemBenchmark.ReadFeed;[Type=OfT]": 560692, + "MockedItemBenchmark.ReadFeed;[Type=OfTCustom]": 555716, + "MockedItemBenchmark.ReadFeed;[Type=OfTWithClientTelemetryEnabled]": 550898.25, + "MockedItemBenchmark.ReadFeed;[Type=OfTWithDiagnosticsToString]": 573734.5, + "MockedItemBenchmark.ReadFeed;[Type=Stream]": 33434, + "MockedItemBenchmark.ReadItemExists;[Type=OfT]": 33630.5, + "MockedItemBenchmark.ReadItemExists;[Type=OfTCustom]": 33636.25, + "MockedItemBenchmark.ReadItemExists;[Type=OfTWithClientTelemetryEnabled]": 33627.75, + "MockedItemBenchmark.ReadItemExists;[Type=OfTWithDiagnosticsToString]": 47961.25, + "MockedItemBenchmark.ReadItemExists;[Type=Stream]": 26018.25, + "MockedItemBenchmark.ReadItemNotExists;[Type=OfT]": 43489.25, + "MockedItemBenchmark.ReadItemNotExists;[Type=OfTCustom]": 43490, + "MockedItemBenchmark.ReadItemNotExists;[Type=OfTWithClientTelemetryEnabled]": 43489.25, + "MockedItemBenchmark.ReadItemNotExists;[Type=OfTWithDiagnosticsToString]": 57420.25, + "MockedItemBenchmark.ReadItemNotExists;[Type=Stream]": 39044, + "MockedItemBenchmark.UpdateItem;[Type=OfT]": 36591, + "MockedItemBenchmark.UpdateItem;[Type=OfTCustom]": 36594.25, + "MockedItemBenchmark.UpdateItem;[Type=OfTWithClientTelemetryEnabled]": 36587.25, + "MockedItemBenchmark.UpdateItem;[Type=OfTWithDiagnosticsToString]": 57649, + "MockedItemBenchmark.UpdateItem;[Type=Stream]": 24894.75, + "MockedItemBenchmark.UpsertItem;[Type=OfT]": 36577.25, + "MockedItemBenchmark.UpsertItem;[Type=OfTCustom]": 36583.75, + "MockedItemBenchmark.UpsertItem;[Type=OfTWithClientTelemetryEnabled]": 36578.5, + "MockedItemBenchmark.UpsertItem;[Type=OfTWithDiagnosticsToString]": 57732.5, + "MockedItemBenchmark.UpsertItem;[Type=Stream]": 24878.5, + "MockedItemBulkBenchmark.CreateItem;[Type=OfT]": 1196168, + "MockedItemBulkBenchmark.CreateItem;[Type=OfTCustom]": 1195808, + "MockedItemBulkBenchmark.CreateItem;[Type=OfTWithClientTelemetryEnabled]": 1235418, + "MockedItemBulkBenchmark.CreateItem;[Type=OfTWithDiagnosticsToString]": 1231120, + "MockedItemBulkBenchmark.CreateItem;[Type=Stream]": 772810, + "MockedItemBulkBenchmark.DeleteItem;[Type=OfT]": 1187168, + "MockedItemBulkBenchmark.DeleteItem;[Type=OfTCustom]": 1187224, + "MockedItemBulkBenchmark.DeleteItem;[Type=OfTWithClientTelemetryEnabled]": 1226488, + "MockedItemBulkBenchmark.DeleteItem;[Type=OfTWithDiagnosticsToString]": 1222124, + "MockedItemBulkBenchmark.DeleteItem;[Type=Stream]": 771414, + "MockedItemBulkBenchmark.ReadItem;[Type=OfT]": 1186594, + "MockedItemBulkBenchmark.ReadItem;[Type=OfTCustom]": 1187192, + "MockedItemBulkBenchmark.ReadItem;[Type=OfTWithClientTelemetryEnabled]": 1226502, + "MockedItemBulkBenchmark.ReadItem;[Type=OfTWithDiagnosticsToString]": 1222342, + "MockedItemBulkBenchmark.ReadItem;[Type=Stream]": 770894, + "MockedItemBulkBenchmark.UpdateItem;[Type=OfT]": 1196464, + "MockedItemBulkBenchmark.UpdateItem;[Type=OfTCustom]": 1195778, + "MockedItemBulkBenchmark.UpdateItem;[Type=OfTWithClientTelemetryEnabled]": 1235738, + "MockedItemBulkBenchmark.UpdateItem;[Type=OfTWithDiagnosticsToString]": 1231486, + "MockedItemBulkBenchmark.UpdateItem;[Type=Stream]": 773284, + "MockedItemBulkBenchmark.UpsertItem;[Type=OfT]": 1196210, + "MockedItemBulkBenchmark.UpsertItem;[Type=OfTCustom]": 1195590, + "MockedItemBulkBenchmark.UpsertItem;[Type=OfTWithClientTelemetryEnabled]": 1235596, + "MockedItemBulkBenchmark.UpsertItem;[Type=OfTWithDiagnosticsToString]": 1231380, + "MockedItemBulkBenchmark.UpsertItem;[Type=Stream]": 773312 } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/PerformanceValidation.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/PerformanceValidation.cs index af3d77e5a4..ad7e43ab4a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/PerformanceValidation.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Performance.Tests/Contracts/PerformanceValidation.cs @@ -125,7 +125,7 @@ public static int ValidateSummaryResultsAgainstBaseline(SortedDictionary - + diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientTelemetryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientTelemetryTests.cs deleted file mode 100644 index b7e5d1f08e..0000000000 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/ClientTelemetryTests.cs +++ /dev/null @@ -1,134 +0,0 @@ -//------------------------------------------------------------ -// Copyright (c) Microsoft Corporation. All rights reserved. -//------------------------------------------------------------ - -namespace Microsoft.Azure.Cosmos.Tests -{ - using System; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using HdrHistogram; - using Newtonsoft.Json; - using Microsoft.Azure.Cosmos.Telemetry; - using System.Collections.Generic; - using Microsoft.Azure.Cosmos.Telemetry.Models; - - /// - /// Tests for . - /// - [TestClass] - public class ClientTelemetryTests - { - [TestCleanup] - public void Cleanup() - { - Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetryEnabled, null); - } - - [TestMethod] - public void CheckMetricsAggregationLogic() - { - MetricInfo metrics = new MetricInfo("metricsName", "unitName"); - - LongConcurrentHistogram histogram = new LongConcurrentHistogram(1, - long.MaxValue, - 5); - - histogram.RecordValue(10); - histogram.RecordValue(20); - histogram.RecordValue(30); - histogram.RecordValue(40); - - metrics.SetAggregators(histogram); - - Assert.AreEqual(40, metrics.Max); - Assert.AreEqual(10, metrics.Min); - Assert.AreEqual(4, metrics.Count); - Assert.AreEqual(25, metrics.Mean); - - Assert.AreEqual(20, metrics.Percentiles[ClientTelemetryOptions.Percentile50]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile90]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile95]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile99]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile999]); - } - - [TestMethod] - public void CheckMetricsAggregationLogicWithAdjustment() - { - MetricInfo metrics = new MetricInfo("metricsName", "unitName"); - long adjustmentFactor = 1000; - - LongConcurrentHistogram histogram = new LongConcurrentHistogram(1, - long.MaxValue, - 5); - - histogram.RecordValue(10 * adjustmentFactor); - histogram.RecordValue(20 * adjustmentFactor); - histogram.RecordValue(30 * adjustmentFactor); - histogram.RecordValue(40 * adjustmentFactor); - - metrics.SetAggregators(histogram, adjustmentFactor); - - Assert.AreEqual(40, metrics.Max); - Assert.AreEqual(10, metrics.Min); - Assert.AreEqual(4, metrics.Count); - - Assert.AreEqual(25, metrics.Mean); - - Assert.AreEqual(20, metrics.Percentiles[ClientTelemetryOptions.Percentile50]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile90]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile95]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile99]); - Assert.AreEqual(40, metrics.Percentiles[ClientTelemetryOptions.Percentile999]); - } - - [TestMethod] - public void CheckJsonSerializerContract() - { - string json = JsonConvert.SerializeObject(new ClientTelemetryProperties(clientId: "clientId", - processId: "", - userAgent: null, - connectionMode: ConnectionMode.Direct, - preferredRegions: null, - aggregationIntervalInSec: 10), ClientTelemetryOptions.JsonSerializerSettings); - Assert.AreEqual("{\"clientId\":\"clientId\",\"processId\":\"\",\"connectionMode\":\"DIRECT\",\"aggregationIntervalInSec\":10,\"systemInfo\":[]}", json); - } - - [TestMethod] - public void CheckJsonSerializerContractWithPreferredRegions() - { - List preferredRegion = new List - { - "region1" - }; - string json = JsonConvert.SerializeObject(new ClientTelemetryProperties(clientId: "clientId", - processId: "", - userAgent: null, - connectionMode: ConnectionMode.Direct, - preferredRegions: preferredRegion, - aggregationIntervalInSec: 1), ClientTelemetryOptions.JsonSerializerSettings); - Assert.AreEqual("{\"clientId\":\"clientId\",\"processId\":\"\",\"connectionMode\":\"DIRECT\",\"preferredRegions\":[\"region1\"],\"aggregationIntervalInSec\":1,\"systemInfo\":[]}", json); - } - - [TestMethod] - [ExpectedException(typeof(FormatException))] - public void CheckMisconfiguredTelemetry_should_fail() - { - Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetryEnabled, "non-boolean"); - using CosmosClient client = MockCosmosUtil.CreateMockCosmosClient(); - } - - [TestMethod] - [DataRow(200, 0 ,1, false)] - [DataRow(404, 0, 1, false)] - [DataRow(404, 1002, 1, true)] - [DataRow(409, 0, 1, false)] - [DataRow(409, 1002, 1, true)] - [DataRow(503, 2001, 1, true)] - [DataRow(200, 0, 6, true)] - public void CheckEligibleStatistics(int statusCode, int subStatusCode, int latencyInMs, bool expectedFlag) - { - Assert.AreEqual(expectedFlag, ClientTelemetryOptions.IsEligible(statusCode, subStatusCode, TimeSpan.FromMilliseconds(latencyInMs))); - } - } -} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json index 39ae1d2eca..08d0d65a7e 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json @@ -169,16 +169,6 @@ "Type": "Method", "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_AllVersionsAndDeletes();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedMode get_LatestVersion()": { - "Type": "Method", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_LatestVersion();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" - }, - "Microsoft.Azure.Cosmos.ChangeFeedMode LatestVersion": { - "Type": "Property", - "Attributes": [], - "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode LatestVersion;CanRead:True;CanWrite:False;Microsoft.Azure.Cosmos.ChangeFeedMode get_LatestVersion();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -253,6 +243,59 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.ComputedProperty;System.Object;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "System.String get_Name()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_Name();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_Query()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_Query();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String Name[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"name\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String Name;CanRead:True;CanWrite:True;System.String get_Name();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Name(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String Query[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"query\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String Query;CanRead:True;CanWrite:True;System.String get_Query();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_Query(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void .ctor()": { + "Type": "Constructor", + "Attributes": [], + "MethodInfo": "[Void .ctor(), Void .ctor()]" + }, + "Void set_Name(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_Name(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_Query(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_Query(System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.Container;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -284,10 +327,27 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedPolicy get_ChangeFeedPolicy();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty] ComputedProperties[Newtonsoft.Json.JsonIgnoreAttribute()]": { + "Type": "Property", + "Attributes": [ + "JsonIgnoreAttribute" + ], + "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty] ComputedProperties;CanRead:True;CanWrite:True;System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty] get_ComputedProperties();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_ComputedProperties(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty] get_ComputedProperties()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty] get_ComputedProperties();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Void set_ChangeFeedPolicy(Microsoft.Azure.Cosmos.ChangeFeedPolicy)": { "Type": "Method", "Attributes": [], "MethodInfo": "Void set_ChangeFeedPolicy(Microsoft.Azure.Cosmos.ChangeFeedPolicy);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_ComputedProperties(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty])": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Void set_ComputedProperties(System.Collections.ObjectModel.Collection`1[Microsoft.Azure.Cosmos.ComputedProperty]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -328,6 +388,22 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1[T] WithComputedProperty(System.String, System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1[T] WithComputedProperty(System.String, System.String);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "T Attach()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "T Attach();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.Fluent.ContainerBuilder;Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1[[Microsoft.Azure.Cosmos.Fluent.ContainerBuilder, ]];IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -339,6 +415,17 @@ }, "NestedTypes": {} }, + "Microsoft.Azure.Cosmos.Fluent.ContainerDefinition`1;System.Object;IsAbstract:True;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:True;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1[T] WithComputedProperties()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.Fluent.ComputedPropertiesDefinition`1[T] WithComputedProperties();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} + }, "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { @@ -362,6 +449,52 @@ } }, "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.PriorityLevel;System.Enum;IsAbstract:False;IsSealed:True;IsInterface:False;IsEnum:True;IsClass:False;IsValueType:True;IsNested:False;IsGenericType:False;IsSerializable:True": { + "Subclasses": {}, + "Members": { + "Int32 value__": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "Int32 value__;IsInitOnly:False;IsStatic:False;" + }, + "Microsoft.Azure.Cosmos.PriorityLevel High": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.PriorityLevel High;IsInitOnly:False;IsStatic:True;" + }, + "Microsoft.Azure.Cosmos.PriorityLevel Low": { + "Type": "Field", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.PriorityLevel Low;IsInitOnly:False;IsStatic:True;" + } + }, + "NestedTypes": {} + }, + "Microsoft.Azure.Cosmos.RequestOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { + "Subclasses": {}, + "Members": { + "System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel] get_PriorityLevel()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel] get_PriorityLevel();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel] PriorityLevel": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel] PriorityLevel;CanRead:True;CanWrite:True;System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel] get_PriorityLevel();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PriorityLevel(System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_PriorityLevel(System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel])[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_PriorityLevel(System.Nullable`1[Microsoft.Azure.Cosmos.PriorityLevel]);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + } + }, + "NestedTypes": {} } }, "Members": {}, diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json index 3cf5c017c2..074be1ee37 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetSDKAPI.json @@ -307,10 +307,20 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.ChangeFeedMode get_LatestVersion()": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode get_LatestVersion();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.ChangeFeedMode Incremental": { "Type": "Property", "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode Incremental;CanRead:True;CanWrite:False;Microsoft.Azure.Cosmos.ChangeFeedMode get_Incremental();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Microsoft.Azure.Cosmos.ChangeFeedMode LatestVersion": { + "Type": "Property", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.ChangeFeedMode LatestVersion;CanRead:True;CanWrite:False;Microsoft.Azure.Cosmos.ChangeFeedMode get_LatestVersion();IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -5296,6 +5306,20 @@ "Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions;System.Object;IsAbstract:True;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": { "Subclasses": {}, "Members": { + "Boolean IsArray(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Boolean IsArray(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Boolean IsBool(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Boolean IsBool(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Boolean IsDefined(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { "Type": "Method", "Attributes": [ @@ -5310,6 +5334,20 @@ ], "MethodInfo": "Boolean IsNull(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Boolean IsNumber(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Boolean IsNumber(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Boolean IsObject(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Boolean IsObject(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Boolean IsPrimitive(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { "Type": "Method", "Attributes": [ @@ -5317,6 +5355,13 @@ ], "MethodInfo": "Boolean IsPrimitive(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Boolean IsString(System.Object)[System.Runtime.CompilerServices.ExtensionAttribute()]": { + "Type": "Method", + "Attributes": [ + "ExtensionAttribute" + ], + "MethodInfo": "Boolean IsString(System.Object);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.FeedIterator ToStreamIterator[T](System.Linq.IQueryable`1[T])[System.Runtime.CompilerServices.ExtensionAttribute()]": { "Type": "Method", "Attributes": [ @@ -5745,6 +5790,11 @@ "Attributes": [], "MethodInfo": "Microsoft.Azure.Cosmos.PatchOperation Increment(System.String, Int64);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "Microsoft.Azure.Cosmos.PatchOperation Move(System.String, System.String)": { + "Type": "Method", + "Attributes": [], + "MethodInfo": "Microsoft.Azure.Cosmos.PatchOperation Move(System.String, System.String);IsAbstract:False;IsStatic:True;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "Microsoft.Azure.Cosmos.PatchOperation Remove(System.String)": { "Type": "Method", "Attributes": [], @@ -5772,6 +5822,20 @@ ], "MethodInfo": "Microsoft.Azure.Cosmos.PatchOperationType OperationType;CanRead:True;CanWrite:False;Microsoft.Azure.Cosmos.PatchOperationType get_OperationType();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" }, + "System.String From[Newtonsoft.Json.JsonPropertyAttribute(PropertyName = \"from\")]": { + "Type": "Property", + "Attributes": [ + "JsonPropertyAttribute" + ], + "MethodInfo": "System.String From;CanRead:True;CanWrite:True;System.String get_From();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_From(System.String);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "System.String get_From()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "System.String get_From();IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, "System.String get_Path()": { "Type": "Method", "Attributes": [], @@ -5783,6 +5847,13 @@ "JsonPropertyAttribute" ], "MethodInfo": "System.String Path;CanRead:True;CanWrite:False;System.String get_Path();IsAbstract:True;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" + }, + "Void set_From(System.String)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": { + "Type": "Method", + "Attributes": [ + "CompilerGeneratedAttribute" + ], + "MethodInfo": "Void set_From(System.String);IsAbstract:False;IsStatic:False;IsVirtual:True;IsGenericMethod:False;IsConstructor:False;IsFinal:False;" } }, "NestedTypes": {} @@ -5827,6 +5898,13 @@ ], "MethodInfo": "Microsoft.Azure.Cosmos.PatchOperationType Increment;IsInitOnly:False;IsStatic:True;" }, + "Microsoft.Azure.Cosmos.PatchOperationType Move[System.Runtime.Serialization.EnumMemberAttribute(Value = \"move\")]": { + "Type": "Field", + "Attributes": [ + "EnumMemberAttribute" + ], + "MethodInfo": "Microsoft.Azure.Cosmos.PatchOperationType Move;IsInitOnly:False;IsStatic:True;" + }, "Microsoft.Azure.Cosmos.PatchOperationType Remove[System.Runtime.Serialization.EnumMemberAttribute(Value = \"remove\")]": { "Type": "Field", "Attributes": [ 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 986b9cc997..efb06d7cc5 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosClientOptionsUnitTests.cs @@ -398,7 +398,7 @@ public void VerifyHttpClientHandlerIsSet() CosmosClient cosmosClient = cosmosClientBuilder.Build(); CosmosHttpClient cosmosHttpClient = cosmosClient.DocumentClient.httpClient; - HttpClientHandler handler = (HttpClientHandler)cosmosHttpClient.HttpMessageHandler; + SocketsHttpHandler handler = (SocketsHttpHandler)cosmosHttpClient.HttpMessageHandler; Assert.IsTrue(object.ReferenceEquals(webProxy, handler.Proxy)); } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs index 5ad80e1c59..5a7c3cefb6 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosContainerSettingsTests.cs @@ -33,6 +33,9 @@ public void DefaultIncludesPopulated() Cosmos.IncludedPath defaultEntry = containerSettings.IndexingPolicy.IncludedPaths[0]; Assert.AreEqual(Cosmos.IndexingPolicy.DefaultPath, defaultEntry.Path); Assert.AreEqual(0, defaultEntry.Indexes.Count); + + Assert.IsNotNull(containerSettings.ComputedProperties); + Assert.AreEqual(0, containerSettings.ComputedProperties.Count); } [TestMethod] diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs index 3ac919bf83..0d475ca370 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosHttpClientCoreTests.cs @@ -4,18 +4,20 @@ namespace Microsoft.Azure.Cosmos.Tests { - using System.Threading.Tasks; - using Microsoft.VisualStudio.TestTools.UnitTesting; - using Microsoft.Azure.Documents; using System; - using System.Net.Http; + using System.Collections.Generic; + using System.IO; using System.Net; + using System.Net.Http; + using System.Net.Security; + using System.Security.Cryptography; + using System.Security.Cryptography.X509Certificates; using System.Threading; - using System.IO; - using System.Net.Sockets; - using System.Collections.Generic; + using System.Threading.Tasks; using Microsoft.Azure.Cosmos.Tracing; using Microsoft.Azure.Cosmos.Tracing.TraceData; + using Microsoft.Azure.Documents; + using Microsoft.VisualStudio.TestTools.UnitTesting; [TestClass] public class CosmosHttpClientCoreTests @@ -410,6 +412,55 @@ async Task sendFunc(HttpRequestMessage request, Cancellatio Assert.AreEqual(HttpStatusCode.OK, responseMessage.StatusCode); } + [TestMethod] + public void CreateSocketsHttpHandlerCreatesCorrectValueType() + { + int gatewayLimit = 10; + IWebProxy webProxy = null; + Func serverCertificateCustomValidationCallback = (certificate2, x509Chain, sslPolicyErrors) => false; + + HttpMessageHandler handler = CosmosHttpClientCore.CreateSocketsHttpHandlerHelper( + gatewayLimit, + webProxy, + serverCertificateCustomValidationCallback); + + Assert.AreEqual(Type.GetType("System.Net.Http.SocketsHttpHandler, System.Net.Http"), handler.GetType()); + SocketsHttpHandler socketsHandler = (SocketsHttpHandler)handler; + + Assert.IsTrue(TimeSpan.FromMinutes(5.5) >= socketsHandler.PooledConnectionLifetime); + Assert.IsTrue(TimeSpan.FromMinutes(5) <= socketsHandler.PooledConnectionLifetime); + Assert.AreEqual(webProxy, socketsHandler.Proxy); + Assert.AreEqual(gatewayLimit, socketsHandler.MaxConnectionsPerServer); + + //Create cert for test + X509Certificate2 x509Certificate2 = new CertificateRequest("cn=www.test", ECDsa.Create(), HashAlgorithmName.SHA256).CreateSelfSigned(DateTime.Now, DateTime.Now.AddYears(1)); + X509Chain x509Chain = new X509Chain(); + SslPolicyErrors sslPolicyErrors = new SslPolicyErrors(); + Assert.IsFalse(socketsHandler.SslOptions.RemoteCertificateValidationCallback.Invoke(new object(), x509Certificate2, x509Chain, sslPolicyErrors)); + } + + [TestMethod] + public void CreateHttpClientHandlerCreatesCorrectValueType() + { + int gatewayLimit = 10; + IWebProxy webProxy = null; + Func serverCertificateCustomValidationCallback = (certificate2, x509Chain, sslPolicyErrors) => false; + + HttpMessageHandler handler = CosmosHttpClientCore.CreateHttpClientHandlerHelper(gatewayLimit, webProxy, serverCertificateCustomValidationCallback); + + Assert.AreEqual(Type.GetType("System.Net.Http.HttpClientHandler, System.Net.Http"), handler.GetType()); + HttpClientHandler clientHandler = (HttpClientHandler)handler; + + Assert.AreEqual(webProxy, clientHandler.Proxy); + Assert.AreEqual(gatewayLimit, clientHandler.MaxConnectionsPerServer); + + //Create cert for test + X509Certificate2 x509Certificate2 = new CertificateRequest("cn=www.test", ECDsa.Create(), HashAlgorithmName.SHA256).CreateSelfSigned(DateTime.Now, DateTime.Now.AddYears(1)); + X509Chain x509Chain = new X509Chain(); + SslPolicyErrors sslPolicyErrors = new SslPolicyErrors(); + Assert.IsFalse(clientHandler.ServerCertificateCustomValidationCallback.Invoke(new HttpRequestMessage(), x509Certificate2, x509Chain, sslPolicyErrors)); + } + private class MockMessageHandler : HttpMessageHandler { private readonly Func> sendFunc; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSeriliazerUnitTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs similarity index 84% rename from Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSeriliazerUnitTests.cs rename to Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs index 3ff401269b..8b318ad09e 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSeriliazerUnitTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/CosmosJsonSerializerUnitTests.cs @@ -7,7 +7,6 @@ namespace Microsoft.Azure.Cosmos.Core.Tests using System; using System.Collections.Generic; using System.IO; - using System.Linq; using System.Net; using System.Text; using Microsoft.Azure.Cosmos.CosmosElements; @@ -19,15 +18,15 @@ namespace Microsoft.Azure.Cosmos.Core.Tests using Newtonsoft.Json; [TestClass] - public class CosmosJsonSeriliazerUnitTests + public class CosmosJsonSerializerUnitTests { private readonly ToDoActivity toDoActivity = new ToDoActivity() { - id = "c1d433c1-369d-430e-91e5-14e3ce588f71", - taskNum = 42, - cost = double.MaxValue, - description = "cosmos json serializer", - status = "TBD" + Id = "c1d433c1-369d-430e-91e5-14e3ce588f71", + TaskNum = 42, + Cost = double.MaxValue, + Description = "cosmos json serializer", + Status = "TBD" }; private readonly string toDoActivityJson = @"{""id"":""c1d433c1-369d-430e-91e5-14e3ce588f71"",""taskNum"":42,""cost"":1.7976931348623157E+308,""description"":""cosmos json serializer"",""status"":""TBD""}"; @@ -41,11 +40,11 @@ public void ValidateSerializer() Assert.IsNotNull(stream); ToDoActivity result = cosmosDefaultJsonSerializer.FromStream(stream); Assert.IsNotNull(result); - Assert.AreEqual(this.toDoActivity.id, result.id); - Assert.AreEqual(this.toDoActivity.taskNum, result.taskNum); - Assert.AreEqual(this.toDoActivity.cost, result.cost); - Assert.AreEqual(this.toDoActivity.description, result.description); - Assert.AreEqual(this.toDoActivity.status, result.status); + Assert.AreEqual(this.toDoActivity.Id, result.Id); + Assert.AreEqual(this.toDoActivity.TaskNum, result.TaskNum); + Assert.AreEqual(this.toDoActivity.Cost, result.Cost); + Assert.AreEqual(this.toDoActivity.Description, result.Description); + Assert.AreEqual(this.toDoActivity.Status, result.Status); } } @@ -143,11 +142,11 @@ public void ValidateCustomSerializerSettings() ToDoActivity toDoActivityNoDescription = new ToDoActivity() { - id = "c1d433c1-369d-430e-91e5-14e3ce588f71", - taskNum = 42, - cost = double.MaxValue, - description = null, - status = "TBD" + Id = "c1d433c1-369d-430e-91e5-14e3ce588f71", + TaskNum = 42, + Cost = double.MaxValue, + Description = null, + Status = "TBD" }; string toDoActivityJson = @"{""id"":""c1d433c1-369d-430e-91e5-14e3ce588f71"",""taskNum"":42,""cost"":1.7976931348623157E+308,""status"":""TBD""}"; @@ -175,19 +174,15 @@ public void ValidateResponseFactoryJsonSerializer() ResponseMessage udfResponse = this.CreateResponse(); ResponseMessage itemResponse = this.CreateResponse(); - Mock mockUserJsonSerializer = new Mock(); CosmosSerializerCore serializerCore = new CosmosSerializerCore(mockUserJsonSerializer.Object); - CosmosResponseFactoryInternal cosmosResponseFactory = new CosmosResponseFactoryCore( - serializerCore); - - // Test the user specified response - mockUserJsonSerializer.Setup(x => x.FromStream(itemResponse.Content)).Callback(input => input.Dispose()).Returns(new ToDoActivity()); - mockUserJsonSerializer.Setup(x => x.FromStream(storedProcedureExecuteResponse.Content)).Callback(input => input.Dispose()).Returns(new ToDoActivity()); + CosmosResponseFactoryInternal cosmosResponseFactory = new CosmosResponseFactoryCore(serializerCore); // Verify all the user types use the user specified version ItemResponse itemResponseFromFactory = cosmosResponseFactory.CreateItemResponse(itemResponse); Assert.IsNotNull(itemResponseFromFactory.Diagnostics); + // Verify that FromStream is not called as the stream is empty + mockUserJsonSerializer.Verify(x => x.FromStream(itemResponse.Content), Times.Never); cosmosResponseFactory.CreateStoredProcedureExecuteResponse(storedProcedureExecuteResponse); // Throw if the setups were not called @@ -253,6 +248,27 @@ public void ValidateResponseFactoryJsonSerializer() cosmosResponseFactory.CreateUserDefinedFunctionResponse(udfResponse); } + [TestMethod] + public void ValidateResponseFactoryJsonSerializerWithContent() + { + ResponseMessage itemResponse = this.CreateResponseWithContent(); + + Mock mockUserJsonSerializer = new Mock(); + CosmosSerializerCore serializerCore = new CosmosSerializerCore(mockUserJsonSerializer.Object); + CosmosResponseFactoryInternal cosmosResponseFactory = new CosmosResponseFactoryCore(serializerCore); + + mockUserJsonSerializer.Setup(x => x.FromStream(itemResponse.Content)).Callback(input => input.Dispose()).Returns(new ToDoActivity()); + + // Verify all the user types use the user specified version + ItemResponse itemResponseFromFactory = cosmosResponseFactory.CreateItemResponse(itemResponse); + Assert.IsNotNull(itemResponseFromFactory.Diagnostics); + Assert.IsNotNull(itemResponseFromFactory.Resource); + Assert.AreEqual(HttpStatusCode.OK, itemResponseFromFactory.StatusCode); + + // Throw if the setups were not called + mockUserJsonSerializer.VerifyAll(); + } + [TestMethod] public void ValidateSqlQuerySpecSerializer() { @@ -339,6 +355,15 @@ private ResponseMessage CreateResponse() return cosmosResponse; } + private ResponseMessage CreateResponseWithContent() + { + ResponseMessage cosmosResponse = new ResponseMessage(statusCode: HttpStatusCode.OK) + { + Content = new MemoryStream(Encoding.UTF8.GetBytes(this.toDoActivityJson)) + }; + return cosmosResponse; + } + private ResponseMessage CreateQueryResponse() { List cosmosElements = new List(); @@ -387,13 +412,18 @@ private string GetSerializedToDoActivity() return @"{""id"":""c1d433c1-369d-430e-91e5-14e3ce588f71"",""taskNum"":42,""cost"":1.7976931348623157E+308,""status"":""TBD""}"; } - public class ToDoActivity + private class ToDoActivity { - public string id { get; set; } - public int taskNum { get; set; } - public double cost { get; set; } - public string description { get; set; } - public string status { get; set; } + [JsonProperty("id")] + public string Id { get; set; } + [JsonProperty("taskNum")] + public int TaskNum { get; set; } + [JsonProperty("cost")] + public double Cost { get; set; } + [JsonProperty("description")] + public string Description { get; set; } + [JsonProperty("status")] + public string Status { get; set; } } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs index 58361f89bb..d94aed92a4 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Fluent/ContainerDefinitionForCreateTests.cs @@ -251,6 +251,56 @@ await containerFluentDefinitionForCreate It.IsAny()), Times.Once); } + [Ignore] + [TestMethod] + public async Task WithComputedProperties() + { + Mock mockContainerResponse = new Mock(MockBehavior.Strict); + Mock mockDatabase = new Mock(MockBehavior.Strict); + Mock mockClient = new Mock(MockBehavior.Strict); + mockDatabase.Setup(m => m.Client).Returns(mockClient.Object); + mockDatabase + .Setup(c => c.CreateContainerAsync( + It.IsAny(), + It.IsAny(), + It.IsAny(), + It.IsAny())) + .ReturnsAsync(mockContainerResponse.Object); + mockDatabase + .Setup(c => c.Id) + .Returns(Guid.NewGuid().ToString()); + + ContainerBuilder containerFluentDefinitionForCreate = new ContainerBuilder( + mockDatabase.Object, + containerName, + partitionKey); + + var definitions = new[] + { + new { Name = "lowerName", Query = "SELECT VALUE LOWER(c.name) FROM c" }, + new { Name = "estimatedTax", Query = "SELECT VALUE c.salary * 0.2 FROM c" } + }; + await containerFluentDefinitionForCreate + .WithComputedProperties() + .WithComputedProperty(definitions[0].Name, definitions[0].Query) + .WithComputedProperty(definitions[1].Name, definitions[1].Query) + .Attach() + .CreateAsync(); + + mockDatabase.Verify(c => c.CreateContainerAsync( + It.Is((settings) => + settings.ComputedProperties.Count == 2 && + definitions[0].Name.Equals(settings.ComputedProperties[0].Name) && + definitions[0].Query.Equals(settings.ComputedProperties[0].Query) && + definitions[1].Name.Equals(settings.ComputedProperties[1].Name) && + definitions[1].Query.Equals(settings.ComputedProperties[1].Query) + ), + It.IsAny(), + It.IsAny(), + It.IsAny()), + Times.Once); + } + [TestMethod] public async Task WithUniqueKey() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs index 809814aef1..2d0d0a5c6a 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayAddressCacheTests.cs @@ -379,10 +379,10 @@ await cache.OpenConnectionsAsync( // Assert. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: 3, - expectedSuccessCount: 3); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 1, + expectedTotalReceivedAddressesCount: 3, + expectedTotalSuccessAddressesToOpenCount: 3); } /// @@ -425,10 +425,10 @@ await cache.OpenConnectionsAsync( // Assert. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 3, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: 3, - expectedSuccessCount: 0); + expectedTotalFailedAddressesToOpenCount: 3, + expectedTotalHandlerInvocationCount: 1, + expectedTotalReceivedAddressesCount: 3, + expectedTotalSuccessAddressesToOpenCount: 0); } /// @@ -474,10 +474,10 @@ await cache.OpenConnectionsAsync( // Assert. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 0, - expectedReceivedAddressesCount: 0, - expectedSuccessCount: 0); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 0, + expectedTotalReceivedAddressesCount: 0, + expectedTotalSuccessAddressesToOpenCount: 0); } /// @@ -552,10 +552,10 @@ await globalAddressResolver.OpenConnectionsToAllReplicasAsync( // Assert. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: 3, - expectedSuccessCount: 3); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 1, + expectedTotalReceivedAddressesCount: 3, + expectedTotalSuccessAddressesToOpenCount: 3); } /// @@ -630,10 +630,10 @@ await globalAddressResolver.OpenConnectionsToAllReplicasAsync( // Assert. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 2, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: 3, - expectedSuccessCount: 1); + expectedTotalFailedAddressesToOpenCount: 2, + expectedTotalHandlerInvocationCount: 1, + expectedTotalReceivedAddressesCount: 3, + expectedTotalSuccessAddressesToOpenCount: 1); } /// @@ -721,10 +721,10 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WhenIn Assert.AreEqual(exceptionMessage, ex.Message); GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 0, - expectedReceivedAddressesCount: 0, - expectedSuccessCount: 0); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 0, + expectedTotalReceivedAddressesCount: 0, + expectedTotalSuccessAddressesToOpenCount: 0); } /// @@ -797,10 +797,10 @@ public async Task GlobalAddressResolver_OpenConnectionsToAllReplicasAsync_WhenNu Assert.IsTrue(ce.Message.Contains("Could not resolve the collection")); GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 0, - expectedReceivedAddressesCount: 0, - expectedSuccessCount: 0); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 0, + expectedTotalReceivedAddressesCount: 0, + expectedTotalSuccessAddressesToOpenCount: 0); } /// @@ -879,10 +879,10 @@ await cache.OpenConnectionsAsync( // Assert. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: addresses.Count, - expectedSuccessCount: addresses.Count); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 1, + expectedTotalReceivedAddressesCount: addresses.Count, + expectedTotalSuccessAddressesToOpenCount: addresses.Count); } /// @@ -960,9 +960,15 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabled_ShouldValidat .ReplicaTransportAddressUris .Single(x => x.ToString().Equals(addressTobeMarkedUnhealthy)); + // Waits until a completion signal from the background task is received. + GatewayAddressCacheTests.WaitForManualResetEventSignal( + manualResetEvent: manualResetEvent, + shouldReset: true); + + // Because the Unknown Replicas are now validated aggresively, the health status should be marked as connected. Assert.IsNotNull(refreshedUri); Assert.AreEqual( - expected: TransportAddressHealthState.HealthStatus.Unknown, + expected: TransportAddressHealthState.HealthStatus.Connected, actual: refreshedUri.GetCurrentHealthState().GetHealthStatus()); Assert.AreEqual(4, addressInfo.AllAddresses.Count); @@ -1004,10 +1010,10 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabled_ShouldValidat mockHttpHandler.VerifyAll(); GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: 1, - expectedSuccessCount: 1); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 2, + expectedTotalReceivedAddressesCount: 6, + expectedTotalSuccessAddressesToOpenCount: 6); } /// @@ -1053,7 +1059,7 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr FakeOpenConnectionHandler fakeOpenConnectionHandler = new ( failIndexesByAttempts: new Dictionary>() { - { 0, new HashSet() { 0 } } + { 0, new HashSet() { 1 } } }, manualResetEvent: manualResetEvent); @@ -1095,9 +1101,22 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr .ReplicaTransportAddressUris .Single(x => x.ToString().Equals(addressTobeMarkedUnhealthy)); + // Waits until a completion signal from the background task is received. + GatewayAddressCacheTests.WaitForManualResetEventSignal( + manualResetEvent: manualResetEvent, + shouldReset: true); + + GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( + fakeOpenConnectionHandler: fakeOpenConnectionHandler, + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 1, + expectedTotalReceivedAddressesCount: 4, + expectedTotalSuccessAddressesToOpenCount: 4); + + // Because the Unknown Replicas are now validated aggresively, the health status should be marked as connected. Assert.IsNotNull(refreshedUri); Assert.AreEqual( - expected: TransportAddressHealthState.HealthStatus.Unknown, + expected: TransportAddressHealthState.HealthStatus.Connected, actual: refreshedUri.GetCurrentHealthState().GetHealthStatus()); Assert.AreEqual(4, addressInfo.AllAddresses.Count); @@ -1140,10 +1159,10 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 1, - expectedMethodInvocationCount: 1, - expectedReceivedAddressesCount: 1, - expectedSuccessCount: 0); + expectedTotalFailedAddressesToOpenCount: 1, + expectedTotalHandlerInvocationCount: 2, + expectedTotalReceivedAddressesCount: 6, + expectedTotalSuccessAddressesToOpenCount: 5); // A delay of 2 minute was added to make the replica unhealthy for more than one minute. This // will make sure the unhealthy replica gets a chance to re-validate it's health status. @@ -1167,10 +1186,10 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr Assert.AreEqual(4, addressInfo.AllAddresses.Count); GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 1, - expectedMethodInvocationCount: 2, - expectedReceivedAddressesCount: 1, - expectedSuccessCount: 1); + expectedTotalFailedAddressesToOpenCount: 1, + expectedTotalHandlerInvocationCount: 3, + expectedTotalReceivedAddressesCount: 7, + expectedTotalSuccessAddressesToOpenCount: 6); addressInfo = await cache.TryGetAddressesAsync( request: request, @@ -1194,13 +1213,13 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationEnabledAndUnhealthyUr actual: refreshedUri.GetCurrentHealthState().GetHealthStatus()); // This assertion makes sure that no additional calls were made to the open connection handler after - // since the last address refresh, because all the replicas are now either Unknown or Connected. + // since the last address refresh, because all the replicas at this point should be Connected. GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 1, - expectedMethodInvocationCount: 2, - expectedReceivedAddressesCount: 1, - expectedSuccessCount: 1); + expectedTotalFailedAddressesToOpenCount: 1, + expectedTotalHandlerInvocationCount: 3, + expectedTotalReceivedAddressesCount: 7, + expectedTotalSuccessAddressesToOpenCount: 6); } /// @@ -1290,10 +1309,10 @@ public async Task TryGetAddressesAsync_WhenReplicaVlidationDisabled_ShouldNotVal mockHttpHandler.VerifyAll(); GatewayAddressCacheTests.AssertOpenConnectionHandlerAttributes( fakeOpenConnectionHandler: fakeOpenConnectionHandler, - expectedExceptionCount: 0, - expectedMethodInvocationCount: 0, - expectedReceivedAddressesCount: 0, - expectedSuccessCount: 0); + expectedTotalFailedAddressesToOpenCount: 0, + expectedTotalHandlerInvocationCount: 0, + expectedTotalReceivedAddressesCount: 0, + expectedTotalSuccessAddressesToOpenCount: 0); } /// @@ -1320,21 +1339,21 @@ private static void WaitForManualResetEventSignal( /// to match with that of the expected ones. /// /// An instance of the . - /// The expected exception count for the test. - /// The expected method invocation count for the test. - /// The expected received addresses count for the test. - /// The expected successful messages count for the test. + /// The expected total addresses count that are supposed to fail while opening connection for the scenario. + /// The expected total open connection handler method invocation count for the scenario. + /// The expected total received addresses count for the scenario. + /// The expected total addresses count that are supposed to succeed while opening connection for the scenario. private static void AssertOpenConnectionHandlerAttributes( FakeOpenConnectionHandler fakeOpenConnectionHandler, - int expectedExceptionCount, - int expectedMethodInvocationCount, - int expectedReceivedAddressesCount, - int expectedSuccessCount) + int expectedTotalFailedAddressesToOpenCount, + int expectedTotalHandlerInvocationCount, + int expectedTotalReceivedAddressesCount, + int expectedTotalSuccessAddressesToOpenCount) { - Assert.AreEqual(expectedExceptionCount, fakeOpenConnectionHandler.GetExceptionCount()); - Assert.AreEqual(expectedMethodInvocationCount, fakeOpenConnectionHandler.GetMethodInvocationCount()); - Assert.AreEqual(expectedReceivedAddressesCount, fakeOpenConnectionHandler.GetReceivedAddressesCount()); - Assert.AreEqual(expectedSuccessCount, fakeOpenConnectionHandler.GetSuccessfulInvocationCount()); + Assert.AreEqual(expectedTotalFailedAddressesToOpenCount, fakeOpenConnectionHandler.GetTotalExceptionCount()); + Assert.AreEqual(expectedTotalHandlerInvocationCount, fakeOpenConnectionHandler.GetTotalMethodInvocationCount()); + Assert.AreEqual(expectedTotalReceivedAddressesCount, fakeOpenConnectionHandler.GetTotalReceivedAddressesCount()); + Assert.AreEqual(expectedTotalSuccessAddressesToOpenCount, fakeOpenConnectionHandler.GetTotalSuccessfulInvocationCount()); } private class FakeMessageHandler : HttpMessageHandler @@ -1451,22 +1470,22 @@ public FakeOpenConnectionHandler( this.manualResetEvent = manualResetEvent; } - public int GetSuccessfulInvocationCount() + public int GetTotalSuccessfulInvocationCount() { return this.successInvocationCounter; } - public int GetExceptionCount() + public int GetTotalExceptionCount() { return this.exceptionCounter; } - public int GetReceivedAddressesCount() + public int GetTotalReceivedAddressesCount() { return this.totalReceivedAddressesCounter; } - public int GetMethodInvocationCount() + public int GetTotalMethodInvocationCount() { return this.methodInvocationCounter; } @@ -1474,39 +1493,34 @@ public int GetMethodInvocationCount() Task IOpenConnectionsHandler.TryOpenRntbdChannelsAsync( IEnumerable addresses) { - this.totalReceivedAddressesCounter = addresses.Count(); - for (int i = 0; i < addresses.Count(); i++) + int idx = 0; + this.totalReceivedAddressesCounter += addresses.Count(); + foreach (TransportAddressUri transportAddress in addresses) { if (this.useAttemptBasedFailingIndexs) { - if (this.failIndexesByAttempts.ContainsKey(i) && this.failIndexesByAttempts[i].Contains(this.methodInvocationCounter)) + if (this.failIndexesByAttempts.ContainsKey(idx) && this.failIndexesByAttempts[idx].Contains(this.methodInvocationCounter)) { - this.ExecuteFailureCondition( - addresses: addresses.ToList(), - index: i); + this.ExecuteFailureCondition(transportAddress); } else { - this.ExecuteSuccessCondition( - addresses: addresses.ToList(), - index: i); + this.ExecuteSuccessCondition(transportAddress); } } else { - if (this.failingIndexes.Contains(i)) + if (this.failingIndexes.Contains(idx)) { - this.ExecuteFailureCondition( - addresses: addresses.ToList(), - index: i); + this.ExecuteFailureCondition(transportAddress); } else { - this.ExecuteSuccessCondition( - addresses: addresses.ToList(), - index: i); + this.ExecuteSuccessCondition(transportAddress); } } + + idx++; } this.methodInvocationCounter++; @@ -1515,18 +1529,16 @@ Task IOpenConnectionsHandler.TryOpenRntbdChannelsAsync( } private void ExecuteSuccessCondition( - IReadOnlyList addresses, - int index) + TransportAddressUri address) { - addresses[index].SetConnected(); + address.SetConnected(); this.successInvocationCounter++; } private void ExecuteFailureCondition( - IReadOnlyList addresses, - int index) + TransportAddressUri address) { - addresses[index].SetUnhealthy(); + address.SetUnhealthy(); this.exceptionCounter++; } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs index 43078d1866..36b350a751 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/GatewayStoreModelTest.cs @@ -161,6 +161,67 @@ public async Task TestRetries() } + /// + /// Verifies that if the DCE has Properties set, the HttpRequestMessage has them too. Used on ThinClient. + /// + [TestMethod] + public async Task PassesPropertiesFromDocumentServiceRequest() + { + IDictionary properties = new Dictionary() + { + {"property1", Guid.NewGuid() }, + {"property2", Guid.NewGuid().ToString() } + }; + + Func> sendFunc = request => + { + Assert.AreEqual(properties.Count, request.Properties.Count); + foreach (KeyValuePair item in properties) + { + Assert.AreEqual(item.Value, request.Properties[item.Key]); + } + + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) ); + }; + + Mock mockDocumentClient = new Mock(); + mockDocumentClient.Setup(client => client.ServiceEndpoint).Returns(new Uri("https://foo")); + + using GlobalEndpointManager endpointManager = new GlobalEndpointManager(mockDocumentClient.Object, new ConnectionPolicy()); + ISessionContainer sessionContainer = new SessionContainer(string.Empty); + DocumentClientEventSource eventSource = DocumentClientEventSource.Instance; + HttpMessageHandler messageHandler = new MockMessageHandler(sendFunc); + using GatewayStoreModel storeModel = new GatewayStoreModel( + endpointManager, + sessionContainer, + ConsistencyLevel.Eventual, + eventSource, + null, + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(messageHandler))); + + using (new ActivityScope(Guid.NewGuid())) + { + using (DocumentServiceRequest request = + DocumentServiceRequest.Create( + Documents.OperationType.Query, + Documents.ResourceType.Document, + new Uri("https://foo.com/dbs/db1/colls/coll1", UriKind.Absolute), + new MemoryStream(Encoding.UTF8.GetBytes("content1")), + AuthorizationTokenType.PrimaryMasterKey, + null)) + { + // Add properties to the DCE + request.Properties = new Dictionary(); + foreach (KeyValuePair property in properties) + { + request.Properties.Add(property.Key, property.Value); + } + + await storeModel.ProcessMessageAsync(request); + } + } + } + [TestMethod] public async Task TestApplySessionForMasterOperation() { diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Linq/CosmosLinqJsonConverterTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Linq/CosmosLinqJsonConverterTests.cs index e4f90f1957..ca2e12c8da 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Linq/CosmosLinqJsonConverterTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Linq/CosmosLinqJsonConverterTests.cs @@ -6,7 +6,10 @@ namespace Microsoft.Azure.Cosmos.Linq { using System; using System.Globalization; + using System.IO; + using System.Linq; using System.Linq.Expressions; + using global::Azure.Core.Serialization; using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -30,6 +33,104 @@ public void DateTimeKindIsPreservedTest() Assert.AreEqual("(a[\"StartDate\"] <= \"2022-05-26\")", sql); } + [TestMethod] + public void EnumIsPreservedAsINTest() + { + // Arrange + CosmosLinqSerializerOptions options = new() + { + //CustomCosmosSerializer = new TestCustomJsonSerializer() + }; + + // Act + TestEnum[] values = new[] { TestEnum.One, TestEnum.Two }; + Expression> expr = a => values.Contains(a.Value); + + string sql = SqlTranslator.TranslateExpression(expr.Body, options); + + // Assert + // Assert.AreEqual("(a[\"Value\"] IN (\"One\", \"Two\"))", sql); // <- TODO - Desired Behavior with CustomSerializer + Assert.AreEqual("(a[\"Value\"] IN (0, 1))", sql); // <- Actual behavior, with ability to set custom serializor reverted + } + + [TestMethod] + public void EnumIsPreservedAsEQUALSTest() + { + // Arrange + CosmosLinqSerializerOptions options = new() + { + // CustomCosmosSerializer = new TestCustomJsonSerializer() + }; + + // Act + TestEnum statusValue = TestEnum.One; + Expression> expr = a => a.Value == statusValue; + + string sql = SqlTranslator.TranslateExpression(expr.Body, options); + + // Assert + // Assert.AreEqual("(a[\"Value\"] = \"One\")", sql); // <- THIS is the correct value, if we are able to use the custom serializer + Assert.AreEqual("(a[\"Value\"] = 0)", sql); // <- THIS is the current mis-behavior of the SDK + } + + [TestMethod] + public void EnumIsPreservedAsEXPRESSIONTest() + { + // Arrange + CosmosLinqSerializerOptions options = new() + { + // CustomCosmosSerializer = new TestCustomJsonSerializer() + }; + + // Act + + // Get status constant + ConstantExpression status = Expression.Constant(TestEnum.One); + + // Get member access expression + ParameterExpression arg = Expression.Parameter(typeof(TestEnumNewtonsoftDocument), "a"); + + // Access the value property + MemberExpression docValueExpression = Expression.MakeMemberAccess( + arg, + typeof(TestEnumNewtonsoftDocument).GetProperty(nameof(TestEnumNewtonsoftDocument.Value))! + ); + + // Create comparison expression + BinaryExpression expression = Expression.Equal( + docValueExpression, + status + ); + + // Create lambda expression + Expression> lambda = + Expression.Lambda>(expression, arg); + + string sql = SqlTranslator.TranslateExpression(lambda.Body, options); + + // Assert + Assert.AreEqual("(a[\"Value\"] = \"One\")", sql); + } + + enum TestEnum + { + One, + Two, + Three, + } + + class TestEnumDocument + { + [System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] // TODO: Remove this once we have the ability to use custom serializer for LINQ queries + public TestEnum Value { get; set; } + } + + class TestEnumNewtonsoftDocument + { + [JsonConverter(typeof(StringEnumConverter))] + public TestEnum Value { get; set; } + } + class TestDocument { [JsonConverter(typeof(DateJsonConverter))] @@ -50,5 +151,54 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s } } } + + /// + // See: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos.Samples/Usage/SystemTextJson/CosmosSystemTextJsonSerializer.cs + /// + class TestCustomJsonSerializer : CosmosSerializer + { + private readonly JsonObjectSerializer systemTextJsonSerializer; + + public static readonly System.Text.Json.JsonSerializerOptions JsonOptions = new() + { + DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + PropertyNameCaseInsensitive = true, + Converters = { + new System.Text.Json.Serialization.JsonStringEnumConverter(), + } + }; + + public TestCustomJsonSerializer() + { + this.systemTextJsonSerializer = new JsonObjectSerializer(JsonOptions); + } + + public override T FromStream(Stream stream) + { + using (stream) + { + if (stream.CanSeek && stream.Length == 0) + { + return default; + } + + if (typeof(Stream).IsAssignableFrom(typeof(T))) + { + return (T)(object)stream; + } + + return (T)this.systemTextJsonSerializer.Deserialize(stream, typeof(T), default); + } + } + + public override Stream ToStream(T input) + { + MemoryStream stream = new (); + + this.systemTextJsonSerializer.Serialize(stream, input, typeof(T), default); + stream.Position = 0; + return stream; + } + } } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/SqlParserBaselineTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/SqlParserBaselineTests.cs index fbbca5abbc..11f23fab83 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/SqlParserBaselineTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Query/Parser/SqlParserBaselineTests.cs @@ -5,6 +5,9 @@ namespace Microsoft.Azure.Cosmos.Tests.Query.Parser { using System; + using System.Collections.Generic; + using System.Globalization; + using System.Threading; using System.Xml; using Microsoft.Azure.Cosmos.Query.Core.Monads; using Microsoft.Azure.Cosmos.Query.Core.Parser; @@ -17,6 +20,8 @@ public abstract class SqlParserBaselineTests : BaselineTests parseQueryMonad = SqlQueryParser.Monadic.Parse(input.Query); if (parseQueryMonad.Succeeded) { @@ -26,6 +31,22 @@ public override SqlParserBaselineTestOutput ExecuteTest(SqlParserBaselineTestInp Assert.AreEqual(parseQueryMonad.Result, parseQueryMonad2.Result); } + // Set culture to non-standard (US) to catch any parsing error + foreach (string culture in new List { "en-US", "fr-FR", "jp-JP" }) + { + Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(culture); + TryCatch parseQueryMonadCulture = SqlQueryParser.Monadic.Parse(input.Query); + if (parseQueryMonadCulture.Succeeded) + { + // Addtional round trip for extra validation + TryCatch parseQueryMonadCulture2 = SqlQueryParser.Monadic.Parse(parseQueryMonad.Result.ToString()); + Assert.IsTrue(parseQueryMonadCulture2.Succeeded); + Assert.AreEqual(parseQueryMonadCulture2.Result, parseQueryMonadCulture2.Result); + } + } + + // return thread to default culture + Thread.CurrentThread.CurrentCulture = defaultCulture; return new SqlParserBaselineTestOutput(parseQueryMonad); } } diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs index 239de170de..2e8df92318 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/SettingsContractTests.cs @@ -339,7 +339,7 @@ public void AccountPropertiesDeserializeWithAdditionalDataTest() [TestMethod] public void ContainerPropertiesDeserializeWithAdditionalDataTest() { - string cosmosSerialized = "{\"indexingPolicy\":{\"automatic\":true,\"indexingMode\":\"Consistent\",\"additionalIndexPolicy\":\"indexpolicyvalue\",\"includedPaths\":[{\"path\":\"/included/path\",\"additionalIncludedPath\":\"includedPathValue\",\"indexes\":[]}],\"excludedPaths\":[{\"path\":\"/excluded/path\",\"additionalExcludedPath\":\"excludedPathValue\"}],\"compositeIndexes\":[[{\"path\":\"/composite/path\",\"additionalCompositeIndex\":\"compositeIndexValue\",\"order\":\"ascending\"}]],\"spatialIndexes\":[{\"path\":\"/spatial/path\",\"additionalSpatialIndexes\":\"spatialIndexValue\",\"types\":[]}]},\"geospatialConfig\":{\"type\":\"Geography\",\"additionalGeospatialConfig\":\"geospatialConfigValue\"},\"uniqueKeyPolicy\":{\"additionalUniqueKeyPolicy\":\"uniqueKeyPolicyValue\",\"uniqueKeys\":[{\"paths\":[\"/unique/key/path/1\",\"/unique/key/path/2\"]}]},\"conflictResolutionPolicy\":{\"mode\":\"LastWriterWins\",\"additionalConflictResolutionPolicy\":\"conflictResolutionValue\"},\"clientEncryptionPolicy\":{\"includedPaths\":[{\"path\":\"/path\",\"clientEncryptionKeyId\":\"clientEncryptionKeyId\",\"encryptionType\":\"Randomized\",\"additionalIncludedPath\":\"includedPathValue\",\"encryptionAlgorithm\":\"AEAD_AES_256_CBC_HMAC_SHA256\"}],\"policyFormatVersion\":1,\"additionalEncryptionPolicy\":\"clientEncryptionpolicyValue\"},\"id\":\"2a9f501b-6948-4795-8fd1-797defb5c466\",\"partitionKey\":{\"paths\":[],\"kind\":\"Hash\"}}"; + string cosmosSerialized = "{\"indexingPolicy\":{\"automatic\":true,\"indexingMode\":\"Consistent\",\"additionalIndexPolicy\":\"indexpolicyvalue\",\"includedPaths\":[{\"path\":\"/included/path\",\"additionalIncludedPath\":\"includedPathValue\",\"indexes\":[]}],\"excludedPaths\":[{\"path\":\"/excluded/path\",\"additionalExcludedPath\":\"excludedPathValue\"}],\"compositeIndexes\":[[{\"path\":\"/composite/path\",\"additionalCompositeIndex\":\"compositeIndexValue\",\"order\":\"ascending\"}]],\"spatialIndexes\":[{\"path\":\"/spatial/path\",\"additionalSpatialIndexes\":\"spatialIndexValue\",\"types\":[]}]},\"computedProperties\":[{\"name\":\"lowerName\",\"query\":\"SELECT VALUE LOWER(c.name) FROM c\"},{\"name\":\"estimatedTax\",\"query\":\"SELECT VALUE c.salary * 0.2 FROM c\"}],\"geospatialConfig\":{\"type\":\"Geography\",\"additionalGeospatialConfig\":\"geospatialConfigValue\"},\"uniqueKeyPolicy\":{\"additionalUniqueKeyPolicy\":\"uniqueKeyPolicyValue\",\"uniqueKeys\":[{\"paths\":[\"/unique/key/path/1\",\"/unique/key/path/2\"]}]},\"conflictResolutionPolicy\":{\"mode\":\"LastWriterWins\",\"additionalConflictResolutionPolicy\":\"conflictResolutionValue\"},\"clientEncryptionPolicy\":{\"includedPaths\":[{\"path\":\"/path\",\"clientEncryptionKeyId\":\"clientEncryptionKeyId\",\"encryptionType\":\"Randomized\",\"additionalIncludedPath\":\"includedPathValue\",\"encryptionAlgorithm\":\"AEAD_AES_256_CBC_HMAC_SHA256\"}],\"policyFormatVersion\":1,\"additionalEncryptionPolicy\":\"clientEncryptionpolicyValue\"},\"id\":\"2a9f501b-6948-4795-8fd1-797defb5c466\",\"partitionKey\":{\"paths\":[],\"kind\":\"Hash\"}}"; JObject complexObject = JObject.FromObject(new { id = 1, name = new { fname = "fname", lname = "lname" } }); @@ -351,43 +351,49 @@ public void ContainerPropertiesDeserializeWithAdditionalDataTest() // Serialized string cosmosSerialized = SettingsContractTests.CosmosSerialize(jobject); - ContainerProperties containerDeserSettings = SettingsContractTests.CosmosDeserialize(cosmosSerialized); + ContainerProperties containerProperties = SettingsContractTests.CosmosDeserialize(cosmosSerialized); - Assert.AreEqual("2a9f501b-6948-4795-8fd1-797defb5c466", containerDeserSettings.Id); + Assert.AreEqual("2a9f501b-6948-4795-8fd1-797defb5c466", containerProperties.Id); - Assert.AreEqual(2, containerDeserSettings.AdditionalProperties.Count); - Assert.AreEqual("policy value", (string)containerDeserSettings.AdditionalProperties["simple string"]); - Assert.AreEqual(complexObject.ToString(), JObject.FromObject(containerDeserSettings.AdditionalProperties["complex object"]).ToString()); + Assert.AreEqual(2, containerProperties.AdditionalProperties.Count); + Assert.AreEqual("policy value", (string)containerProperties.AdditionalProperties["simple string"]); + Assert.AreEqual(complexObject.ToString(), JObject.FromObject(containerProperties.AdditionalProperties["complex object"]).ToString()); + + Assert.AreEqual(1, containerProperties.IndexingPolicy.AdditionalProperties.Count); + Assert.AreEqual("indexpolicyvalue", containerProperties.IndexingPolicy.AdditionalProperties["additionalIndexPolicy"]); - Assert.AreEqual(1, containerDeserSettings.IndexingPolicy.AdditionalProperties.Count); - Assert.AreEqual("indexpolicyvalue", containerDeserSettings.IndexingPolicy.AdditionalProperties["additionalIndexPolicy"]); + Assert.AreEqual(1, containerProperties.IndexingPolicy.SpatialIndexes[0].AdditionalProperties.Count); + Assert.AreEqual("spatialIndexValue", containerProperties.IndexingPolicy.SpatialIndexes[0].AdditionalProperties["additionalSpatialIndexes"]); - Assert.AreEqual(1, containerDeserSettings.IndexingPolicy.SpatialIndexes[0].AdditionalProperties.Count); - Assert.AreEqual("spatialIndexValue", containerDeserSettings.IndexingPolicy.SpatialIndexes[0].AdditionalProperties["additionalSpatialIndexes"]); + Assert.AreEqual(1, containerProperties.IndexingPolicy.CompositeIndexes[0][0].AdditionalProperties.Count); + Assert.AreEqual("compositeIndexValue", containerProperties.IndexingPolicy.CompositeIndexes[0][0].AdditionalProperties["additionalCompositeIndex"]); - Assert.AreEqual(1, containerDeserSettings.IndexingPolicy.CompositeIndexes[0][0].AdditionalProperties.Count); - Assert.AreEqual("compositeIndexValue", containerDeserSettings.IndexingPolicy.CompositeIndexes[0][0].AdditionalProperties["additionalCompositeIndex"]); + Assert.AreEqual(1, containerProperties.IndexingPolicy.IncludedPaths[0].AdditionalProperties.Count); + Assert.AreEqual("includedPathValue", containerProperties.IndexingPolicy.IncludedPaths[0].AdditionalProperties["additionalIncludedPath"]); - Assert.AreEqual(1, containerDeserSettings.IndexingPolicy.IncludedPaths[0].AdditionalProperties.Count); - Assert.AreEqual("includedPathValue", containerDeserSettings.IndexingPolicy.IncludedPaths[0].AdditionalProperties["additionalIncludedPath"]); + Assert.AreEqual(1, containerProperties.IndexingPolicy.ExcludedPaths[0].AdditionalProperties.Count); + Assert.AreEqual("excludedPathValue", containerProperties.IndexingPolicy.ExcludedPaths[0].AdditionalProperties["additionalExcludedPath"]); - Assert.AreEqual(1, containerDeserSettings.IndexingPolicy.ExcludedPaths[0].AdditionalProperties.Count); - Assert.AreEqual("excludedPathValue", containerDeserSettings.IndexingPolicy.ExcludedPaths[0].AdditionalProperties["additionalExcludedPath"]); + Assert.AreEqual(1, containerProperties.GeospatialConfig.AdditionalProperties.Count); + Assert.AreEqual("geospatialConfigValue", containerProperties.GeospatialConfig.AdditionalProperties["additionalGeospatialConfig"]); - Assert.AreEqual(1, containerDeserSettings.GeospatialConfig.AdditionalProperties.Count); - Assert.AreEqual("geospatialConfigValue", containerDeserSettings.GeospatialConfig.AdditionalProperties["additionalGeospatialConfig"]); + Assert.AreEqual(1, containerProperties.UniqueKeyPolicy.AdditionalProperties.Count); + Assert.AreEqual("uniqueKeyPolicyValue", containerProperties.UniqueKeyPolicy.AdditionalProperties["additionalUniqueKeyPolicy"]); - Assert.AreEqual(1, containerDeserSettings.UniqueKeyPolicy.AdditionalProperties.Count); - Assert.AreEqual("uniqueKeyPolicyValue", containerDeserSettings.UniqueKeyPolicy.AdditionalProperties["additionalUniqueKeyPolicy"]); + Assert.AreEqual(1, containerProperties.ConflictResolutionPolicy.AdditionalProperties.Count); + Assert.AreEqual("conflictResolutionValue", containerProperties.ConflictResolutionPolicy.AdditionalProperties["additionalConflictResolutionPolicy"]); - Assert.AreEqual(1, containerDeserSettings.ConflictResolutionPolicy.AdditionalProperties.Count); - Assert.AreEqual("conflictResolutionValue", containerDeserSettings.ConflictResolutionPolicy.AdditionalProperties["additionalConflictResolutionPolicy"]); + Assert.AreEqual(1, containerProperties.ClientEncryptionPolicy.AdditionalProperties.Count); + Assert.AreEqual("clientEncryptionpolicyValue", containerProperties.ClientEncryptionPolicy.AdditionalProperties["additionalEncryptionPolicy"]); - Assert.AreEqual(1, containerDeserSettings.ClientEncryptionPolicy.AdditionalProperties.Count); - Assert.AreEqual("clientEncryptionpolicyValue", containerDeserSettings.ClientEncryptionPolicy.AdditionalProperties["additionalEncryptionPolicy"]); + Assert.AreEqual(1, containerProperties.ClientEncryptionPolicy.IncludedPaths.First().AdditionalProperties.Count); + Assert.AreEqual("includedPathValue", containerProperties.ClientEncryptionPolicy.IncludedPaths.First().AdditionalProperties["additionalIncludedPath"]); - Assert.AreEqual(1, containerDeserSettings.ClientEncryptionPolicy.IncludedPaths.First().AdditionalProperties.Count); - Assert.AreEqual("includedPathValue", containerDeserSettings.ClientEncryptionPolicy.IncludedPaths.First().AdditionalProperties["additionalIncludedPath"]); + Assert.AreEqual(2, containerProperties.ComputedProperties.Count); + Assert.AreEqual("lowerName", containerProperties.ComputedProperties[0].Name); + Assert.AreEqual("SELECT VALUE LOWER(c.name) FROM c", containerProperties.ComputedProperties[0].Query); + Assert.AreEqual("estimatedTax", containerProperties.ComputedProperties[1].Name); + Assert.AreEqual("SELECT VALUE c.salary * 0.2 FROM c", containerProperties.ComputedProperties[1].Query); } [TestMethod] @@ -724,6 +730,7 @@ public void ContainerSettingsDefaults() "TimeToLivePropertyPath", "PartitionKeyPath", "PartitionKeyDefinitionVersion", + "ComputedProperties", "ConflictResolutionPolicy", "ChangeFeedPolicy", "ClientEncryptionPolicy", @@ -762,6 +769,10 @@ public void ContainerSettingsDefaults() Assert.IsNotNull(cosmosContainerSettings.IndexingPolicy.IncludedPaths); Assert.IsTrue(object.ReferenceEquals(cosmosContainerSettings.IndexingPolicy.IncludedPaths, cosmosContainerSettings.IndexingPolicy.IncludedPaths)); + Assert.IsNotNull(cosmosContainerSettings.ComputedProperties); + Assert.AreEqual(0, cosmosContainerSettings.ComputedProperties.Count); + Assert.IsTrue(object.ReferenceEquals(cosmosContainerSettings.ComputedProperties, cosmosContainerSettings.ComputedProperties)); + Cosmos.IncludedPath ip = new Cosmos.IncludedPath(); Assert.IsNotNull(ip.Indexes); diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/ClientTelemetryTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/ClientTelemetryTests.cs index 48cb0d1e42..9308d22806 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/ClientTelemetryTests.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/ClientTelemetryTests.cs @@ -30,6 +30,7 @@ public class ClientTelemetryTests public void Cleanup() { Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetryEnabled, null); + Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetryEndpoint, null); } [TestMethod] @@ -119,10 +120,10 @@ public void CheckJsonSerializerContractWithPreferredRegions() } [TestMethod] - [DataRow(100, 50, 200)] // When operation, cacherefresh and request info is there in payload + [DataRow(150, 50, 200)] // When operation, cacherefresh and request info is there in payload [DataRow(0, 50, 0)] // When only cacherefresh info is there in payload - [DataRow(100, 50, 0)] // When only operation and cacherefresh info is there in payload - [DataRow(100, 0, 0)] // When only operation info is there in payload + [DataRow(150, 50, 0)] // When only operation and cacherefresh info is there in payload + [DataRow(150, 0, 0)] // When only operation info is there in payload public async Task CheckIfPayloadIsDividedCorrectlyAsync(int expectedOperationInfoSize, int expectedCacheRefreshInfoSize, int expectedRequestInfoSize) { Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetryEndpoint, "http://dummy.telemetry.endpoint/"); @@ -162,9 +163,10 @@ public async Task CheckIfPayloadIsDividedCorrectlyAsync(int expectedOperationInf Mock.Of()); ConcurrentDictionary operationInfoSnapshot - = new ConcurrentDictionary(); + = new ConcurrentDictionary (); - for (int i = 0; i < (expectedOperationInfoSize/2); i++) + int numberOfMetricsInOperationSection = 2; + for (int i = 0; i < (expectedOperationInfoSize/ numberOfMetricsInOperationSection); i++) { OperationInfo opeInfo = new OperationInfo(Regions.WestUS, 0, @@ -179,12 +181,12 @@ public async Task CheckIfPayloadIsDividedCorrectlyAsync(int expectedOperationInf LongConcurrentHistogram latency = new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, ClientTelemetryOptions.RequestLatencyMax, ClientTelemetryOptions.RequestLatencyPrecision); - latency.RecordValue(10l); + latency.RecordValue(10); LongConcurrentHistogram requestcharge = new LongConcurrentHistogram(ClientTelemetryOptions.RequestChargeMin, ClientTelemetryOptions.RequestChargeMax, ClientTelemetryOptions.RequestChargePrecision); - requestcharge.RecordValue(11l); + requestcharge.RecordValue(11); operationInfoSnapshot.TryAdd(opeInfo, (latency, requestcharge)); } @@ -207,13 +209,12 @@ ConcurrentDictionary cacheRefreshInfo LongConcurrentHistogram latency = new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, ClientTelemetryOptions.RequestLatencyMax, ClientTelemetryOptions.RequestLatencyPrecision); - latency.RecordValue(10l); + latency.RecordValue(10); cacheRefreshInfoSnapshot.TryAdd(crInfo, latency); } - ConcurrentDictionary requestInfoInfoSnapshot - = new ConcurrentDictionary(); + List requestInfoList = new List(); for (int i = 0; i < expectedRequestInfoSize; i++) { RequestInfo reqInfo = new RequestInfo @@ -227,26 +228,131 @@ ConcurrentDictionary requestInfoInfoSnapsh SubStatusCode = 0 }; - LongConcurrentHistogram latency = new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, - ClientTelemetryOptions.RequestLatencyMax, - ClientTelemetryOptions.RequestLatencyPrecision); - latency.RecordValue(10l); + MetricInfo metricInfo = new MetricInfo(ClientTelemetryOptions.RequestLatencyName, ClientTelemetryOptions.RequestLatencyUnit); - requestInfoInfoSnapshot.TryAdd(reqInfo, latency); - } + LongConcurrentHistogram histogram = new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, + ClientTelemetryOptions.RequestLatencyMax, + ClientTelemetryOptions.RequestLatencyPrecision); + histogram.RecordValue(TimeSpan.FromMinutes(1).Ticks); + + metricInfo.SetAggregators(histogram, ClientTelemetryOptions.TicksToMsFactor); + reqInfo.Metrics.Add(metricInfo); + requestInfoList.Add(reqInfo); ; + } + await processor.ProcessAndSendAsync( clientTelemetryProperties, operationInfoSnapshot, cacheRefreshInfoSnapshot, - requestInfoInfoSnapshot, - new CancellationToken()); + requestInfoList, + new CancellationTokenSource(ClientTelemetryOptions.ClientTelemetryProcessorTimeOut).Token); Assert.AreEqual(expectedOperationInfoSize, actualOperationInfoSize, "Operation Info is not correct"); Assert.AreEqual(expectedCacheRefreshInfoSize, actualCacheRefreshInfoSize, "Cache Refresh Info is not correct"); Assert.AreEqual(expectedRequestInfoSize, actualRequestInfoSize, "Request Info is not correct"); } - + + [TestMethod] + public async Task ClientTelmetryProcessor_should_timeout() + { + Environment.SetEnvironmentVariable(ClientTelemetryOptions.EnvPropsClientTelemetryEndpoint, "http://dummy.telemetry.endpoint/"); + + string data = File.ReadAllText("Telemetry/ClientTelemetryPayloadWithoutMetrics.json", Encoding.UTF8); + ClientTelemetryProperties clientTelemetryProperties = JsonConvert.DeserializeObject(data); + + int actualOperationInfoSize = 0; + int actualCacheRefreshInfoSize = 0; + + Mock mockHttpHandler = new Mock(); + _ = mockHttpHandler.Setup(x => x.SendAsync( + It.IsAny(), + It.IsAny())) + .Callback( + (request, cancellationToken) => + { + string payloadJson = request.Content.ReadAsStringAsync().Result; + Assert.IsTrue(payloadJson.Length <= ClientTelemetryOptions.PayloadSizeThreshold, "Payload Size is " + payloadJson.Length); + + ClientTelemetryProperties propertiesToSend = JsonConvert.DeserializeObject(payloadJson); + + actualOperationInfoSize += propertiesToSend.OperationInfo?.Count ?? 0; + actualCacheRefreshInfoSize += propertiesToSend.CacheRefreshInfo?.Count ?? 0; + }) + .Returns(Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK))); + + ClientTelemetryProcessor processor = new ClientTelemetryProcessor( + MockCosmosUtil.CreateCosmosHttpClient(() => new HttpClient(new HttpHandlerHelper(mockHttpHandler.Object))), + Mock.Of()); + + ConcurrentDictionary operationInfoSnapshot + = new ConcurrentDictionary(); + + for (int i = 0; i < 20; i++) + { + OperationInfo opeInfo = new OperationInfo(Regions.WestUS, + 0, + Documents.ConsistencyLevel.Session.ToString(), + "databaseName" + i, + "containerName", + Documents.OperationType.Read, + Documents.ResourceType.Document, + 200, + 0); + + LongConcurrentHistogram latency = new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, + ClientTelemetryOptions.RequestLatencyMax, + ClientTelemetryOptions.RequestLatencyPrecision); + latency.RecordValue(10); + + LongConcurrentHistogram requestcharge = new LongConcurrentHistogram(ClientTelemetryOptions.RequestChargeMin, + ClientTelemetryOptions.RequestChargeMax, + ClientTelemetryOptions.RequestChargePrecision); + requestcharge.RecordValue(11); + + operationInfoSnapshot.TryAdd(opeInfo, (latency, requestcharge)); + } + + ConcurrentDictionary cacheRefreshInfoSnapshot + = new ConcurrentDictionary(); + for (int i = 0; i < 10; i++) + { + CacheRefreshInfo crInfo = new CacheRefreshInfo(Regions.WestUS, + 10, + Documents.ConsistencyLevel.Session.ToString(), + "databaseName" + i, + "containerName", + Documents.OperationType.Read, + Documents.ResourceType.Document, + 200, + 1002, + "dummycache"); + + LongConcurrentHistogram latency = new LongConcurrentHistogram(ClientTelemetryOptions.RequestLatencyMin, + ClientTelemetryOptions.RequestLatencyMax, + ClientTelemetryOptions.RequestLatencyPrecision); + latency.RecordValue(10); + + cacheRefreshInfoSnapshot.TryAdd(crInfo, latency); + } + + Task processorTask = Task.Run(async () => + { + CancellationTokenSource cts = new CancellationTokenSource(TimeSpan.FromMilliseconds(1)); + await Task.Delay(1000, cts.Token); // Making this task wait to ensure that processir is taking more time. + await processor.ProcessAndSendAsync(clientTelemetryProperties, + operationInfoSnapshot, + cacheRefreshInfoSnapshot, + default, + cts.Token); + }); + + await Assert.ThrowsExceptionAsync(() => ClientTelemetry.RunProcessorTaskAsync( + telemetryDate: DateTime.Now.ToString(), + processingTask: processorTask, + timeout: TimeSpan.FromTicks(1))); + } + [TestMethod] [ExpectedException(typeof(FormatException))] public void CheckMisconfiguredTelemetry_should_fail() diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DataSamplerTests.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DataSamplerTests.cs new file mode 100644 index 0000000000..d6ad3dbb8c --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DataSamplerTests.cs @@ -0,0 +1,119 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests.Telemetry +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + using Microsoft.Azure.Cosmos.Telemetry; + using Microsoft.Azure.Cosmos.Telemetry.Models; + using Microsoft.Azure.Documents; + using Microsoft.VisualStudio.TestTools.UnitTesting; + + [TestClass] + public class DataSamplerTests + { + [TestMethod] + public void TestNetworkRequestSamplerForThreshold() + { + int numberOfElementsInEachGroup = ClientTelemetryOptions.NetworkRequestsSampleSizeThreshold; + int numberOfGroups = 5; + + List requestInfoList = new List(); + + for (int counter = 0; counter < 100; counter++) + { + RequestInfo requestInfo = new RequestInfo() + { + DatabaseName = "dbId " + (counter % numberOfGroups), // To repeat similar elements + ContainerName = "containerId", + Uri = "rntbd://host/partition/replica", + StatusCode = 429, + SubStatusCode = 1002, + Resource = ResourceType.Document.ToResourceTypeString(), + Operation = OperationType.Create.ToOperationTypeString(), + Metrics = new List() + { + new MetricInfo(ClientTelemetryOptions.RequestLatencyName, ClientTelemetryOptions.RequestLatencyUnit) + { + Percentiles = new Dictionary() + { + { ClientTelemetryOptions.Percentile50, 10 }, + { ClientTelemetryOptions.Percentile90, 20 }, + { ClientTelemetryOptions.Percentile95, 30 }, + { ClientTelemetryOptions.Percentile99, Random.Shared.Next(1, 100) }, + { ClientTelemetryOptions.Percentile999, 50 } + }, + Count = Random.Shared.Next(1, 100) + } + } + }; + requestInfoList.Add(requestInfo); + } + + List sampleDataByLatency = DataSampler.OrderAndSample(requestInfoList, DataLatencyComparer.Instance); + Assert.AreEqual(numberOfGroups * numberOfElementsInEachGroup, sampleDataByLatency.Count); + + List sampleDataBySampleCount = DataSampler.OrderAndSample(requestInfoList, DataSampleCountComparer.Instance); + Assert.AreEqual(numberOfGroups * numberOfElementsInEachGroup, sampleDataBySampleCount.Count); + } + + [TestMethod] + public void TestNetworkRequestSamplerWithoutData() + { + List requestInfoList = new List(); + + Assert.AreEqual(0, DataSampler.OrderAndSample(requestInfoList, DataSampleCountComparer.Instance).Count); + Assert.AreEqual(0, DataSampler.OrderAndSample(requestInfoList, DataLatencyComparer.Instance).Count); + } + + [TestMethod] + public void TestNetworkRequestSamplerForLessThanThresholdSize() + { + int numberOfElementsInEachGroup = ClientTelemetryOptions.NetworkRequestsSampleSizeThreshold; + int numberOfGroups = 3; + + List requestInfoList = new List(); + + for (int counter = 0; counter < 10; counter++) + { + RequestInfo requestInfo = new RequestInfo() + { + DatabaseName = "dbId " + (counter % numberOfGroups), // To repeat similar elements + ContainerName = "containerId", + Uri = "rntbd://host/partition/replica", + StatusCode = 429, + SubStatusCode = 1002, + Resource = ResourceType.Document.ToResourceTypeString(), + Operation = OperationType.Create.ToOperationTypeString(), + Metrics = new List() + { + new MetricInfo(ClientTelemetryOptions.RequestLatencyName, ClientTelemetryOptions.RequestLatencyUnit) + { + Percentiles = new Dictionary() + { + { ClientTelemetryOptions.Percentile50, 10 }, + { ClientTelemetryOptions.Percentile90, 20 }, + { ClientTelemetryOptions.Percentile95, 30 }, + { ClientTelemetryOptions.Percentile99, Random.Shared.Next(1, 100) }, + { ClientTelemetryOptions.Percentile999, 50 } + }, + Count = Random.Shared.Next(1, 100) + } + } + }; + requestInfoList.Add(requestInfo); + } + + List sampleDataByLatency = DataSampler.OrderAndSample(requestInfoList, DataLatencyComparer.Instance); + Assert.AreEqual(10, sampleDataByLatency.Count); + + List sampleDataBySampleCount = DataSampler.OrderAndSample(requestInfoList, DataSampleCountComparer.Instance); + Assert.AreEqual(10, sampleDataBySampleCount.Count); + } + + } +} diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DiagnosticsFilterHelperTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DiagnosticsFilterHelperTest.cs index 698b99524e..c04c0d6faf 100644 --- a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DiagnosticsFilterHelperTest.cs +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/DiagnosticsFilterHelperTest.cs @@ -5,10 +5,7 @@ namespace Microsoft.Azure.Cosmos.Tests.Telemetry { using System; - using System.Collections.Generic; - using System.Linq; using System.Net; - using System.Text; using System.Threading.Tasks; using Cosmos.Telemetry; using Cosmos.Telemetry.Diagnostics; diff --git a/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/NetworkDataRecorderTest.cs b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/NetworkDataRecorderTest.cs new file mode 100644 index 0000000000..c08282cd0f --- /dev/null +++ b/Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Telemetry/NetworkDataRecorderTest.cs @@ -0,0 +1,92 @@ +//------------------------------------------------------------ +// Copyright (c) Microsoft Corporation. All rights reserved. +//------------------------------------------------------------ + +namespace Microsoft.Azure.Cosmos.Tests.Telemetry +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Security.AccessControl; + using System.Text; + using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Telemetry; + using Microsoft.Azure.Cosmos.Telemetry.Models; + using Microsoft.Azure.Documents; + using Microsoft.VisualStudio.TestTools.UnitTesting; + using static Microsoft.Azure.Cosmos.Tracing.TraceData.ClientSideRequestStatisticsTraceDatum; + + [TestClass] + public class NetworkDataRecorderTest + { + [TestMethod] + public void TestRecordWithErroredAndHighLatencyRequests() + { + NetworkDataRecorder recorder = new NetworkDataRecorder(); + + List stats = new List() + { + new StoreResponseStatistics( + requestStartTime: DateTime.Now, + requestResponseTime: DateTime.Now.AddMilliseconds(10), + storeResult: StoreResult.CreateForTesting(storeResponse: new StoreResponse() + { + Status = 200 + }).Target, + resourceType: Documents.ResourceType.Document, + operationType: OperationType.Create, + requestSessionToken: default, + locationEndpoint: new Uri("https://dummy.url")), + + new StoreResponseStatistics( + requestStartTime: DateTime.Now, + requestResponseTime: DateTime.Now.AddMilliseconds(10), + storeResult: StoreResult.CreateForTesting(storeResponse: new StoreResponse() + { + Status = 401 + }).Target, + resourceType: Documents.ResourceType.Document, + operationType: OperationType.Create, + requestSessionToken: default, + locationEndpoint: new Uri("https://dummy.url")) + }; + + recorder.Record(stats, "databaseId", "containerId"); + + List highLatencyRequests = new List(); + recorder.GetHighLatencyRequests(highLatencyRequests); + Assert.AreEqual(1, highLatencyRequests.Count); + + List erroredRequests = new List(); + recorder.GetErroredRequests(erroredRequests); + Assert.AreEqual(1, erroredRequests.Count); + + // you can get the values only once + List requests = new List(); + recorder.GetHighLatencyRequests(requests); + recorder.GetErroredRequests(requests); + + Assert.AreEqual(0, requests.Count); + } + + [TestMethod] + [DataRow(200, 0, 1, false)] + [DataRow(404, 0, 1, false)] + [DataRow(404, 1002, 1, true)] + [DataRow(409, 0, 1, false)] + [DataRow(409, 1002, 1, true)] + [DataRow(503, 2001, 1, true)] + [DataRow(200, 0, 6, true)] + public void CheckEligibleStatistics(int statusCode, int subStatusCode, int latencyInMs, bool expectedFlag) + { + Assert.AreEqual(expectedFlag, NetworkDataRecorderTest.IsEligible(statusCode, subStatusCode, TimeSpan.FromMilliseconds(latencyInMs))); + } + + private static bool IsEligible(int statusCode, int subStatusCode, TimeSpan latencyInMs) + { + return + NetworkDataRecorder.IsStatusCodeNotExcluded(statusCode, subStatusCode) && + (NetworkDataRecorder.IsUserOrServerError(statusCode) || NetworkDataRecorder.IsHighLatency(latencyInMs.TotalMilliseconds)); + } + } +} diff --git a/README.md b/README.md index 1d39e6e204..f1dcffa7b9 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ # Microsoft Azure Cosmos DB .NET SDK Version 3 -This client library enables client applications to connect to Azure Cosmos via the SQL API. Azure Cosmos is a globally distributed, multi-model database service. For more information, refer to https://azure.microsoft.com/services/cosmos-db/. +This client library enables client applications to connect to Azure Cosmos DB for NoSQL. Azure Cosmos DB is a globally distributed, multi-model database service. For more information, refer to https://azure.microsoft.com/services/cosmos-db/. ```csharp CosmosClient client = new CosmosClient("https://mycosmosaccount.documents.azure.com:443/", "mysupersecretkey"); @@ -45,7 +45,7 @@ using (FeedIterator feedIterator = container.GetItemQueryIterator Recommended version -The **minimum recommended version is [3.31.0](#3.31.0)**. +The **minimum recommended version is [3.33.0](#3.33.0)**. Make sure that your applications, when using the .NET V3 SDK, are using at least the version described here to have all the critical fixes. @@ -13,6 +13,36 @@ Preview features are treated as a separate branch and will not be included in th The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +### [3.33.0-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.33.0-preview) - 2023-04-21 + +### Added + +- [3672](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3672) PriorityBasedExecution: Added PriorityLevel as a RequestOption + +### [3.33.0](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.33.0) - 2023-04-21 + +#### Fixed +- [3762](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3762) HttpClient: Adds detection of DNS changes through use of SocketsHttpHandler for .NET 6 and above +- [3707](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3707) Diagnostics: Adds startDate in Summary +- [3457](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3457) Documentation: Update Database.ReadAsync description +- [3730](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3730) Query: Fixes System.ArgumentException when using PartitionKey.None on x86, Linux or in Optimistic Direct Execution +- [3775](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3775) Change Feed Processor: Fixes LeaseLostException leaks on notification APIs for Renew scenarios +- [3792](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3792) Diagnostics: Refactors Code to Remove Dependency of HttpResponseHeadersWrapper to fetch Sub Status Codes +- [3793](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3793) Documentation: Refactors SQL API reference to NoSQL API +- [3814](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3814) Serialization: Fixes call to CosmosSerializer.FromStream on Gateway mode when EnableContentResponseOnWrite is false. (Thanks @Baltima) + +#### Added +- [3109](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3109), [3763](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3763) Subpartitioning: Adds support for Prefix Partition Key searches for sub partitioned containers, and APIs for public release and increase REST API version +- [3803](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3803) HttpClient: Adds Properties to the Http messages if available +- [3389](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3389) Patch: Adds Move Operation + +### [3.32.3](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.32.3) - 2023-03-30 +### [3.32.3-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.32.3-preview) - 2023-03-30 + +#### Fixed + +- [#3787](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3787) Connectivity: Fixes ConnectionBroken and adds support for Burst Capacity + ### [3.32.2](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.32.2) - 2023-03-10 ### [3.32.2-preview](https://www.nuget.org/packages/Microsoft.Azure.Cosmos/3.32.2-preview) - 2023-03-10 @@ -1110,7 +1140,7 @@ Below is a list of any know issues affecting the [recommended minimum version](# Microsoft provides notification at least **12 months** in advance of retiring an SDK in order to smooth the transition to a newer/supported version. New features and functionality and optimizations are only added to the current SDK, as such it is recommended that you always upgrade to the latest SDK version as early as possible. -After **31 August 2022**, Azure Cosmos DB will no longer make bug fixes, add new features, and provide support for versions 1.x of the Azure Cosmos DB .NET or .NET Core SDK for SQL API. If you prefer not to upgrade, requests sent from version 1.x of the SDK will continue to be served by the Azure Cosmos DB service. +After **31 August 2022**, Azure Cosmos DB will no longer make bug fixes, add new features, and provide support for versions 1.x of the Azure Cosmos DB for NoSQL .NET or .NET Core SDK. If you prefer not to upgrade, requests sent from version 1.x of the SDK will continue to be served by the Azure Cosmos DB service. | Version | Release Date | Retirement Date | | --- | --- | --- | diff --git a/docs/builds-and-pipelines.md b/docs/builds-and-pipelines.md new file mode 100644 index 0000000000..0747982783 --- /dev/null +++ b/docs/builds-and-pipelines.md @@ -0,0 +1,73 @@ +# Build pipelines for the Azure Cosmos DB .NET SDK + +This repository contains 6 pipelines that are used on different scenarios. + +## PR Validation + +[azure-pipelines.yml](../azure-pipelines.yml) defines the checks that are performed during a PR validation, it covers: + +* [Static analysis](../templates/static-tools.yml) +* [Verifying if the state of the SDK package is valid / can we generate a Nuget package](../templates/nuget-pack.yml) +* [Verify if the CTL runner builds](../templates/build-ctl.yml) -> [CTL Runner source](../Microsoft.Azure.Cosmos.Samples/Tools/CTL). +* [Verify if the Samples build](../templates/build-samples.yml) -> [Samples folder source](../Microsoft.Azure.Cosmos.Samples/Usage). +* [Run the Unit and Emulator tests](../templates/build-test.yml) -> For more information about tests, see the [CONTRIBUTING guide](../CONTRIBUTING.md#tests). +* [Verify the project builds with INTERNAL flag](../templates/build-internal.yml) -> INTERNAL is used for service dogfooding and for friends assembly access. +* [Verify the project builds with the PREVIEW flag, Unit tests for PREVIEW pass, Encryption and Benchmark projects for PREVIEW build](../templates/build-preview.yml) -> PREVIEW is used to ship the `-preview` SDK package. +* [Verify the Benchmark project builds, including PREVIEW flag build](../templates/build-benchmark.yml) -> [Benchmark project](../Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/README.md) enables users to execute benchmark runs on their accounts. + +This pipeline executes on Azure Pipelines as [dotnet-v3-ci](https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build?definitionId=63). + +## SDK release + +[azure-pipelines-official.yml](../azure-pipelines-official.yml) is used during the release process of a new version: + +* [Static analysis](../templates/static-tools.yml) +* [Run the Unit and Emulator tests](../templates/build-test.yml) -> For more information about tests, see the [CONTRIBUTING guide](../CONTRIBUTING.md#tests). +* [Generate a Nuget package, and a Symbols package, and publish it on the `cosmosdb/csharp/` storage container](../templates/nuget-pack.yml) the Nuget version will be what is defined on [Directory.Build.Props](../Directory.Build.props). Template parameters: ReleasePackage = true, CleanupFolder = false, BlobVersion = `` + +This pipeline executes on Azure Pipelines as [dotnet-v3-release](https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build?definitionId=65). + +## Nightly release + +[azure-pipelines-nightly.yml](../azure-pipelines-nightly.yml) is a scheduled run that executes every day at 0:00 UTC and produces two Nuget packages with the content on the `master` branch: + +* A non-preview package with versioning `Microsoft.Azure.Cosmos.X.Y.Z-nightly-DATE` where `X.Y.Z` is the current version from [Directory.Build.Props](../Directory.Build.props) and `DATE` is the current date in `MMDDYYYY` format. +* A preview package with versioning `Microsoft.Azure.Cosmos.X.Y.Z-preview-nightly-DATE` where `X.Y.Z` is the current version from [Directory.Build.Props](../Directory.Build.props) and `DATE` is the current date in `MMDDYYYY` format. + +The pipeline will: + +* [Generate a nightly Nuget package and publish it on the `cosmosdb/csharp/nightly` storage container and delete previous contents](../templates/nuget-pack.yml). Template parameters: ReleasePackage = true, CleanupFolder = true, BlobVersion = nightly. +* [Generate a preview nightly Nuget package and publish it on the `cosmosdb/csharp/nightly-preview` storage container and delete previous contents](../templates/nuget-pack.yml). Template parameters: ReleasePackage = true, CleanupFolder = true, BlobVersion = nightly-preview. + +This pipeline executes on Azure Pipelines as [dotnet-v3-nightly](https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build?definitionId=75). + +## Docker image for CTL workloads + +[azure-pipelines-ctl-publishing.yml](../azure-pipelines-ctl-publishing.yml) executes every time a change is merged into `master` and it will: + +* Generate [docker config files](../Microsoft.Azure.Cosmos.Samples/Tools/CTL/Dockerfile). +* Copy the [executable shell file](../Microsoft.Azure.Cosmos.Samples/Tools/CTL/run_ctl.sh). +* Build and publish as a binary [the CTL project](../Microsoft.Azure.Cosmos.Samples/Tools/CTL/CosmosCTL.csproj). +* Execute docker build and publish the image to the team's Azure Container Instances container. + +This pipeline executes on Azure Pipelines as [dotnet-v3-ctl-image-publish](https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build?definitionId=64). + +## Encryption packages release + +This repository also includes the [Microsoft.Azure.Cosmos.Encryption](../Microsoft.Azure.Cosmos.Encryption/) and [Microsoft.Azure.Cosmos.Encryption.Custom](../Microsoft.Azure.Cosmos.Encryption.Custom/) projects as satellite packages for client side encryption. + +[azure-pipelines-encryption](../azure-pipelines-encryption.yml) is used during the release process for a new `Microsoft.Azure.Cosmos.Encryption` release: + +* Builds the [Microsoft.Azure.Cosmos.Encryption](../Microsoft.Azure.Cosmos.Encryption/src/Microsoft.Azure.Cosmos.Encryption.csproj) +* Generate a Nuget package and a Symbols package +* Publish the package on the `cosmosdb/csharp/encryption/` storage container. + +This pipeline executes on Azure Pipelines as [dotnet-v3-encryption-release](https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build?definitionId=66). + +[azure-pipelines-encryption-custom](../azure-pipelines-encryption-custom.yml) is used during the release process for a new `Microsoft.Azure.Cosmos.Encryption.Custom` release: + +* Builds the [Microsoft.Azure.Cosmos.Encryption.Custom](../Microsoft.Azure.Cosmos.Encryption.Custom/src/Microsoft.Azure.Cosmos.Encryption.Custom.csproj) +* Generate a Nuget package and a Symbols package +* Publish the package on the `cosmosdb/csharp/encryption.custom/` storage container. + +This pipeline executes on Azure Pipelines as [dotnet-v3-encryption-custom-release](https://cosmos-db-sdk-public.visualstudio.com/cosmos-db-sdk-public/_build?definitionId=67). diff --git a/docs/sync_up_msdata_direct.md b/docs/sync_up_msdata_direct.md new file mode 100644 index 0000000000..9c416aa65b --- /dev/null +++ b/docs/sync_up_msdata_direct.md @@ -0,0 +1,93 @@ +# Update msdata/direct Repo with Cosmos v3 and Direct Codebase + +## Table of Contents + +* [Background.](#background) +* [Prerequisites.](#prerequisites) +* [Steps Required to Update msdata direct Repo.](#steps-required-to-update-msdata-direct-repo) +* [Validating the sync-up.](#validating-the-sync-up) +* [Submit Pull Request to msdata direct.](#submit-pull-request-to-msdata-direct) +* [Sample Pull Requests to Sync-up msdata direct.](#sample-pull-requests-to-sync-up-msdata-direct) + +## Background + +As a developer on the Cosmos SDK team, we often engage in a task, that requires code changes in both cosmos dotnet sdk v3 repository, as well as in the `msdata` cosmosdb direct codebase (aka `Microsoft.Azure.Cosmos.Direct` namespace). Therefore, sometimes it's utterly challenging to visualize the code changes as a whole, and analyze the impacts. To overcome this, we have created a branch called `msdata/direct` within our cosmos dotnet sdk v3 codebase, that basically mimics the code present in `msdata` repository mentioned above. This simplifies the code changes required to be done in both, provides much better understanding on the overall impacts of the code changes and gives transparency to users in terms of what is the source code for the `Microsoft.Azure.Cosmos.Direct` package. + +## Prerequisites + +Before covering the sync-up process in detail, please follow the below steps to make sure all the required pre-requisites are met. + +### Clone the Azure Cosmos DB .NET SDK Version 3 Repo + +- Clone the azure `cosmos-db dotnet sdk` repo in the local environment, using the below git command: + - git clone https://github.com/Azure/azure-cosmos-dotnet-v3.git + +- Navigate to the directory `azure-cosmos-dotnet-v3` and check out the following branch, `msdata/direct` using the below git commands: + - git pull && git checkout msdata/direct + +### Clone the `CosmosDB` Repo hosted in msdata + +- Clone the CosmosDB repository in the local environment, using the CosmosDB onboarding guide. Please note, building the entire repository is not required for the sync-up process. + +- Navigate to the cloned `CosmosDB` directory and check out the following branch, `master` using the below git commands: + - git pull && git checkout master + +## Steps Required to Update msdata direct Repo + +### Create a Feature Branch for Local Changes. + +The first step to sync up the `msdata/direct` repo is to create a feature branch out of it, where all the required changes could be made. Later on, we will use the feature branch to submit pull request to `msdata/direct`. Please use the following git command to create the feature branch: + +- Stay on the `msdata/direct` branch and run `git checkout -b users//update_msdata_direct_` to create the feature branch. + +### Merging the cosmos db v3 Code into Feature Branch. + +The next step is to port the latest `master` branch code into the newly created feature branch. Please see the below git commands to perform this action: + +- Make sure the `master` branch is up-to-date. +- Stay on the newly created feature branch `users//update_msdata_direct_` and run `git merge master`. +- There are likely to be conflicts during the merge. If that happens, we will need to resolve the conflicts gracefully by accepting the incoming `master` branch changes. + +### Pick the Required Microsoft Azure Cosmos.Direct files into `msdata/direct` repo. + +This is the last part for the sync-up process. Please follow the below steps to copy the required `Microsoft.Cosmos.Direct` files from msdata CosmosDB repo. + +- Open command prompt/windows terminal and navigate to the following directory `Microsoft.Azure.Cosmos\src\direct` inside the cloned cosmos v3 repo. +- Locate and edit the following line in the `msdata_sync.ps1` script with the respective location of the msdata repo: `$baseDir = "\CosmosDB"` +- Run the powershell script using: `.\msdata_sync.ps1`. You will notice the script started copying the required files from the msdata repo, and generating the console logs, like the below: + + ``` + Copying Files: rntbd2 + Copying Files: AccessCondition.cs + Copying Files: AccessConditionType.cs + Copying Files: Address.cs + Copying Files: AddressCacheToken.cs + Copying Files: AddressEnumerator.cs + Copying Files: AddressInformation.cs + Copying Files: AddressSelector.cs + Copying Files: ApiType.cs + Copying Files: Attachment.cs + Copying Files: AuthorizationTokenType.cs + Copying Files: BackoffRetryUtility.cs + Copying Files: BadRequestException.cs + Copying Files: BarrierRequestHelper.cs + ``` + +- Note: There may be instances where some of the files could be missing in the v3 `msdata/direct` repo and the copy may fail with the following error: `Write-Error: SystemSynchronizationScope.cs False`. If that happens, please copy the file manually from the `msdata/CosmosDB` repo and continue running the script all over again. + +## Validating the sync-up + +One of the most important part in the whole `msdata/direct` sync up process is to validate whether the code merges, conflict resolutions and file updates went successfully. To comply with this, please make sure to follow the below steps: + +- Open command prompt/ windows terminal and navigate to the directory where the cosmos v3 code is located, for instance `C:\stash\azure-cosmos-dotnet-v3`. +- Make sure to stay on the newly created feature branch. +- Stay on the same directory mentioned above, and run the following command for a clean build: `dotnet build`. Make sure, the build passes successfully. + +## Submit Pull Request to msdata direct + +Once the feature branch builds successfully, it's time to submit the PR to `msdata/direct` to complete the sync-up process. To do this, please follow `git add`, `git commit` and `git push` commands to push the newly created branch upstream. Once the branch is pushed, please submit the pull request to the `msdata/direct` branch and seek for approvals. + +## Sample Pull Requests to Sync-up msdata direct + +- [[Internal] Msdata/Direct: Refactors msdata branch with latest v3 and direct release](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3726) +- [[Internal] Msdata/Direct: Refactors msdata/direct branch with latest v3 master and Cosmos.Direct v3.30.4](https://github.com/Azure/azure-cosmos-dotnet-v3/pull/3776) \ No newline at end of file diff --git a/templates/build-benchmark.yml b/templates/build-benchmark.yml index 7e73842ee1..b542231b8c 100644 --- a/templates/build-benchmark.yml +++ b/templates/build-benchmark.yml @@ -31,4 +31,29 @@ jobs: nugetConfigPath: NuGet.config projects: 'Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/CosmosBenchmark.sln' arguments: -p:Optimize=true -p:OSSProjectRef=true + versioningScheme: OFF +- job: + displayName: Preview CosmosBenchmark ${{ parameters.BuildConfiguration }} + pool: + vmImage: ${{ parameters.VmImage }} + + steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching + + # Add this Command to Include the .NET 6 SDK + - task: UseDotNet@2 + displayName: Use .NET 6.0 + inputs: + packageType: 'sdk' + version: '6.x' + + - task: DotNetCoreCLI@2 + displayName: Build Microsoft.Azure.CosmosBenchmark + inputs: + command: build + configuration: $(parameters.BuildConfiguration) + nugetConfigPath: NuGet.config + projects: 'Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/CosmosBenchmark.sln' + arguments: -p:Optimize=true -p:IsPreview=true -p:OSSProjectRef=true versioningScheme: OFF \ No newline at end of file diff --git a/templates/build-preview.yml b/templates/build-preview.yml index e9919878ff..5ce991a148 100644 --- a/templates/build-preview.yml +++ b/templates/build-preview.yml @@ -142,30 +142,4 @@ jobs: arguments: ${{ parameters.Arguments }} --configuration ${{ parameters.BuildConfiguration }} /p:IsPreview=true /p:OS=${{ parameters.OS }} publishTestResults: true nugetConfigPath: NuGet.config - testRunTitle: Microsoft.Azure.Cosmos.Tests - -- job: - displayName: Preview CosmosBenchmark ${{ parameters.BuildConfiguration }} - pool: - vmImage: ${{ parameters.VmImage }} - - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # if true, execute `execute git clean -ffdx && git reset --hard HEAD` before fetching - - # Add this Command to Include the .NET 6 SDK - - task: UseDotNet@2 - displayName: Use .NET 6.0 - inputs: - packageType: 'sdk' - version: '6.x' - - - task: DotNetCoreCLI@2 - displayName: Build Microsoft.Azure.CosmosBenchmark - inputs: - command: build - configuration: $(parameters.BuildConfiguration) - nugetConfigPath: NuGet.config - projects: 'Microsoft.Azure.Cosmos.Samples/Tools/Benchmark/CosmosBenchmark.sln' - arguments: -p:Optimize=true -p:IsPreview=true -p:OSSProjectRef=true - versioningScheme: OFF \ No newline at end of file + testRunTitle: Microsoft.Azure.Cosmos.Tests \ No newline at end of file diff --git a/templates/nuget-pack.yml b/templates/nuget-pack.yml index 874676d3e1..095b1b52ff 100644 --- a/templates/nuget-pack.yml +++ b/templates/nuget-pack.yml @@ -1,13 +1,27 @@ # File: templates/nuget-pack.yml parameters: - BuildConfiguration: '' - Arguments: '' - VmImage: '' # https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops - OS: 'Windows' - OutputPath: '' - ReleasePackage: false - BlobVersion: '' + - name: BuildConfiguration + type: string + default: '' + - name: Arguments + type: string + default: '' + - name: VmImage + type: string + default: '' + - name: OutputPath + type: string + default: '' + - name: BlobVersion + type: string + default: '' + - name: ReleasePackage + type: boolean + default: false + - name: CleanupFolder + type: boolean + default: false jobs: - job: GenerateNugetPackages @@ -23,7 +37,7 @@ jobs: configuration: $(BuildConfiguration) nugetConfigPath: NuGet.config projects: Microsoft.Azure.Cosmos/src/Microsoft.Azure.Cosmos.csproj - arguments: --configuration ${{ parameters.BuildConfiguration }} -p:Optimize=true + arguments: --configuration ${{ parameters.BuildConfiguration }} -p:Optimize=true ${{ parameters.Arguments }} versioningScheme: OFF - task: DotNetCoreCLI@2 @@ -32,7 +46,7 @@ jobs: command: custom projects: 'Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj' custom: pack - arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --no-restore -o "${{ parameters.OutputPath }}"' + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' - ${{ if eq(parameters.ReleasePackage, true) }}: - task: DotNetCoreCLI@2 @@ -41,26 +55,25 @@ jobs: command: custom projects: 'Microsoft.Azure.Cosmos\src\Microsoft.Azure.Cosmos.csproj' custom: pack - arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --include-symbols /p:SymbolPackageFormat=snupkg --no-restore -o "${{ parameters.OutputPath }}"' + arguments: '-v detailed -c ${{ parameters.BuildConfiguration }} --no-build --include-symbols /p:SymbolPackageFormat=snupkg ${{ parameters.Arguments }} --no-restore -o "${{ parameters.OutputPath }}"' - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 inputs: BuildDropPath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' - - task: AzureFileCopy@2 - displayName: ' Copy Artifacts to Azure SDK Release blob storage' - condition: and(succeeded(),ne(${{ parameters.BlobVersion }}, '')) - inputs: - SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos' - azureSubscription: azuresdkpartnerdrops - Destination: AzureBlob - storage: azuresdkpartnerdrops - ContainerName: 'drops' - BlobPrefix: 'cosmosdb/csharp/$(BlobVersion)' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos' - inputs: - artifactName: Microsoft.Azure.Cosmos + - ${{ if ne(parameters.BlobVersion, '') }}: + - task: AzureFileCopy@5 + displayName: 'Copy Artifacts to Azure SDK Release blob storage' + condition: succeeded() + inputs: + SourcePath: '$(Build.ArtifactStagingDirectory)/bin/AnyCPU/$(BuildConfiguration)/Microsoft.Azure.Cosmos/**' + azureSubscription: azuresdkpartnerdrops + Destination: AzureBlob + storage: azuresdkpartnerdrops + ContainerName: 'drops' + BlobPrefix: 'cosmosdb/csharp/${{ parameters.BlobVersion }}' + CleanTargetBeforeCopy: ${{ parameters.CleanupFolder }} - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' + - task: PublishBuildArtifacts@1 + displayName: 'Publish Artifacts: Microsoft.Azure.Cosmos' + inputs: + artifactName: Microsoft.Azure.Cosmos