-
Notifications
You must be signed in to change notification settings - Fork 494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diagnostics: Adds ActivityScope to operation level #1728
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the required format: "[Internal] Category: (Adds|Fixes|Refactors) Description"
Examples:
Diagnostics: Adds GetElapsedClientLatency to CosmosDiagnostics
PartitionKey: Fixes null reference when using default(PartitionKey)
[v4] Client Encryption: Refactors code to external project
[Internal] Query: Adds code generator for CosmosNumbers for easy additions in the future.
…ithub.com/Azure/azure-cosmos-dotnet-v3 into users/jawilley/diagnostics/sameActivityId
}); | ||
} | ||
|
||
private async Task<TResult> RunWithDiagnosticsHelperAsync<TResult>( | ||
CosmosDiagnosticsContext diagnosticsContext, | ||
Func<CosmosDiagnosticsContext, Task<TResult>> task) | ||
{ | ||
try | ||
using (new ActivityScope(Guid.NewGuid())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caller ActivityId might be overwritten. Does it need to be conditional on non-existence?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be by design. The activity scope save the current activity id, updates it to the new one. Once the ActivityScope is disposed it switches back to the original activity id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment but overall LGTM
…ithub.com/Azure/azure-cosmos-dotnet-v3 into users/jawilley/diagnostics/sameActivityId
Closing due to in-activity, pease feel free to re-open. |
Pull Request Template
Description
The activity scope is currently set at each network call. This makes it difficult to for Cosmos DB service to track a single user request across multiple retries. This will also fix issues where the Traces did not have an activity id. For query and other operation it will still be a unique activity id per a backend call. This follows the model of the Java SDK. This change seems to be caused by a miss when the retry logic moved from below the TransportHandler to above it as a RequestHandler.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #IssueNumber