Azure / azure-cosmos-dotnet-v3

.NET SDK for Azure Cosmos DB for the core SQL API
MIT License
744 stars 496 forks source link

Diagnostics: Add GatewayStoreModel interactions #2957

Open ealsur opened 2 years ago

ealsur commented 2 years ago

Currently, all interactions inside the GatewayStoreModel are not included in the Trace/Diagnostics.

Any cache refresh or interaction with the container information like in : https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs#L341-L404

Needs to have the operation's Trace wired through to be included in the Diagnostics.

kirankumarkolli commented 2 years ago

@ealsur what the remaining gaps?

ealsur commented 2 years ago

All of them :) The linked PR was not to fix this issue, but to answer a question.

The initial problem is that the IStoreModel does not expose a way to pass the Trace in. So we would need to first extend that inteface to have the ProcessMessageAsync receive the Trace from the Handler layers. The Direct stack right now is using the ClientSideRequestStatistics to add info there for TCP requests, but code sections like https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/GatewayStoreModel.cs#L360-L401

are not generating trace events.