The Azure Cosmos DB .NET and Java SDKs now have support for distributed tracing to help you monitor your applications. You can instrument your applications using OpenTelemetry, which is vendor-neutral and has a set of semantic conventions to ensure a standardized data format regardless of your chosen exporter, or you can use the Application Insights SDK directly.
After configuring the Azure Cosmos DB SDK as an OpenTelemetry source or using the latest Application Insights preview SDK, you will receive telemetry from requests made using both direct connectivity mode and gateway mode with no further code changes. You can also automatically capture diagnostics from high latency requests as OpenTelemetry logs, known as traces in Application Insights, to help you understand and troubleshoot your applications even better.