I am trying to get the currently allocated RUs for a DocumentDB collection using Java SDK. Anyone have any inputs?
Asked
Active
Viewed 80 times
0
-
Please share any code that you’ve written so far regarding this and the issues you’re running into with that code. – Gaurav Mantri May 01 '18 at 07:05
2 Answers
0
What you are looking for is a way to query for the Offer or OfferV2 of the collection.
As you can see here OfferV2 has a set and get method of the collection throughput. Offer (v1) will also contain the property as it's a Resource at it's code
You can read the offer using the readOffer(string collectionSelfLink)
method in AsyncDocumentClient
in order to retrieve the Offer and then use
offer.getContent().getInt("offerThroughput");
to get the RU/s of the collection.
Casting it to OfferV2
should work as well which gives you access to the getOfferThroughput()
(which for the record internally will do what the line above does)

Nick Chapsas
- 6,872
- 1
- 20
- 29
0
You can use
public int getRequstUnits(DocumentClient client, DocumentCollection coll) {
return getOffer(client, coll).getContent().getInt("offerThroughput");
}
Look at the complete code sample
here

Sajeetharan
- 216,225
- 63
- 350
- 396