-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* creating executor * Adding public API * Updating contract * Adding ToResponseMessage * Wiring to executor * Mockable executor * Itemrequestoptions to batchitemrequestoptions * cleanup * Tests * Wiring to executor * Unit tests on executor * Emulator tests on container * executor retry handler * Retry tests * Handler tests * under preview * else * Upsert support * Using ResourceThrottleRetryPolicy * Generating new context on retry * Correctly obtaining retrypolicy * Fixing unrelated test * Removing unneeded constants * Fixing conflict tests * Replace and Delete support * Adding Read support * private instead of internal * Fix for Read and DeleteItemAsync * Typed API support * Rename property * Rename * Refactor on ClientContext * Refactoring through policies and batcher * ItemId is required * Undo unnecessary changes * Diagnostics from response * Introducing itembatchoperationstatistics * Description * More generic * Batcher appends diagnostics * Test to verify multiple operations * Emulator tests * On Context * Rename * Undoing comment * Description * Renaming variable * Fixing test * Rename * Duplicat test * Adding created and completed * set is private * Avoid creating executor instances * Set diagnostics independently
- Loading branch information
1 parent
bec2d81
commit 1f40f52
Showing
14 changed files
with
288 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
Microsoft.Azure.Cosmos/src/Resource/Settings/ItemBatchOperationStatistics.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
//------------------------------------------------------------ | ||
|
||
namespace Microsoft.Azure.Cosmos | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
/// <summary> | ||
/// A batch operation might extend multiple requests due to retries. | ||
/// </summary> | ||
internal class ItemBatchOperationStatistics : CosmosDiagnostics | ||
{ | ||
private readonly DateTime created = DateTime.UtcNow; | ||
private readonly List<CosmosDiagnostics> cosmosDiagnostics = new List<CosmosDiagnostics>(); | ||
private DateTime completed; | ||
|
||
public void AppendDiagnostics(CosmosDiagnostics diagnostics) | ||
{ | ||
this.cosmosDiagnostics.Add(diagnostics); | ||
} | ||
|
||
public void Complete() | ||
{ | ||
this.completed = DateTime.UtcNow; | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
if (this.cosmosDiagnostics.Count == 0) | ||
{ | ||
return string.Empty; | ||
} | ||
|
||
StringBuilder statistics = new StringBuilder($"Bulk operation started at {this.created}. "); | ||
if (this.completed != null) | ||
{ | ||
statistics.Append($"Completed at {this.completed}. "); | ||
} | ||
|
||
foreach (CosmosDiagnostics pointOperationStatistic in this.cosmosDiagnostics) | ||
{ | ||
statistics.AppendLine(pointOperationStatistic.ToString()); | ||
} | ||
|
||
return statistics.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.