googleapis / googleapis/google-cloud-go
compute: Default CallOptions not used for some method calls
- Dominant language
- Go
- Stars
- 4.5k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 109
Description
## Client
compute
## Environment
Ubuntu 24.04 on GCE
go version go1.26.1 linux/amd64
## Code and Dependencies
```go
package main
func main() {
instanceGroupManagersClient.CallOptions.ListManagedInstances = append(
instanceGroupManagersClient.CallOptions.ListManagedInstances,
gax.WithRetry(mmgcloud.HTTPRetryer),
)
}
```
`HTTPRetryer` looks like:
```go
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
```text
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 https://github.com/googleapis/google-cloud-go/issues/5906. The options for some methods like `ListManagedInstances()` only come from the parameters: https://github.com/googleapis/google-cloud-go/blob/3e3bd2d33a7b36e9d7ed4568603bae800268073a/compute/apiv1/region_instance_group_managers_client.go#L1393
Whereas in other spots we merge the default opts: https://github.com/googleapis/google-cloud-go/blob/3e3bd2d33a7b36e9d7ed4568603bae800268073a/compute/apiv1/region_instance_group_managers_client.go#L1767
I expected the `CallOptions` would be merged in all cases.
Contributor guide
Assessment
This issue has not been assessed yet.