Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 58d6a89

Browse files
committed
update comments
1 parent 0dda26a commit 58d6a89

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,10 @@ class {{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
259259
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
260260
resp, _ = self._interceptor.post_{{ method.name|snake_case }}_with_metadata(resp, response_metadata)
261261
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER
262-
{# Logging of the streaming response payload is in `google-api-core` because the response #}
263-
{# type `rest_streaming.ResponseIterator` is an iterator. #}
264-
{# Each response 'item' is logged at the time that it is fetched which happens in google-api-core. #}
262+
{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2389): #}
263+
{# Depending how we want to log (a) receiving a streaming response vs (b) exposing the next streamed item to the user, we could possibly want to log something here #}
264+
{# (a) should always happen in api-core #}
265+
{# (b) could happen in api-core, or it could happen here when we iterate to the next streamed item that was previously received. #}
265266
{% if not method.server_streaming %}
266267
try:
267268
response_payload = {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(response){% else %}json_format.MessageToJson(resp){% endif %}
@@ -271,7 +272,7 @@ class {{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
271272
response_payload = None
272273
{% endif %}{# if not method.server_streaming #}
273274
http_response = {
274-
{# Not logging server streaming here. See comment above. #}
275+
{# Not logging response payload for server streaming here. See comment above. #}
275276
{% if not method.server_streaming %}
276277
"payload": response_payload,
277278
{% endif %}{# if not method.server_streaming #}

gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest_asyncio.py.j2

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,10 @@ class Async{{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
220220
response_metadata = [(k, str(v)) for k, v in response.headers.items()]
221221
resp, _ = await self._interceptor.post_{{ method.name|snake_case }}_with_metadata(resp, response_metadata)
222222
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER
223-
{# Logging of the streaming response payload is in `google-api-core` because the response #}
224-
{# type `rest_streaming_async.AsyncResponseIterator` is an iterator. #}
225-
{# Each response 'item' is logged at the time that it is fetched which happens in google-api-core. #}
223+
{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2389): #}
224+
{# Depending how we want to log (a) receiving a streaming response vs (b) exposing the next streamed item to the user, we could possibly want to log something here #}
225+
{# (a) should always happen in api-core #}
226+
{# (b) could happen in api-core, or it could happen here when we iterate to the next streamed item that was previously received. #}
226227
{% if not method.server_streaming %}
227228
try:
228229
response_payload = {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(response){% else %}json_format.MessageToJson(resp){% endif %}
@@ -232,9 +233,7 @@ class Async{{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
232233
response_payload = None
233234
{% endif %}{# if not method.server_streaming #}
234235
http_response = {
235-
{# Logging of the streaming response payload is in `google-api-core` because the response #}
236-
{# type `rest_streaming_async.AsyncResponseIterator` is an iterator. #}
237-
{# Each response 'item' is logged at the time that it is fetched which happens in google-api-core. #}
236+
{# Not logging response payload for server streaming here. See comment above. #}
238237
{% if not method.server_streaming %}
239238
"payload": response_payload,
240239
{% endif %}{# if not method.server_streaming #}

0 commit comments

Comments
 (0)