Skip to content

Commit 9581cd5

Browse files
committed
Change the behavior of the policy loading on parsing error
Change some wording to be more consistent Signed-off-by: Anton Troshin <[email protected]>
1 parent 04323f9 commit 9581cd5

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

20240917-BR-resiliency-error-code-retries.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ It only focuses on the `retries` (https://docs.dapr.io/operations/resiliency/pol
1010

1111
## Background
1212

13-
In some applications, error codes may be used to indicate the business error, and retrying the operation might not be necessary or otherwise desirable.
13+
In some applications, some status codes may be used to indicate the business error, and retrying the operation might not be necessary or otherwise desirable.
1414
Customizing retry behavior will allow a more granular way to handle error codes that suit each use case.
1515
Currently, all errors are retried when the policy is applied.
16-
Some errors are not retryable, and subsequent calls will result in the same error, avoiding these retry calls will reduce the overall amount of requests, traffic, and errors.
16+
Some status codes are not retryable, and subsequent calls will result in the same error. Avoiding these retry calls will reduce the overall number of requests, traffic, and errors.
1717

1818
## Related Items
1919

@@ -39,12 +39,12 @@ https://github.com/dapr/docs/issues/3859
3939

4040
### Design
4141

42-
Add a new object field to the `retries` policy Spec to allow the user to specify the error codes that should be retried.
42+
Add a new object field to the `retries` policy Spec to allow the user to specify the status codes that should be retried.
4343
Separate fields for HTTP and gRPC. The new fields should be optional and will default to the existing behavior, which is to retry on all errors.
4444

4545
### Example 1:
46-
In this example, the retry policy will retry **_only_** on HTTP 500 and HTTP error range 502-504 (inclusive) and gRPC error range 2-4 (inclusive).
47-
The rest of the errors will not be retried.
46+
In this example, the retry policy will retry **_only_** on HTTP 500 and HTTP status code range 502-504 (inclusive) and gRPC status code range 2-4 (inclusive).
47+
The rest of the status codes will not be retried.
4848

4949
```yaml
5050
apiVersion: dapr.io/v1alpha1
@@ -66,8 +66,8 @@ spec:
6666
```
6767
6868
### Example 2:
69-
In this example, the retry policy will retry **_only_** on gRPC error range 1-15 (inclusive).
70-
However, this policy will not apply to the HTTP errors, and they will be retried according to the default behavior, which is to retry on all errors.
69+
In this example, the retry policy will retry **_only_** on gRPC status code range 1-15 (inclusive).
70+
However, this policy will not apply to the HTTP status codes, and they will be retried according to the default behavior, which is to retry on all errors.
7171
7272
```yaml
7373
apiVersion: dapr.io/v1alpha1
@@ -94,14 +94,14 @@ The acceptable values are the same as the ones defined in the [HTTP Status Codes
9494
- gRPC: from 1 to 16
9595
9696
### Setting Format
97-
Both the `httpStatusCodes` and `gRPCStatusCodes` fields are of type string and optional and can be set to a comma-separated list of error codes and/or ranges of error codes.
97+
Both the `httpStatusCodes` and `gRPCStatusCodes` fields are of type string and optional and can be set to a comma-separated list of status codes and/or ranges of status codes.
9898
The range must be in the format `<start>-<end>` (inclusive). Having more than one dash in the range is not allowed.
9999

100100
### Parsing the configuration
101101

102102
The configuration values will be first parsed as comma-separated lists.
103-
Each entry in the list will be then parsed as a single error code or a range of error codes.
104-
For invalid entries, the error will be logged when the policy is first loaded and the entry will be ignored, this will not fail the entire policy or the application start.
103+
Each entry in the list will be then parsed as a single status code or a range of status codes.
104+
Invalid entries will be logged and the application will fail to start.
105105

106106
Example:
107107

@@ -124,15 +124,15 @@ spec:
124124
```
125125
The steps to parse the configuration are:
126126
1. Split the `httpStatusCodes` configuration string `"500,502-504,15,404-405-500,-1,0,"` by the comma character resulting in the following list: `["500", "502-504", "15", "404-405-500", "-1", "0"]` ignoring the empty strings.
127-
2. For each entry in the list, parse it as a single error code or a range of error codes.
128-
3. If the entry is a single error code, add it to the list of error codes to retry.
129-
4. If the entry is a range of error codes (each field for the relevant HTTP or gRPC error codes), add all the error codes in the range to the list of error codes to retry.
127+
2. For each entry in the list, parse it as a single status code or a range of status codes.
128+
3. If the entry is a single status code, add it to the list of status codes to retry.
129+
4. If the entry is a range of status codes (each field for the relevant HTTP or gRPC status codes), add all the status codes in the range to the list of status codes to retry.
130130
- 500 is **valid** code for HTTP
131131
- 502-504 **valid** range of codes for HTTP
132-
- 15 is **invalid** code for HTTP, error logged and entry ignored
133-
- 404-405-500 is **invalid** range contains more than one dash, error logged and entry ignored
134-
- -1 is ignored is **invalid** code for HTTP, error logged and entry ignored
135-
- 0 is ignored is **invalid** code for HTTP, error logged and entry ignored
132+
- 15 is **invalid** code for HTTP, error logged and application will fail to start
133+
- 404-405-500 is **invalid** range contains more than one dash, error logged and application will fail to start
134+
- -1 is ignored is **invalid** code for HTTP, error logged and application will fail to start
135+
- 0 is ignored is **invalid** code for HTTP, error logged and application will fail to start
136136

137137
### Acceptance Criteria
138138

0 commit comments

Comments
 (0)