Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Enhancement: Return the size of a collection #79
Following the contributions.md guidance, I'm writing an issue prior to submitting an enhancement.
When you use non-partitioned collections, Microsoft imposes a hard size limit of 10 GB. Microsoft allows you to set up alerting based on size, but it is the aggregate account size, not the collection size, rendering it moot.
The CosmosDB PowerShell module contains a lot of the foundation plumbing required to get this information. I've written a small enhancement to return size information about a collection. https://docs.microsoft.com/en-us/azure/cosmos-db/monitor-accounts indicates that this info can be retrieved by doing a GET on the collection, and the response contains usage information for the collection in the x-ms-resource-usage header.
The design introduces a new function in lib\collections.ps1 named Get-CosmosDBCollectionSize which returns information for a given collection, and leaves the existing Get-CosmosDBCollection function untouched. The params for Get-CosmosDBCollectionSize are identical to Get-CosmosDBCollection.
The response contains a hashtable containing the values of the following properties:
With this enhancement, I've been able to set up basic alerting based on collection size. If this is of interest, I'm happy to submit a pull request.
Hi @WatersJohn - this is awesome and I'd love to include this if you want to submit a PR. If you include a changelog entry in the CHANGELOG.md file with your name then you'll get attribution of the feature in the release notes. Thank you very much for contributing!