@@ -283,9 +283,10 @@ def _create_composite_credentials(
283
283
else :
284
284
# Use grpc.compute_engine_channel_credentials in order to support Direct Path.
285
285
# See https://grpc.github.io/grpc/python/grpc.html#grpc.compute_engine_channel_credentials
286
- # TODO(b/323073050): Although `grpc.compute_engine_channel_credentials`
287
- # returns channel credentials outside of GCE, we should determine if there is a way to
288
- # reliably detect when the client is in a GCE environment so that
286
+ # TODO(b/323073050):
287
+ # Although `grpc.compute_engine_channel_credentials` returns channel credentials
288
+ # outside of a Google Compute Engine environment (GCE), we should determine if
289
+ # there is a way to reliably detect a GCE environment so that
289
290
# `grpc.compute_engine_channel_credentials` is not called outside of GCE.
290
291
return grpc .compute_engine_channel_credentials (google_auth_credentials )
291
292
@@ -324,16 +325,23 @@ def create_channel(
324
325
default_host (str): The default endpoint. e.g., "pubsub.googleapis.com".
325
326
compression (grpc.Compression): An optional value indicating the
326
327
compression method to be used over the lifetime of the channel.
327
- attempt_direct_path (Optional[bool]): If set, Direct Path will be attempted when
328
- the request is made. Direct Path provides a proxyless connection which
329
- increases the available throughput, reduces latency, and increases
330
- reliability. Outside of GCE, the direct path request may fallback
331
- to DNS if this is configured by the Service. This argument should only
332
- be set in a GCE environment and for Services that are known to support Direct Path.
333
- If a `ServiceUnavailable` response is received when the request is sent, it is
334
- recommended that the client repeat the request with `attempt_direct_path` set to `False`
335
- as the Service may not support Direct Path. Using `ssl_credentials` with `attempt_direct_path`
336
- set to `True` will result in `ValueError` as it is not yet supported.
328
+ attempt_direct_path (Optional[bool]): If set, Direct Path will be attempted
329
+ when the request is made. Direct Path is only available within a Google
330
+ Compute Engine (GCE) environment and provides a proxyless connection
331
+ which increases the available throughput, reduces latency, and increases
332
+ reliability. Note:
333
+
334
+ - This argument should only be set in a GCE environment and for Services
335
+ that are known to support Direct Path.
336
+ - If this argument is set outside of GCE, then this request will fail
337
+ unless the back-end service happens to have configured fall-back to DNS.
338
+ - If the request causes a `ServiceUnavailable` response, it is recommended
339
+ that the client repeat the request with `attempt_direct_path` set to
340
+ `False` as the Service may not support Direct Path.
341
+ - Using `ssl_credentials` with `attempt_direct_path`
342
+ set to `True` will result in `ValueError` as this combination is not yet
343
+ supported.
344
+
337
345
kwargs: Additional key-word args passed to
338
346
:func:`grpc_gcp.secure_channel` or :func:`grpc.secure_channel`.
339
347
Note: `grpc_gcp` is only supported in environments with protobuf < 4.0.0.
0 commit comments