From 294631884d2531a6d5c091ebb10a21260795e22d Mon Sep 17 00:00:00 2001 From: Malhar Khimsaria Date: Tue, 29 Oct 2024 18:14:27 -0700 Subject: [PATCH] Update document model async operations --- .../_async/DocumentBatchGet.Async.cs | 17 +- .../_async/DocumentBatchWrite.Async.cs | 20 +- .../_async/DocumentTransactGet.Async.cs | 17 +- .../_async/DocumentTransactWrite.Async.cs | 17 +- .../DocumentModel/_async/Search.Async.cs | 17 +- .../DocumentModel/_async/Table.Async.cs | 195 +++++++++++++----- 6 files changed, 214 insertions(+), 69 deletions(-) diff --git a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchGet.Async.cs b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchGet.Async.cs index a0ef642ab898..ed2a5a0c36f9 100644 --- a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchGet.Async.cs +++ b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchGet.Async.cs @@ -14,6 +14,7 @@ */ #pragma warning disable 1574 +using Amazon.Runtime.Telemetry.Tracing; using System.Threading; using System.Threading.Tasks; @@ -33,9 +34,13 @@ public partial interface IDocumentBatchGet public partial class DocumentBatchGet : IDocumentBatchGet { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(DocumentBatchGet), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } } } @@ -53,9 +58,13 @@ public partial interface IMultiTableDocumentBatchGet public partial class MultiTableDocumentBatchGet : IMultiTableDocumentBatchGet { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(MultiTableDocumentBatchGet), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } } } } diff --git a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchWrite.Async.cs b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchWrite.Async.cs index aa791aceb1e8..9ab7086eb410 100644 --- a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchWrite.Async.cs +++ b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentBatchWrite.Async.cs @@ -35,9 +35,15 @@ public partial interface IDocumentBatchWrite public partial class DocumentBatchWrite : IDocumentBatchWrite { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + { + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(DocumentBatchWrite), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } + } } } @@ -57,9 +63,15 @@ public partial interface IMultiTableDocumentBatchWrite public partial class MultiTableDocumentBatchWrite : IMultiTableDocumentBatchWrite { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + { + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(MultiTableDocumentBatchWrite), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } + } } } } diff --git a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactGet.Async.cs b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactGet.Async.cs index 3a3a3239c3ca..b50b371153d8 100644 --- a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactGet.Async.cs +++ b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactGet.Async.cs @@ -13,6 +13,7 @@ * permissions and limitations under the License. */ +using Amazon.Runtime.Telemetry.Tracing; using System.Threading; using System.Threading.Tasks; @@ -36,9 +37,13 @@ public partial interface IDocumentTransactGet public partial class DocumentTransactGet : IDocumentTransactGet { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(DocumentTransactGet), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } } } @@ -56,9 +61,13 @@ public partial interface IMultiTableDocumentTransactGet public partial class MultiTableDocumentTransactGet : IMultiTableDocumentTransactGet { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(MultiTableDocumentTransactGet), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } } } } diff --git a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactWrite.Async.cs b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactWrite.Async.cs index 18b39e01c350..dee87f4f792e 100644 --- a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactWrite.Async.cs +++ b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/DocumentTransactWrite.Async.cs @@ -13,6 +13,7 @@ * permissions and limitations under the License. */ +using Amazon.Runtime.Telemetry.Tracing; using System.Threading; using System.Threading.Tasks; @@ -31,9 +32,13 @@ public partial interface IDocumentTransactWrite public partial class DocumentTransactWrite : IDocumentTransactWrite { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(DocumentTransactWrite), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } } } @@ -50,9 +55,13 @@ public partial interface IMultiTableDocumentTransactWrite public partial class MultiTableDocumentTransactWrite : IMultiTableDocumentTransactWrite { /// - public Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task ExecuteAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return ExecuteHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(MultiTableDocumentTransactWrite), nameof(ExecuteAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + await ExecuteHelperAsync(cancellationToken).ConfigureAwait(false); + } } } } diff --git a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Search.Async.cs b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Search.Async.cs index 575fafe3b4f2..1a733b30904e 100644 --- a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Search.Async.cs +++ b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Search.Async.cs @@ -14,6 +14,7 @@ */ #pragma warning disable 1574 +using Amazon.Runtime.Telemetry.Tracing; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; @@ -46,15 +47,23 @@ public partial interface ISearch public partial class Search : ISearch { /// - public Task> GetNextSetAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetNextSetAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return GetNextSetHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Search), nameof(GetNextSetAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetNextSetHelperAsync(cancellationToken).ConfigureAwait(false); + } } /// - public Task> GetRemainingAsync(CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetRemainingAsync(CancellationToken cancellationToken = default(CancellationToken)) { - return GetRemainingHelperAsync(cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Search), nameof(GetRemainingAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetRemainingHelperAsync(cancellationToken).ConfigureAwait(false); + } } } } diff --git a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Table.Async.cs b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Table.Async.cs index adca09ba7bef..63b37ad4165b 100644 --- a/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Table.Async.cs +++ b/sdk/src/Services/DynamoDBv2/Custom/DocumentModel/_async/Table.Async.cs @@ -25,6 +25,7 @@ using System.Collections.ObjectModel; using System.Threading.Tasks; using Amazon.Runtime.Internal; +using Amazon.Runtime.Telemetry.Tracing; namespace Amazon.DynamoDBv2.DocumentModel { @@ -271,16 +272,24 @@ public partial class Table : ITable #region PutItemAsync /// - public Task PutItemAsync(Document doc, CancellationToken cancellationToken = default(CancellationToken)) + public async Task PutItemAsync(Document doc, CancellationToken cancellationToken = default(CancellationToken)) { - return PutItemHelperAsync(doc, null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(PutItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await PutItemHelperAsync(doc, null, cancellationToken).ConfigureAwait(false); + } } /// - public Task PutItemAsync(Document doc, PutItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task PutItemAsync(Document doc, PutItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return PutItemHelperAsync(doc, config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(PutItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await PutItemHelperAsync(doc, config, cancellationToken).ConfigureAwait(false); + } } #endregion @@ -288,40 +297,64 @@ public partial class Table : ITable #region GetItemAsync /// - public Task GetItemAsync(Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetItemAsync(Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken)) { - return GetItemHelperAsync(MakeKey(hashKey, null), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(GetItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetItemHelperAsync(MakeKey(hashKey, null), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task GetItemAsync(Primitive hashKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetItemAsync(Primitive hashKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return GetItemHelperAsync(MakeKey(hashKey, null), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(GetItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetItemHelperAsync(MakeKey(hashKey, null), config, cancellationToken).ConfigureAwait(false); + } } /// - public Task GetItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken)) { - return GetItemHelperAsync(MakeKey(hashKey, rangeKey), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(GetItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetItemHelperAsync(MakeKey(hashKey, rangeKey), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetItemAsync(Primitive hashKey, Primitive rangeKey, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return GetItemHelperAsync(MakeKey(hashKey, rangeKey), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(GetItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetItemHelperAsync(MakeKey(hashKey, rangeKey), config, cancellationToken).ConfigureAwait(false); + } } /// - public Task GetItemAsync(IDictionary key, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetItemAsync(IDictionary key, CancellationToken cancellationToken = default(CancellationToken)) { - return GetItemHelperAsync(MakeKey(key), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(GetItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetItemHelperAsync(MakeKey(key), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task GetItemAsync(IDictionary key, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task GetItemAsync(IDictionary key, GetItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return GetItemHelperAsync(MakeKey(key), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(GetItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await GetItemHelperAsync(MakeKey(key), config, cancellationToken).ConfigureAwait(false); + } } #endregion @@ -329,51 +362,83 @@ public partial class Table : ITable #region UpdateItemAsync /// - public Task UpdateItemAsync(Document doc, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, null, null, null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, null, null, null, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, null, null, config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, null, null, config, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, IDictionary key, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, IDictionary key, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, MakeKey(key), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, MakeKey(key), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, IDictionary key, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, IDictionary key, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, MakeKey(key), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, MakeKey(key), config, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, hashKey, null, null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, hashKey, null, null, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, Primitive hashKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, Primitive hashKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, hashKey, null, config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, hashKey, null, config, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, hashKey, rangeKey, null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, hashKey, rangeKey, null, cancellationToken).ConfigureAwait(false); + } } /// - public Task UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task UpdateItemAsync(Document doc, Primitive hashKey, Primitive rangeKey, UpdateItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return UpdateHelperAsync(doc, hashKey, rangeKey, config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(UpdateItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await UpdateHelperAsync(doc, hashKey, rangeKey, config, cancellationToken).ConfigureAwait(false); + } } @@ -382,53 +447,85 @@ public partial class Table : ITable #region DeleteItemAsync /// - public Task DeleteItemAsync(Document document, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(Document document, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(document), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(document), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(Document document, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(Document document, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(document), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(document), config, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(Primitive hashKey, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(hashKey, null), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(hashKey, null), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(Primitive hashKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(Primitive hashKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(hashKey, null), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(hashKey, null), config, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(Primitive hashKey, Primitive rangeKey, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(hashKey, rangeKey), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(hashKey, rangeKey), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(Primitive hashKey, Primitive rangeKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(Primitive hashKey, Primitive rangeKey, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(hashKey, rangeKey), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(hashKey, rangeKey), config, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(IDictionary key, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(IDictionary key, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(key), null, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(key), null, cancellationToken).ConfigureAwait(false); + } } /// - public Task DeleteItemAsync(IDictionary key, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteItemAsync(IDictionary key, DeleteItemOperationConfig config, CancellationToken cancellationToken = default(CancellationToken)) { - return DeleteHelperAsync(MakeKey(key), config, cancellationToken); + var operationName = DynamoDBTelemetry.ExtractOperationName(nameof(Table), nameof(DeleteItemAsync)); + using (DynamoDBTelemetry.CreateSpan(TracerProvider, operationName, spanKind: SpanKind.CLIENT)) + { + return await DeleteHelperAsync(MakeKey(key), config, cancellationToken).ConfigureAwait(false); + } } - + #endregion }