Skip to content

Commit

Permalink
Document error handling for grpc codes. (#183)
Browse files Browse the repository at this point in the history
Document why making grpc codes DeadlineExceeded and Unavailable
as recoverable errors.
  • Loading branch information
StevenYCChou authored Oct 3, 2019
1 parent 31762bc commit 4e2773a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions stackdriver/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,16 @@ func (c *Client) Store(req *monitoring.CreateTimeSeriesRequest) error {
return
}
switch status.Code() {
// codes.DeadlineExceeded:
// It is safe to retry
// google.monitoring.v3.MetricService.CreateTimeSeries
// requests with backoff because QueueManager
// enforces in-order writes on a time series, which
// is a requirement for Stackdriver monitoring.
//
// codes.Unavailable:
// The condition is most likely transient. The request can
// be retried with backoff.
case codes.DeadlineExceeded, codes.Unavailable:
errors <- recoverableError{err}
default:
Expand Down

0 comments on commit 4e2773a

Please sign in to comment.