Skip to content

Commit 4e2773a

Browse files
authored
Document error handling for grpc codes. (#183)
Document why making grpc codes DeadlineExceeded and Unavailable as recoverable errors.
1 parent 31762bc commit 4e2773a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

stackdriver/client.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,16 @@ func (c *Client) Store(req *monitoring.CreateTimeSeriesRequest) error {
180180
return
181181
}
182182
switch status.Code() {
183+
// codes.DeadlineExceeded:
184+
// It is safe to retry
185+
// google.monitoring.v3.MetricService.CreateTimeSeries
186+
// requests with backoff because QueueManager
187+
// enforces in-order writes on a time series, which
188+
// is a requirement for Stackdriver monitoring.
189+
//
190+
// codes.Unavailable:
191+
// The condition is most likely transient. The request can
192+
// be retried with backoff.
183193
case codes.DeadlineExceeded, codes.Unavailable:
184194
errors <- recoverableError{err}
185195
default:

0 commit comments

Comments
 (0)