diff --git a/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs b/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs
index cecf1fd778..d9092d32f7 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/BatchCore.cs
@@ -10,6 +10,7 @@ namespace Microsoft.Azure.Cosmos
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Documents;
internal class BatchCore : TransactionalBatchInternal
@@ -18,6 +19,11 @@ internal class BatchCore : TransactionalBatchInternal
private readonly ContainerInternal container;
+ ///
+ /// The list of operations in the batch.
+ ///
+ protected List operations;
+
///
/// Initializes a new instance of the class.
///
@@ -29,6 +35,8 @@ internal BatchCore(
{
this.container = container;
this.partitionKey = partitionKey;
+
+ this.operations = new List();
}
public override TransactionalBatch CreateItem(
@@ -40,7 +48,7 @@ public override TransactionalBatch CreateItem(
throw new ArgumentNullException(nameof(item));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Create,
operationIndex: this.operations.Count,
resource: item,
@@ -59,7 +67,7 @@ public override TransactionalBatch CreateItemStream(
throw new ArgumentNullException(nameof(streamPayload));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Create,
operationIndex: this.operations.Count,
resourceStream: streamPayload,
@@ -78,7 +86,7 @@ public override TransactionalBatch ReadItem(
throw new ArgumentNullException(nameof(id));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Read,
operationIndex: this.operations.Count,
id: id,
@@ -97,7 +105,7 @@ public override TransactionalBatch UpsertItem(
throw new ArgumentNullException(nameof(item));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Upsert,
operationIndex: this.operations.Count,
resource: item,
@@ -116,7 +124,7 @@ public override TransactionalBatch UpsertItemStream(
throw new ArgumentNullException(nameof(streamPayload));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Upsert,
operationIndex: this.operations.Count,
resourceStream: streamPayload,
@@ -141,7 +149,7 @@ public override TransactionalBatch ReplaceItem(
throw new ArgumentNullException(nameof(item));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Replace,
operationIndex: this.operations.Count,
id: id,
@@ -167,7 +175,7 @@ public override TransactionalBatch ReplaceItemStream(
throw new ArgumentNullException(nameof(streamPayload));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Replace,
operationIndex: this.operations.Count,
id: id,
@@ -187,7 +195,7 @@ public override TransactionalBatch DeleteItem(
throw new ArgumentNullException(nameof(id));
}
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Delete,
operationIndex: this.operations.Count,
id: id,
@@ -232,10 +240,7 @@ public override Task ExecuteAsync(
this.operations = new List();
return executor.ExecuteAsync(trace, cancellationToken);
},
- openTelemetry: (response) => new OpenTelemetryResponse(
- responseMessage: response,
- isHomogenousOperations: this.isHomogenousOperations,
- batchOperation: this.homogenousOperation));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ExecuteBatch, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
///
@@ -250,7 +255,7 @@ public virtual TransactionalBatch PatchItemStream(
Stream patchStream,
TransactionalBatchPatchItemRequestOptions requestOptions = null)
{
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Patch,
operationIndex: this.operations.Count,
id: id,
@@ -286,7 +291,7 @@ public override TransactionalBatch PatchItem(
PatchSpec patchSpec = new PatchSpec(patchOperations, requestOptions);
- this.AddOperation(new ItemBatchOperation(
+ this.operations.Add(new ItemBatchOperation(
operationType: OperationType.Patch,
operationIndex: this.operations.Count,
id: id,
diff --git a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchInternal.cs b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchInternal.cs
index aa6c72189b..e5120ddf5a 100644
--- a/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchInternal.cs
+++ b/Microsoft.Azure.Cosmos/src/Batch/TransactionalBatchInternal.cs
@@ -5,8 +5,6 @@
namespace Microsoft.Azure.Cosmos
{
using System.Collections.Generic;
- using System.Linq;
- using Microsoft.Azure.Documents;
///
/// Represents an internal abstract class for handling transactional batches of operations.
@@ -15,47 +13,5 @@ namespace Microsoft.Azure.Cosmos
///
internal abstract class TransactionalBatchInternal : TransactionalBatch
{
- ///
- /// The list of operations in the batch.
- ///
- protected List operations;
-
- ///
- /// Initializes a new instance of the class.
- ///
- public TransactionalBatchInternal()
- {
- this.operations = new List();
- }
-
- ///
- /// Indicates whether all operations in the batch are of the same type.
- ///
- internal bool isHomogenousOperations = true;
-
- ///
- /// Stores the operation type if all operations in the batch are of the same type; otherwise, null.
- ///
- internal OperationType? homogenousOperation = null;
-
- ///
- /// Adds an operation to the batch.
- ///
- /// The operation to add to the batch.
- ///
- /// This method performs the following actions:
- /// 1. Checks if the batch is homogeneous (all operations of the same type) and if the new operation's type matches the type of the existing operations.
- /// 2. Updates the flag and the property based on the check.
- /// 3. Adds the operation to the list of operations.
- ///
- protected void AddOperation(ItemBatchOperation itemBatchOperation)
- {
- if (this.isHomogenousOperations && this.operations.Count > 0)
- {
- this.isHomogenousOperations = this.operations.First().OperationType == itemBatchOperation.OperationType;
- this.homogenousOperation = this.isHomogenousOperations ? itemBatchOperation.OperationType : null;
- }
- this.operations.Add(itemBatchOperation);
- }
}
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs
index 637186a7c1..5f722e16ed 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedIteratorCore.cs
@@ -13,6 +13,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
using Microsoft.Azure.Cosmos.Pagination;
using Microsoft.Azure.Cosmos.Query.Core;
using Microsoft.Azure.Cosmos.Query.Core.Monads;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Documents;
@@ -50,6 +51,8 @@ public ChangeFeedIteratorCore(
this.changeFeedRequestOptions = changeFeedRequestOptions ?? new ChangeFeedRequestOptions();
this.changeFeedQuerySpec = changeFeedQuerySpec;
+ this.operationName = OpenTelemetryConstants.Operations.QueryChangeFeed;
+
this.lazyMonadicEnumerator = new AsyncLazy>(
valueFactory: async (trace, cancellationToken) =>
{
@@ -226,7 +229,7 @@ public override async Task ReadNextAsync(CancellationToken canc
operationType: OperationType.ReadFeed,
requestOptions: this.changeFeedRequestOptions,
task: (trace) => this.ReadNextInternalAsync(trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response),
+ openTelemetry: new (OpenTelemetryConstants.Operations.QueryChangeFeed, (response) => new OpenTelemetryResponse(responseMessage: response)),
traceComponent: TraceComponent.ChangeFeed,
traceLevel: TraceLevel.Info);
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs
index 0456fc1d87..5a5846795a 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/ChangeFeedPartitionKeyResultSetIteratorCore.cs
@@ -9,7 +9,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.ChangeFeed.LeaseManagement;
- using Microsoft.Azure.Cosmos.CosmosElements;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Documents;
@@ -81,6 +81,8 @@ private ChangeFeedPartitionKeyResultSetIteratorCore(
this.changeFeedStartFrom = changeFeedStartFrom ?? throw new ArgumentNullException(nameof(changeFeedStartFrom));
this.clientContext = this.container.ClientContext;
this.changeFeedOptions = options;
+
+ this.operationName = OpenTelemetryConstants.Operations.QueryChangeFeed;
}
public override bool HasMoreResults => this.hasMoreResultsInternal;
@@ -99,8 +101,6 @@ public override Task ReadNextAsync(CancellationToken cancellati
operationType: Documents.OperationType.ReadFeed,
requestOptions: this.changeFeedOptions,
task: (trace) => this.ReadNextAsync(trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(
- responseMessage: response),
traceComponent: TraceComponent.ChangeFeed,
traceLevel: TraceLevel.Info);
}
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs
index e9cbcfbdfd..dc41d17d2b 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeed/StandByFeedIteratorCore.cs
@@ -11,6 +11,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos.CosmosElements;
using Microsoft.Azure.Cosmos.Routing;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Documents;
@@ -45,6 +46,8 @@ internal StandByFeedIteratorCore(
this.changeFeedOptions = options;
this.maxItemCount = maxItemCount;
this.continuationToken = continuationToken;
+
+ this.operationName = OpenTelemetryConstants.Operations.QueryChangeFeed;
}
///
diff --git a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs
index 4d1fc6fd4a..4c38ee3b21 100644
--- a/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs
+++ b/Microsoft.Azure.Cosmos/src/ChangeFeedProcessor/ChangeFeedEstimatorIterator.cs
@@ -18,6 +18,7 @@ namespace Microsoft.Azure.Cosmos.ChangeFeed
using Microsoft.Azure.Cosmos.Diagnostics;
using Microsoft.Azure.Cosmos.Query.Core;
using Microsoft.Azure.Cosmos.Query.Core.Monads;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Newtonsoft.Json.Linq;
@@ -106,6 +107,8 @@ private ChangeFeedEstimatorIterator(
this.monitoredContainerFeedCreator = monitoredContainerFeedCreator;
this.documentServiceLeaseContainer = documentServiceLeaseContainer;
+
+ this.operationName = OpenTelemetryConstants.Operations.QueryChangeFeedEstimator;
}
public override bool HasMoreResults => this.hasMoreResults;
@@ -119,7 +122,7 @@ public override Task> ReadNextAsync(Cance
operationType: Documents.OperationType.ReadFeed,
requestOptions: null,
task: (trace) => this.ReadNextAsync(trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response),
+ openTelemetry: new (OpenTelemetryConstants.Operations.QueryChangeFeedEstimator, (response) => new OpenTelemetryResponse(responseMessage: response)),
traceComponent: TraceComponent.ChangeFeed,
traceLevel: TraceLevel.Info);
}
diff --git a/Microsoft.Azure.Cosmos/src/CosmosClient.cs b/Microsoft.Azure.Cosmos/src/CosmosClient.cs
index 89c628635f..0c0cef4001 100644
--- a/Microsoft.Azure.Cosmos/src/CosmosClient.cs
+++ b/Microsoft.Azure.Cosmos/src/CosmosClient.cs
@@ -18,6 +18,8 @@ namespace Microsoft.Azure.Cosmos
using Microsoft.Azure.Cosmos.Handlers;
using Microsoft.Azure.Cosmos.Query.Core.Monads;
using Microsoft.Azure.Cosmos.Query.Core.QueryPlan;
+ using Microsoft.Azure.Cosmos.Telemetry;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Cosmos.Tracing.TraceData;
using Microsoft.Azure.Documents;
@@ -756,7 +758,7 @@ public virtual Task CreateDatabaseAsync(
trace: trace,
cancellationToken: cancellationToken);
},
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateDatabase, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
///
@@ -804,7 +806,7 @@ public virtual Task CreateDatabaseAsync(
trace: trace,
cancellationToken: cancellationToken);
},
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateDatabase, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
///
@@ -900,8 +902,7 @@ public virtual Task CreateDatabaseIfNotExistsAsync(
return this.ClientContext.ResponseFactory.CreateDatabaseResponse(this.GetDatabase(databaseProperties.Id), readResponseAfterConflict);
}
},
- openTelemetry: (response) => new OpenTelemetryResponse(
- responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateDatabaseIfNotExists, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
///
@@ -1205,7 +1206,7 @@ public virtual Task CreateDatabaseStreamAsync(
trace,
cancellationToken);
},
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateDatabase, (response) => new OpenTelemetryResponse(response)));
}
///
@@ -1288,7 +1289,7 @@ internal virtual Task CreateDatabaseStreamAsync(
}
return this.ClientContext.OperationHelperAsync(
- operationName: nameof(CreateDatabaseIfNotExistsAsync),
+ operationName: nameof(CreateDatabaseStreamAsync),
containerName: null,
databaseName: databaseProperties.Id,
operationType: OperationType.Create,
@@ -1303,7 +1304,7 @@ internal virtual Task CreateDatabaseStreamAsync(
trace,
cancellationToken);
},
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateDatabase, (response) => new OpenTelemetryResponse(response)));
}
private async Task CreateDatabaseInternalAsync(
diff --git a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs
index 3d32cdedf5..ae1a0d6c22 100644
--- a/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs
+++ b/Microsoft.Azure.Cosmos/src/Query/v3Query/QueryIterator.cs
@@ -19,6 +19,7 @@ namespace Microsoft.Azure.Cosmos.Query
using Microsoft.Azure.Cosmos.Query.Core.Pipeline.Pagination;
using Microsoft.Azure.Cosmos.Query.Core.QueryClient;
using Microsoft.Azure.Cosmos.Query.Core.QueryPlan;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
internal sealed class QueryIterator : FeedIteratorInternal
@@ -53,6 +54,8 @@ private QueryIterator(
this.correlatedActivityId = correlatedActivityId;
this.container = container;
+ this.operationName = OpenTelemetryConstants.Operations.QueryItems;
+ this.operationType = Documents.OperationType.Query;
}
public static QueryIterator Create(
diff --git a/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs b/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs
index 858926c9a4..7093390d72 100644
--- a/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs
+++ b/Microsoft.Azure.Cosmos/src/ReadFeed/ReadFeedIteratorCore.cs
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Cosmos.ReadFeed
using Microsoft.Azure.Cosmos.ReadFeed.Pagination;
using Microsoft.Azure.Cosmos.Resource.CosmosExceptions;
using Microsoft.Azure.Cosmos.Routing;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Documents;
@@ -38,6 +39,7 @@ public ReadFeedIteratorCore(
CancellationToken cancellationToken)
{
this.container = container;
+ this.operationName = OpenTelemetryConstants.Operations.ReadFeedRanges;
this.queryRequestOptions = queryRequestOptions;
readFeedPaginationOptions ??= ReadFeedExecutionOptions.Default;
diff --git a/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs b/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs
index a8cc0d59dc..37fe60f89e 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/ClientContextCore.cs
@@ -17,6 +17,7 @@ namespace Microsoft.Azure.Cosmos
using Microsoft.Azure.Cosmos.Resource.CosmosExceptions;
using Microsoft.Azure.Cosmos.Routing;
using Microsoft.Azure.Cosmos.Telemetry;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
using Microsoft.Azure.Documents;
@@ -210,7 +211,8 @@ internal override Task
OperationType operationType,
RequestOptions requestOptions,
Func> task,
- Func openTelemetry,
+ Tuple> openTelemetry,
+ ResourceType? resourceType = null,
TraceComponent traceComponent = TraceComponent.Transport,
Tracing.TraceLevel traceLevel = Tracing.TraceLevel.Info)
{
@@ -223,7 +225,8 @@ internal override Task
task,
openTelemetry,
traceComponent,
- traceLevel) :
+ traceLevel,
+ resourceType) :
this.OperationHelperWithRootTraceWithSynchronizationContextAsync(
operationName,
containerName,
@@ -233,7 +236,8 @@ internal override Task
task,
openTelemetry,
traceComponent,
- traceLevel);
+ traceLevel,
+ resourceType);
}
private async Task OperationHelperWithRootTraceAsync(
@@ -243,9 +247,10 @@ private async Task OperationHelperWithRootTraceAsync(
OperationType operationType,
RequestOptions requestOptions,
Func> task,
- Func openTelemetry,
+ Tuple> openTelemetry,
TraceComponent traceComponent,
- Tracing.TraceLevel traceLevel)
+ Tracing.TraceLevel traceLevel,
+ ResourceType? resourceType)
{
bool disableDiagnostics = requestOptions != null && requestOptions.DisablePointOperationDiagnostics;
@@ -260,8 +265,8 @@ private async Task OperationHelperWithRootTraceAsync(
trace,
task,
openTelemetry,
- operationName,
- requestOptions);
+ requestOptions,
+ resourceType);
}
}
@@ -272,9 +277,10 @@ private Task OperationHelperWithRootTraceWithSynchronizationContextAsyn
OperationType operationType,
RequestOptions requestOptions,
Func> task,
- Func openTelemetry,
+ Tuple> openTelemetry,
TraceComponent traceComponent,
- Tracing.TraceLevel traceLevel)
+ Tracing.TraceLevel traceLevel,
+ ResourceType? resourceType)
{
Debug.Assert(SynchronizationContext.Current != null, "This should only be used when a SynchronizationContext is specified");
@@ -297,8 +303,8 @@ private Task OperationHelperWithRootTraceWithSynchronizationContextAsyn
trace,
task,
openTelemetry,
- operationName,
- requestOptions);
+ requestOptions,
+ resourceType);
}
});
}
@@ -488,13 +494,26 @@ private async Task RunWithDiagnosticsHelperAsync(
OperationType operationType,
ITrace trace,
Func> task,
- Func openTelemetry,
- string operationName,
- RequestOptions requestOptions)
+ Tuple> openTelemetry,
+ RequestOptions requestOptions,
+ ResourceType? resourceType = null)
{
- using (OpenTelemetryCoreRecorder recorder =
+ using (OpenTelemetryCoreRecorder recorder =
OpenTelemetryRecorderFactory.CreateRecorder(
- operationName: operationName,
+ getOperationName: () =>
+ {
+ // If opentelemetry is not enabled then return null operation name, so that no activity is created.
+ if (openTelemetry == null)
+ {
+ return null;
+ }
+
+ if (resourceType is not null && this.IsBulkOperationSupported(resourceType.Value, operationType))
+ {
+ return OpenTelemetryConstants.Operations.ExecuteBulkPrefix + openTelemetry.Item1;
+ }
+ return openTelemetry.Item1;
+ },
containerName: containerName,
databaseName: databaseName,
operationType: operationType,
@@ -509,7 +528,7 @@ private async Task RunWithDiagnosticsHelperAsync(
if (openTelemetry != null && recorder.IsEnabled)
{
// Record request response information
- OpenTelemetryAttributes response = openTelemetry(result);
+ OpenTelemetryAttributes response = openTelemetry?.Item2(result);
recorder.Record(response);
}
@@ -519,7 +538,7 @@ private async Task RunWithDiagnosticsHelperAsync(
{
CosmosOperationCanceledException operationCancelledException = new CosmosOperationCanceledException(oe, trace);
recorder.MarkFailed(operationCancelledException);
-
+
throw operationCancelledException;
}
catch (ObjectDisposedException objectDisposed) when (!(objectDisposed is CosmosObjectDisposedException))
diff --git a/Microsoft.Azure.Cosmos/src/Resource/ClientEncryptionKey/ClientEncryptionKeyInlineCore.cs b/Microsoft.Azure.Cosmos/src/Resource/ClientEncryptionKey/ClientEncryptionKeyInlineCore.cs
index 6d6305e30b..8883d5b0a8 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/ClientEncryptionKey/ClientEncryptionKeyInlineCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/ClientEncryptionKey/ClientEncryptionKeyInlineCore.cs
@@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos
{
using System.Threading;
using System.Threading.Tasks;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
///
/// This class acts as a wrapper over for environments that use SynchronizationContext.
@@ -35,7 +36,7 @@ public override Task ReadAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadAsync(requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadClientEncryptionKey, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceAsync(
@@ -50,7 +51,7 @@ public override Task ReplaceAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceAsync(clientEncryptionKeyProperties, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceClientEncryptionKey, (response) => new OpenTelemetryResponse(response)));
}
}
}
\ No newline at end of file
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Conflict/ConflictsInlineCore.cs b/Microsoft.Azure.Cosmos/src/Resource/Conflict/ConflictsInlineCore.cs
index 17caba406e..682d43d0d7 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Conflict/ConflictsInlineCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Conflict/ConflictsInlineCore.cs
@@ -6,6 +6,7 @@ namespace Microsoft.Azure.Cosmos
{
using System.Threading;
using System.Threading.Tasks;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
// This class acts as a wrapper for environments that use SynchronizationContext.
internal sealed class ConflictsInlineCore : ConflictsCore
@@ -31,7 +32,7 @@ public override Task DeleteAsync(
operationType: Documents.OperationType.Delete,
requestOptions: null,
task: (trace) => base.DeleteAsync(conflict, partitionKey, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteConflict, (response) => new OpenTelemetryResponse(response)));
}
public override FeedIterator GetConflictQueryStreamIterator(
@@ -94,7 +95,7 @@ public override Task> ReadCurrentAsync(
operationType: Documents.OperationType.Read,
requestOptions: null,
task: (trace) => base.ReadCurrentAsync(cosmosConflict, partitionKey, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadConflict, (response) => new OpenTelemetryResponse(response)));
}
public override T ReadConflictContent(ConflictProperties cosmosConflict)
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInlineCore.cs b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInlineCore.cs
index f3153a33cf..2f9184527e 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInlineCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Container/ContainerInlineCore.cs
@@ -14,6 +14,7 @@ namespace Microsoft.Azure.Cosmos
using Microsoft.Azure.Cosmos.Query.Core.Monads;
using Microsoft.Azure.Cosmos.Query.Core.QueryClient;
using Microsoft.Azure.Cosmos.ReadFeed;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
using Microsoft.Azure.Cosmos.Tracing;
// This class acts as a wrapper for environments that use SynchronizationContext.
@@ -42,7 +43,7 @@ public override Task ReadContainerAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadContainerAsync(trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReadContainerStreamAsync(
@@ -56,7 +57,7 @@ public override Task ReadContainerStreamAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadContainerStreamAsync(trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceContainerAsync(
@@ -71,7 +72,7 @@ public override Task ReplaceContainerAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceContainerAsync(containerProperties, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceContainerStreamAsync(
@@ -86,7 +87,7 @@ public override Task ReplaceContainerStreamAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceContainerStreamAsync(containerProperties, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task DeleteContainerAsync(
@@ -100,7 +101,7 @@ public override Task DeleteContainerAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteContainerAsync(trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task DeleteContainerStreamAsync(
@@ -114,7 +115,7 @@ public override Task DeleteContainerStreamAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteContainerStreamAsync(trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReadThroughputAsync(CancellationToken cancellationToken = default)
@@ -139,7 +140,7 @@ public override Task ReadThroughputAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadThroughputAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadThroughput, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceThroughputAsync(
@@ -154,7 +155,7 @@ public override Task ReplaceThroughputAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceThroughputAsync(throughput, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceThroughput, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceThroughputAsync(
@@ -169,7 +170,7 @@ public override Task ReplaceThroughputAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceThroughputAsync(throughputProperties, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceThroughput, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReadThroughputIfExistsAsync(RequestOptions requestOptions, CancellationToken cancellationToken)
@@ -181,7 +182,7 @@ public override Task ReadThroughputIfExistsAsync(RequestOpti
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadThroughputIfExistsAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadThroughputIfExists, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceThroughputIfExistsAsync(ThroughputProperties throughput, RequestOptions requestOptions, CancellationToken cancellationToken)
@@ -193,7 +194,7 @@ public override Task ReplaceThroughputIfExistsAsync(Throughp
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceThroughputIfExistsAsync(throughput, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceThroughputIfExists, (response) => new OpenTelemetryResponse(response)));
}
public override Task CreateItemStreamAsync(
@@ -219,7 +220,8 @@ Task func(ITrace trace)
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: func,
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task> CreateItemAsync(T item,
@@ -234,7 +236,8 @@ public override Task> CreateItemAsync(T item,
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateItemAsync(item, trace, partitionKey, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task ReadItemStreamAsync(
@@ -250,7 +253,8 @@ public override Task ReadItemStreamAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadItemStreamAsync(id, partitionKey, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task> ReadItemAsync(
@@ -260,13 +264,14 @@ public override Task> ReadItemAsync(
CancellationToken cancellationToken = default)
{
return this.ClientContext.OperationHelperAsync(
- nameof(ReadItemAsync),
+ operationName: nameof(ReadItemAsync),
containerName: this.Id,
databaseName: this.Database.Id,
operationType: Documents.OperationType.Read,
- requestOptions,
- (trace) => base.ReadItemAsync(id, partitionKey, trace, requestOptions, cancellationToken),
- (response) => new OpenTelemetryResponse(response));
+ requestOptions: requestOptions,
+ task: (trace) => base.ReadItemAsync(id, partitionKey, trace, requestOptions, cancellationToken),
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task UpsertItemStreamAsync(
@@ -282,7 +287,8 @@ public override Task UpsertItemStreamAsync(
operationType: Documents.OperationType.Upsert,
requestOptions: requestOptions,
task: (trace) => base.UpsertItemStreamAsync(streamPayload, partitionKey, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.UpsertItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task> UpsertItemAsync(
@@ -298,7 +304,8 @@ public override Task> UpsertItemAsync(
operationType: Documents.OperationType.Upsert,
requestOptions: requestOptions,
task: (trace) => base.UpsertItemAsync(item, trace, partitionKey, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.UpsertItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task ReplaceItemStreamAsync(
@@ -315,7 +322,8 @@ public override Task ReplaceItemStreamAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceItemStreamAsync(streamPayload, id, partitionKey, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task> ReplaceItemAsync(
@@ -332,7 +340,8 @@ public override Task> ReplaceItemAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceItemAsync(item, id, trace, partitionKey, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task DeleteItemStreamAsync(
@@ -348,7 +357,8 @@ public override Task DeleteItemStreamAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteItemStreamAsync(id, partitionKey, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task> DeleteItemAsync(
@@ -364,7 +374,8 @@ public override Task> DeleteItemAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteItemAsync(id, partitionKey, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task PatchItemStreamAsync(
@@ -381,7 +392,8 @@ public override Task PatchItemStreamAsync(
operationType: Documents.OperationType.Patch,
requestOptions: requestOptions,
task: (trace) => base.PatchItemStreamAsync(id, partitionKey, patchOperations, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.PatchItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task PatchItemStreamAsync(
@@ -398,7 +410,8 @@ public override Task PatchItemStreamAsync(
operationType: Documents.OperationType.Patch,
requestOptions: requestOptions,
task: (trace) => base.PatchItemStreamAsync(id, partitionKey, streamPayload, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.PatchItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task> PatchItemAsync(
@@ -415,7 +428,8 @@ public override Task> PatchItemAsync(
operationType: Documents.OperationType.Patch,
requestOptions: requestOptions,
task: (trace) => base.PatchItemAsync(id, partitionKey, patchOperations, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.PatchItem, (response) => new OpenTelemetryResponse(response)),
+ resourceType: Documents.ResourceType.Document);
}
public override Task ReadManyItemsStreamAsync(
@@ -430,7 +444,7 @@ public override Task ReadManyItemsStreamAsync(
operationType: Documents.OperationType.Read,
requestOptions: null,
task: (trace) => base.ReadManyItemsStreamAsync(items, trace, readManyRequestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadManyItems, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task> ReadManyItemsAsync(
@@ -439,13 +453,13 @@ public override Task> ReadManyItemsAsync(
CancellationToken cancellationToken = default)
{
return this.ClientContext.OperationHelperAsync(
- nameof(ReadManyItemsAsync),
+ operationName: nameof(ReadManyItemsAsync),
containerName: this.Id,
databaseName: this.Database.Id,
operationType: Documents.OperationType.Read,
requestOptions: null,
task: (trace) => base.ReadManyItemsAsync(items, trace, readManyRequestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadManyItems, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override FeedIterator GetItemQueryStreamIterator(
@@ -658,7 +672,7 @@ public override Task DeleteAllItemsByPartitionKeyStreamAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteAllItemsByPartitionKeyStreamAsync(partitionKey, trace, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteAllItemsByPartitionKey, (response) => new OpenTelemetryResponse(response)));
}
}
}
\ No newline at end of file
diff --git a/Microsoft.Azure.Cosmos/src/Resource/CosmosClientContext.cs b/Microsoft.Azure.Cosmos/src/Resource/CosmosClientContext.cs
index 5bd2cc1848..5db29ee8a2 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/CosmosClientContext.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/CosmosClientContext.cs
@@ -65,7 +65,8 @@ internal abstract Task OperationHelperAsync(
OperationType operationType,
RequestOptions requestOptions,
Func> task,
- Func openTelemetry = null,
+ Tuple> openTelemetry = null,
+ ResourceType? resourceType = null,
TraceComponent traceComponent = TraceComponent.Transport,
TraceLevel traceLevel = TraceLevel.Info);
diff --git a/Microsoft.Azure.Cosmos/src/Resource/Database/DatabaseInlineCore.cs b/Microsoft.Azure.Cosmos/src/Resource/Database/DatabaseInlineCore.cs
index fb25ef4190..36fdfa51c2 100644
--- a/Microsoft.Azure.Cosmos/src/Resource/Database/DatabaseInlineCore.cs
+++ b/Microsoft.Azure.Cosmos/src/Resource/Database/DatabaseInlineCore.cs
@@ -6,7 +6,9 @@ namespace Microsoft.Azure.Cosmos
{
using System.Threading;
using System.Threading.Tasks;
+ using global::Azure;
using Microsoft.Azure.Cosmos.Fluent;
+ using Microsoft.Azure.Cosmos.Telemetry.OpenTelemetry;
// This class acts as a wrapper for environments that use SynchronizationContext.
internal sealed class DatabaseInlineCore : DatabaseCore
@@ -33,7 +35,7 @@ public override Task CreateContainerAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerAsync(containerProperties, throughput, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainer, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task CreateContainerAsync(string id,
@@ -49,7 +51,7 @@ public override Task CreateContainerAsync(string id,
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerAsync(id, partitionKeyPath, throughput, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainer, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task CreateContainerIfNotExistsAsync(
@@ -65,7 +67,7 @@ public override Task CreateContainerIfNotExistsAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerIfNotExistsAsync(containerProperties, throughput, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainerIfNotExists, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task CreateContainerIfNotExistsAsync(
@@ -82,7 +84,7 @@ public override Task CreateContainerIfNotExistsAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerIfNotExistsAsync(id, partitionKeyPath, throughput, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainerIfNotExists, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task CreateContainerStreamAsync(
@@ -98,7 +100,7 @@ public override Task CreateContainerStreamAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerStreamAsync(containerProperties, throughput, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task CreateUserAsync(string id,
@@ -112,7 +114,7 @@ public override Task CreateUserAsync(string id,
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateUserAsync(id, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateUser, (response) => new OpenTelemetryResponse(response)));
}
public override ContainerBuilder DefineContainer(
@@ -133,7 +135,7 @@ public override Task DeleteAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteDatabase, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task DeleteStreamAsync(
@@ -147,7 +149,7 @@ public override Task DeleteStreamAsync(
operationType: Documents.OperationType.Delete,
requestOptions: requestOptions,
task: (trace) => base.DeleteStreamAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.DeleteDatabase, (response) => new OpenTelemetryResponse(response)));
}
public override Container GetContainer(string id)
@@ -241,7 +243,7 @@ public override Task ReadAsync(RequestOptions requestOptions =
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadDatabase, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task ReadStreamAsync(
@@ -255,7 +257,7 @@ public override Task ReadStreamAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadStreamAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadDatabase, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReadThroughputAsync(CancellationToken cancellationToken = default)
@@ -280,7 +282,7 @@ public override Task ReadThroughputAsync(
operationType: Documents.OperationType.Read,
requestOptions: requestOptions,
task: (trace) => base.ReadThroughputAsync(requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReadThroughput, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceThroughputAsync(
@@ -295,7 +297,7 @@ public override Task ReplaceThroughputAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceThroughputAsync(throughput, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceThroughput, (response) => new OpenTelemetryResponse(response)));
}
public override Task ReplaceThroughputAsync(
@@ -310,7 +312,7 @@ public override Task ReplaceThroughputAsync(
operationType: Documents.OperationType.Replace,
requestOptions: requestOptions,
task: (trace) => base.ReplaceThroughputAsync(throughputProperties, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.ReplaceThroughput, (response) => new OpenTelemetryResponse(response)));
}
public override Task CreateContainerAsync(
@@ -326,7 +328,7 @@ public override Task CreateContainerAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerAsync(containerProperties, throughputProperties, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(responseMessage: response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainer, (response) => new OpenTelemetryResponse(responseMessage: response)));
}
public override Task CreateContainerIfNotExistsAsync(
@@ -342,7 +344,7 @@ public override Task CreateContainerIfNotExistsAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerIfNotExistsAsync(containerProperties, throughputProperties, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainerIfNotExists, (response) => new OpenTelemetryResponse(response)));
}
public override Task CreateContainerStreamAsync(
@@ -358,7 +360,7 @@ public override Task CreateContainerStreamAsync(
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateContainerStreamAsync(containerProperties, throughputProperties, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.CreateContainer, (response) => new OpenTelemetryResponse(response)));
}
public override Task UpsertUserAsync(
@@ -373,7 +375,7 @@ public override Task UpsertUserAsync(
operationType: Documents.OperationType.Upsert,
requestOptions: requestOptions,
task: (trace) => base.UpsertUserAsync(id, requestOptions, trace, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse(response));
+ openTelemetry: new (OpenTelemetryConstants.Operations.UpsertUser, (response) => new OpenTelemetryResponse(response)));
}
public override ClientEncryptionKey GetClientEncryptionKey(string id)
@@ -401,7 +403,7 @@ public override Task CreateClientEncryptionKeyAsync
operationType: Documents.OperationType.Create,
requestOptions: requestOptions,
task: (trace) => base.CreateClientEncryptionKeyAsync(trace, clientEncryptionKeyProperties, requestOptions, cancellationToken),
- openTelemetry: (response) => new OpenTelemetryResponse