Client
compute
Environment
Ubuntu 24.04 on GCE
go version go1.26.1 linux/amd64
Code and Dependencies
package main
func main() {
instanceGroupManagersClient.CallOptions.ListManagedInstances = append(
instanceGroupManagersClient.CallOptions.ListManagedInstances,
gax.WithRetry(mmgcloud.HTTPRetryer),
)
}
HTTPRetryer looks like:
func HTTPRetryer() gax.Retryer {
return gax.OnErrorFunc(
gax.Backoff{}, // Use defaults
func(err error) bool {
// Check for Google API HTTP error codes
if gerr, ok := errors.AsType[*googleapi.Error](err); ok {
if gerr.Code == http.StatusServiceUnavailable ||
gerr.Code == http.StatusGatewayTimeout {
return true
}
...
go.mod
module github.maxmind.com/maxmind/mm_website
go 1.26.0
require (
cloud.google.com/go/compute v1.57.0
)
Expected behavior
CallOptions are respected by ListManagedInstances() when encountering 503:
listing managed instances: geo-scan-southamerica-east1: googleapi: Error 503: Authentication backend unavailable.
Actual behavior
They are not, retries do not happen despite configuring default CallOptions for the method.
Additional context
I think this is similar to #5906. The options for some methods like ListManagedInstances() only come from the parameters:
Whereas in other spots we merge the default opts:
|
opts = append((*c.CallOptions).Resize[0:len((*c.CallOptions).Resize):len((*c.CallOptions).Resize)], opts...) |
I expected the CallOptions would be merged in all cases.
Client
compute
Environment
Ubuntu 24.04 on GCE
go version go1.26.1 linux/amd64
Code and Dependencies
HTTPRetryerlooks like:go.mod
Expected behavior
CallOptionsare respected byListManagedInstances()when encountering 503:listing managed instances: geo-scan-southamerica-east1: googleapi: Error 503: Authentication backend unavailable.Actual behavior
They are not, retries do not happen despite configuring default CallOptions for the method.
Additional context
I think this is similar to #5906. The options for some methods like
ListManagedInstances()only come from the parameters:google-cloud-go/compute/apiv1/region_instance_group_managers_client.go
Line 1393 in 3e3bd2d
Whereas in other spots we merge the default opts:
google-cloud-go/compute/apiv1/region_instance_group_managers_client.go
Line 1767 in 3e3bd2d
I expected the
CallOptionswould be merged in all cases.