From 4e2773a8fa2fcc74c714fb7af9bb3126afbacf14 Mon Sep 17 00:00:00 2001 From: Yen-Cheng Chou <3055688+StevenYCChou@users.noreply.github.com> Date: Thu, 3 Oct 2019 13:42:03 -0400 Subject: [PATCH] Document error handling for grpc codes. (#183) Document why making grpc codes DeadlineExceeded and Unavailable as recoverable errors. --- stackdriver/client.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/stackdriver/client.go b/stackdriver/client.go index 8a9a9e02..7904f30f 100644 --- a/stackdriver/client.go +++ b/stackdriver/client.go @@ -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: