Skip to content

Commit

Permalink
feat: [RMS-1524] add DeadlineExceeded status code (#416)
Browse files Browse the repository at this point in the history
<!--
  !!!! README !!!! Please fill this out.

  Please follow the PR naming conventions: 

https://outreach-io.atlassian.net/wiki/spaces/EN/pages/1902444645/Conventional+Commits
-->


<!-- A short description of what your PR does and what it solves. -->
## What this PR does / why we need it

This PR is adding `DeadlineExceeded` status code. It's error type that
is quite different to other server side errors and we would like to
track and measure it separately (in our dashboards etc.).

<!-- <<Stencil::Block(jiraPrefix)>> -->

## Jira ID

[RMS-1524]

<!-- <</Stencil::Block>> -->

<!-- Notes that may be helpful for anyone reviewing this PR -->
## Notes for your reviewers



<!-- <<Stencil::Block(custom)>> -->

<!-- <</Stencil::Block>> -->


[RMS-1524]:
https://outreach-io.atlassian.net/browse/RMS-1524?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
  • Loading branch information
dundee authored Dec 8, 2023
1 parent 61a9e89 commit 58dca12
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/statuscodes/statuscode_string.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/statuscodes/statuscodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ const (
// Deprecated: In reality server-side errors should fall into one of the above 3 errors, and this inclusion was
// a mistake. It's not worth a breaking change to revoke at this time, though, so it shall live on.
UnknownError StatusCode = 803
// DeadlineExceeded is for when the server is unable to complete the request within the configured deadline and the
// request times out. This error is retriable, but the duration for backoff is unknown.
DeadlineExceeded StatusCode = 804
)

//go:generate ../../scripts/shell-wrapper.sh gobin.sh golang.org/x/tools/cmd/[email protected] -type=StatusCode
Expand Down Expand Up @@ -136,6 +139,8 @@ func FromString(s string) (StatusCode, bool) {
return Unavailable, true
case UnknownError.String():
return UnknownError, true
case DeadlineExceeded.String():
return DeadlineExceeded, true
default:
return UnknownError, false
}
Expand Down
1 change: 1 addition & 0 deletions pkg/statuscodes/statuscodes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ func TestStatusCodeUnmarshalText(t *testing.T) {
NotImplemented,
Unavailable,
UnknownError,
DeadlineExceeded,
}

for _, code := range codes {
Expand Down

0 comments on commit 58dca12

Please sign in to comment.