Skip to content
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

Distributed Tracing: Fixes design issues #3876

Merged
merged 1 commit into from
May 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 0 additions & 29 deletions docs/SdkDesign.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,32 +186,3 @@ flowchart LR
ConsistencyWriter --> TCPClient

```
## Distributed Tracing (Preview)

For detail about usage of this feature, please see the [Azure Cosmos DB SDK observability](https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/sdk-observability?tabs=dotnet)

```mermaid
flowchart TD
classDef orange fill:#f96
classDef blue fill:#6fa8dc
subgraph ClientContextCore
OpenTelemetryRecorderFactory --> CheckFeatureFlag{<a href='https://github.com/Azure/azure-cosmos-dotnet-v3/blob/3727d4d738cfc24aa372b578fd8ca482a5bc2f3f/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs#L436'>isDistributedTracing</a> Enabled?}
CheckFeatureFlag --> |Yes| CreateActivity(Start an Activity or Child activity with specific kind Using DiagnosticScope<br> and preloaded attributes like containerName, databaseName, operationType)
CreateActivity --> HandlerPipeline
GetResponse --> TriggerDispose(Trigger Dispose of Disagnostic Scope)
TriggerDispose --> CheckLatencyThreshold{Is high latency/errored response?}
CheckLatencyThreshold -- Yes --> GenerateTraceEvent(Generate <i>Warning</i> or <i>Error</i> Trace Event With Request Diagnostics) --> StopActivity
CheckLatencyThreshold -- No --> StopActivity
StopActivity --> SendResponse(Send Response to Caller):::blue
end
OperationRequest[Operation Request]:::blue --> ClientContextCore
subgraph Application
OperationCall(User Application):::orange
end
OperationCall(User Application):::orange --> OperationRequest
CheckFeatureFlag --> |No| HandlerPipeline
HandlerPipeline --> OtherLogic(Goes through TCP/HTTP calls <br> based on Connection Mode):::blue
OtherLogic --> GetResponse(Get Response for the request)
SendResponse --> OperationCall

```
36 changes: 36 additions & 0 deletions docs/observability.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# .NET SDK Observability Feature Design

## Distributed Tracing (Preview)

**Source to capture operation level activities**: _Azure.Cosmos.Operation_\
**Source to capture event with request diagnostics** : _Azure-Cosmos-Operation-Request-Diagnostics_

For detail about usage of this feature, please see the [Azure Cosmos DB SDK observability](https://learn.microsoft.com/azure/cosmos-db/nosql/sdk-observability?tabs=dotnet)

```mermaid
flowchart TD
classDef orange fill:#f96
classDef blue fill:#6fa8dc
subgraph ClientContextCore
OpenTelemetryRecorderFactory --> CheckFeatureFlag{<a href='https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs#L436'>isDistributedTracing</a> Enabled?}
CheckFeatureFlag --> |Yes| CreateActivity(Start an Activity or Child activity<br> with preloaded attributes)
CreateActivity --> HandlerPipeline{<a href='https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/docs/SdkDesign.md#handler-pipeline'>Handler Pipeline</a>}
GetResponse --> TriggerDispose(Trigger Dispose of Diagnostic Scope)
subgraph Dispose
TriggerDispose --> CheckLatencyThreshold{Is high latency/errored response?}
CheckLatencyThreshold -- Yes --> GenerateEvent(Generate <i>Warning</i> or <i>Error</i> Event With Request Diagnostics) --> StopActivity
CheckLatencyThreshold -- No --> StopActivity
end
StopActivity --> SendResponse(Send Response to Caller):::blue
end
OperationRequest[Operation Request]:::blue --> ClientContextCore
subgraph Application
OperationCall(User Application):::orange
end
OperationCall(User Application):::orange --> OperationRequest
CheckFeatureFlag --> |No| HandlerPipeline
HandlerPipeline --> OtherLogic(Goes through TCP/HTTP calls <br> based on Connection Mode):::blue
OtherLogic --> GetResponse(Get Response for the request)
SendResponse --> OperationCall

```