We're using Application Insights within an Azure App Service (some Web API) which queries an Azure Cosmos DB in .NET Core 2.1. The querying is done using a DocumentClient
object from the Nuget package Microsoft.Azure.DocumentDB.Core 1.10.0, and on this client we're calling the CreateDocumentQuery<T>(Uri, FeedOptions) extension method.
Now from a user's perspective the querying seems to work fine. However, looking at Application Insights we are presented with a rather large number of dependency failures concerning the Cosmos DB. I'll try to visualize what I'm seeing in the Azure portal:
--------------------------------------------------------------------------------------------------
| Event | Res. | Duration |
--------------------------------------------------------------------------------------------------
| ▼ web-api-resource-name POST api-endpoint-name | 200 | 149.1 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Create/query document | 400 | 4 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Query documents | 200 | 7 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Create/query document | 400 | 4 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Query documents | 200 | 5 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Create/query document | 400 | 4 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Query documents | 200 | 6 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Query documents | 200 | 6 ms |
--------------------------------------------------------------------------------------------------
| AZURE DOCUMENTDB cosmosdb-name.documents.azure.com | Query documents | 200 | 12 ms |
--------------------------------------------------------------------------------------------------
The lines containing the HTTP 400 results are highlighted in red within the Azure portal and are obviously the ones displaying the dependency failures. Now since the overall request seems to result in a HTTP 200 and no errors are returned to the web api, I can only think of this being some internal Cosmos DB querying. And because there are multiple entries for a single request I'm guessing this could be related to some retry policy.
However, since I can't seem to find any further information on the erroneous requests: Can anyone shed some light on this issue?
UPDATE: Here's a screenshot of the Application Insights view within the Azure portal. Slightly different duration values, but same problem.
Unfortunately, the column containing the Create/query document
and Query documents
texts is hidden here, since in the Azure portal you'd have to scroll horizontally to view that information.
Thanks in advance, Tobi
Core(SQL) API is native to Azure Cosmos DB. API for MongoDB, Cassandra, Gremlin, and Table implement the wire protocol of open-source database engines. These APIs are best suited if the following conditions are true: If you have existing MongoDB, Cassandra, or Gremlin applications.
Can I use multiple APIs to access my data? Azure Cosmos DB is Microsoft's globally distributed, multi-model database service. Where multi-model means Azure Cosmos DB supports multiple APIs and multiple data models, different APIs use different data formats for storage and wire protocol.
Azure Cosmos DB is commonly used within web and mobile applications, and is well suited for modeling social interactions, integrating with third-party services, and for building rich personalized experiences. The Cosmos DB SDKs can be used build rich iOS and Android applications using the popular Xamarin framework.
You can ignore 400's as long as query succeeds. They are expected.
Cosmos service will execute query against a single server partition (or Shard). Cross partition queries are expected to be processed by SDK and server rejects with 400. You can control concurrency of SDK execution through FeedOptions.MaxDegreeOfParallism.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With