Is your feature request related to a problem? Please describe.
The current behavior for grpc does not utilize DirectPath. DirectPath leads to improved latency for request originating from GCE VMs and gcloud storage relies on this feature.
Describe the solution you'd like
Two changes are needed:
if compute_engine_channel_credentials_requested:
return grpc.compute_engine_channel_credentials(google_auth_credentials)
else:
grpc.composite_channel_credentials(ssl_credentials, google_auth_credentials)
where, compute_engine_channel_credentials_requested will be a bool passed to the create_channel call. Alternatively, it can rely on the env variable like it's done for other languages
Describe alternatives you've considered
For #2 above, we can potentially update the GAPIC client generator to create the host name with google-c2p:/// prefixed. But I think given that all other languages are handling it in the middleware, it is appropriate to make this change in this library.
Additional context
There is an internal bug related to this, but I'm not sure if I link it on a public repo.
Is your feature request related to a problem? Please describe. The current behavior for grpc does not utilize DirectPath. DirectPath leads to improved latency for request originating from GCE VMs and
gcloud storage
relies on this feature.Describe the solution you'd like Two changes are needed:
Replace: https://github.com/googleapis/python-api-core/blob/b6eb6dee2762b602d553ace510808afd67af461d/google/api_core/grpc_helpers.py#L267 with:
where, compute_engine_channel_credentials_requested will be a
bool
passed to thecreate_channel
call. Alternatively, it can rely on the env variable like it's done for other languagesAdd the
google-c2p
resolver. This can be similar to how other languages e.g. go handles it https://github.com/googleapis/google-api-go-client/blob/8d8f0a70d0bd6ba4daaa08370d1420f759ff7f9d/transport/grpc/dial.go#L182Describe alternatives you've considered For
#2
above, we can potentially update the GAPIC client generator to create the host name withgoogle-c2p:///
prefixed. But I think given that all other languages are handling it in the middleware, it is appropriate to make this change in this library.Additional context There is an internal bug related to this, but I'm not sure if I link it on a public repo.