Skip to content

Commit 74b0924

Browse files
authored
Merge pull request #47774 from SnehaGunda/ACrole
Adding Graph API request charge details
2 parents 7c66fa0 + 003fe26 commit 74b0924

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

articles/cosmos-db/set-throughput.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,16 @@ offer.getContent().put("offerThroughput", newThroughput);
223223
client.replaceOffer(offer);
224224
```
225225

226-
## <a id="GetLastRequestStatistics"></a>Get throughput by using MongoDB API's GetLastRequestStatistics command
226+
## Get throughput by using MongoDB API portal metrics
227+
228+
The simplest way to get a good estimate of request unit charges for your MongoDB API database is to use the [Azure portal](https://portal.azure.com) metrics. With the *Number of requests* and *Request Charge* charts, you can get an estimate of how many request units each operation is consuming and how many request units they consume relative to one another.
229+
230+
![MongoDB API portal metrics][1]
231+
232+
### <a id="RequestRateTooLargeAPIforMongoDB"></a> Exceeding reserved throughput limits in the MongoDB API
233+
Applications that exceed the provisioned throughput for a container or a set of containers will be rate-limited until the consumption rate drops below the provisioned throughput rate. When a rate-limitation occurs, the backend will end the request with a `16500` error code - `Too Many Requests`. By default, the MongoDB API automatically retries up to 10 times before returning a `Too Many Requests` error code. If you are receiving many `Too Many Requests` error codes, you may want to consider either adding a retry logic in your application's error handling routines or [increase provisioned throughput for the container](set-throughput.md).
234+
235+
## <a id="GetLastRequestStatistics"></a>Get request charge by using MongoDB API's GetLastRequestStatistics command
227236

228237
The MongoDB API supports a custom command, *getLastRequestStatistics*, for retrieving the request charges for a given operation.
229238

@@ -251,14 +260,19 @@ One method for estimating the amount of reserved throughput required by your app
251260
>
252261
>
253262

254-
## Get throughput by using MongoDB API portal metrics
263+
## <a id="RequestchargeGraphAPI"></a>Get request charge for Gremlin API accounts
255264

256-
The simplest way to get a good estimate of request unit charges for your MongoDB API database is to use the [Azure portal](https://portal.azure.com) metrics. With the *Number of requests* and *Request Charge* charts, you can get an estimate of how many request units each operation is consuming and how many request units they consume relative to one another.
265+
Here is a sample on how to get request charge for Gremlin API accounts by using the Gremlin.Net library.
257266

258-
![MongoDB API portal metrics][1]
267+
```csharp
268+
269+
var response = await gremlinClient.SubmitAsync<int>(requestMsg, bindings);
270+
var resultSet = response.AsResultSet();
271+
var statusAttributes= resultSet.StatusAttributes;
272+
```
273+
274+
In addition to the above method, you can also usex-ms-total-request-chargeheader for Request Units calculations.
259275

260-
### <a id="RequestRateTooLargeAPIforMongoDB"></a> Exceeding reserved throughput limits in the MongoDB API
261-
Applications that exceed the provisioned throughput for a container or a set of containers will be rate-limited until the consumption rate drops below the provisioned throughput rate. When a rate-limitation occurs, the backend will end the request with a `16500` error code - `Too Many Requests`. By default, the MongoDB API automatically retries up to 10 times before returning a `Too Many Requests` error code. If you are receiving many `Too Many Requests` error codes, you may want to consider either adding a retry logic in your application's error handling routines or [increase provisioned throughput for the container](set-throughput.md).
262276

263277
## Throughput FAQ
264278

0 commit comments

Comments
 (0)