Reputation: 5723
Using the following command in Azure CLI one can read the current throughput (RU/s) from a Cosmos DB database:
az cosmosdb sql database throughput show
Result:
{
"id": null,
"location": null,
"name": null,
"tags": null,
"throughput": 400,
"type": null
}
I want this value (throughput 400) in my .NET core application. Currently I reference the Nuget package Microsoft.Azure.DocumentDB.Core
and I already tried this:
using (var client = new DocumentClient(new Uri("https://MYCOSMOS.documents.azure.com:443/"), "MYKEY"))
{
var options = new RequestOptions()
{
PopulateQuotaInfo = true
};
var uri = UriFactory.CreateDocumentCollectionUri("Sample", "orders");
var result = await client.ReadDocumentCollectionAsync(uri, options);
}
But this only provides me some quotas regarding document amount and so on.
Upvotes: 1
Views: 1063
Reputation: 8039
With the Microsoft.Azure.DocumentDB.Core
you are using the old v.2 SDK which has been obsoleted by the new v3 SDK - Microsoft.Azure.Cosmos
With the new SDK you would do something like this:
using (var client = new CosmosClient(new Uri("https://MYCOSMOS.documents.azure.com:443/"), "MYKEY"))
{
var database = client.GetDatabase("Sample");
var container = database.GetContainer("orders");
var databaseThroughput = await database.ReadThroughputAsync();
var containerThroughput = await container.ReadThroughputAsync();
}
Upvotes: 3