Skip to content

Commit

Permalink
docs: demand control preview (#5399)
Browse files Browse the repository at this point in the history
Co-authored-by: Maria Elisabeth Schreiber <[email protected]>
Co-authored-by: Chandrika Srinivasan <[email protected]>
  • Loading branch information
3 people authored Jun 12, 2024
1 parent 3d17880 commit c71dd36
Show file tree
Hide file tree
Showing 9 changed files with 618 additions and 0 deletions.
7 changes: 7 additions & 0 deletions docs/source/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
"enterprise"
]
],
"Demand Control" : [
"/executing-operations/demand-control",
[
"enterprise",
"preview"
]
],
"GraphQL Subscriptions": {
"Subscriptions Setup": [
"/executing-operations/subscription-support",
Expand Down
4 changes: 4 additions & 0 deletions docs/source/configuration/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,10 @@ In versions of the Apollo Router prior to 1.17, this limit was defined via the c

</Note>

### Demand control

See [Demand Control](../executing-operations/demand-control) to learn how to analyze the cost of operations and to reject requests with operations that exceed customizable cost limits.

### Early cancel

Up until [Apollo Router 1.43.1](https://github.com/apollographql/router/releases/tag/v1.43.1), when the client closed the connection without waiting for the response, the entire request was cancelled and did not go through the entire pipeline. Since this causes issues with request monitoring, the Router introduced a new behaviour in 1.43.1. Now, the entire pipeline is executed if the request is detected as cancelled, but subgraph requests are not actually done. The response will be reported with the `499` status code, but not actually sent to the client.
Expand Down
29 changes: 29 additions & 0 deletions docs/source/errors.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,32 @@ The request was not able to complete within a configured amount of time. See [c
You can create Rhai scripts that throw custom status codes. See [Terminating client requests](./customizations/rhai-api#terminating-client-requests) to learn more.

</Note>

## Error codes

### Demand control

Errors returned by the router when [demand control](./executing-operations/demand-control) is enabled.

<PropertyList kind="errCodes">
<Property name="COST_ESTIMATED_TOO_EXPENSIVE">

The estimated cost of the operation was greater than the configured maximum cost.

</Property>
<Property name="COST_ACTUAL_TOO_EXPENSIVE">

The actual cost of the operation was greater than the configured maximum cost.

</Property>
<Property name="COST_QUERY_PARSE_FAILURE">

The query could not be parsed.

</Property>
<Property name="COST_RESPONSE_TYPING_FAILURE">

The response from a subgraph did not match the GraphQL schema.

</Property>
</PropertyList>
577 changes: 577 additions & 0 deletions docs/source/executing-operations/demand-control.mdx

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions docs/source/images/demand-control-example-list-lengths.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c71dd36

Please sign in to comment.