Skip to content
Open
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 21 additions & 23 deletions docs/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ Here is a sample Go code to illustrate:
if err != nil {
log.Fatal(err)
}

return st.Err()
```

Expand Down Expand Up @@ -314,8 +313,13 @@ error with code [Unavailable](https://godoc.org/google.golang.org/grpc/codes)
and MAY supply additional
[details via status](https://godoc.org/google.golang.org/grpc/status#Status.WithDetails)
using
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40).
Here is a snippet of sample Go code to illustrate:
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40)
or via Trailer [with the gRPC metadata key `grpc-retry-pushback-ms`](https://github.com/grpc/proposal/blob/master/A6-client-retries.md#pushback).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please link to a permanent link instead of one that can break.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn’t the problem that permanent link may include outdated information?


Some clients may only respect one of these pushback mechanisms, so it's recommended for the server to implement both if it's
critical that it be respected.
Comment thread
DylanRussell marked this conversation as resolved.
Outdated

Here is a snippet of sample Go code to illustrate using `RetryInfo`:

```go
// Do this on the server side.
Expand All @@ -340,29 +344,23 @@ Here is a snippet of sample Go code to illustrate:
}
}
```
Here is a snippet of sample Python code to illustrate using `grpc-retry-pushback-ms`:
Comment thread
DylanRussell marked this conversation as resolved.
Outdated

When the client receives this signal, it SHOULD follow the recommendations
outlined in documentation for
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40):

```
// Describes when the clients can retry a failed request. Clients could ignore
// the recommendation here or retry when this information is missing from the error
// responses.
//
// It's always recommended that clients should use exponential backoff when
// retrying.
//
// Clients should wait until `retry_delay` amount of time has passed since
// receiving the error response before retrying. If retrying requests also
// fail, clients should use an exponential backoff scheme to increase gradually
// the delay between retries based on `retry_delay` until either a maximum
// number of retries has been reached, or a maximum retry delay cap has been
// reached.
```go
# Do this on the server side.
Comment thread
DylanRussell marked this conversation as resolved.
Outdated
trailer := metadata.Pairs("grpc-retry-pushback-ms", "5000")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this expected to be done only if the server wants to pushback? It is not clear from the sample if this is some sort of permanent option that the server must always set or only set when the server is overloaded and needs to pushback the clients.

grpc.SetTrailer(ctx, trailer)
```

The value of `retry_delay` is determined by the server and is implementation
dependant. The server SHOULD choose a `retry_delay` value that is big enough to
On the client side using gRPC retry config (https://grpc.io/docs/guides/retry/)
will cause gRPC to automatically parse this header and handle all backoff and retry logic.
Comment thread
DylanRussell marked this conversation as resolved.
Outdated

When the client receives this signal, if it isn't using gRPC retry config, it SHOULD
follow the recommendations or outlined in documentation for
[RetryInfo](https://github.com/googleapis/googleapis/blob/6a8c7914d1b79bd832b5157a09a9332e8cbd16d4/google/rpc/error_details.proto#L40).
Comment thread
DylanRussell marked this conversation as resolved.
Outdated

The value of `retry_delay`/`grpc-retry-pushback-ms` is determined by the server and is implementation
dependant. The server SHOULD choose a `retry_delay`/`grpc-retry-pushback-ms` value that is big enough to
give the server time to recover yet is not too big to cause the client to drop
data while being throttled.

Expand Down
Loading