I'm using the queryDocuments() method from the node.js client for the first time. I've previously used readDocument(), executeStoredProcedure(), replaceStoredProcedure(), etc. and all of those return a header object that allows you to inspect the 'x-ms-request-charge' header to discern the request unit charge for the operation. However, when using the queryDocuments() or readDocuments() methods, it returns an QueryIterator and I don't see a way to inspect it to see the RUs for the operation.
I suspect that the reason for this is that it's not one operation. It's a series of operations and you didn't implement a way to aggregate the total RUs for the entire thing. I'm willing to hit the REST API directly to get this myself, but I wanted to ask if there was a way to get it with the current library before I went through the trouble.
You can inspect response headers (e.g.
x-ms-request-charge
) by inspecting the third input parameter in thecallback
forqueryIterator.executeNext()
.For example, here is a code sample that uses the response header (
x-ms-retry-after-ms
) to implement retry logic on throttles (error 429).