Skip to content

Commit 6478506

Browse files
committed
add comment
1 parent 8b5c863 commit 6478506

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,9 @@ 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 response iterator is in google-api-core #}
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. #}
263265
{% if not method.server_streaming %}
264266
try:
265267
response_payload = {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(response){% else %}json_format.MessageToJson(resp){% endif %}
@@ -269,6 +271,9 @@ class {{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
269271
response_payload = None
270272
{% endif %}{# if not method.server_streaming #}
271273
http_response = {
274+
{# Logging of the streaming response payload is in `google-api-core` because the response #}
275+
{# type `rest_streaming.ResponseIterator` is an iterator. #}
276+
{# Each response 'item' is logged at the time that it is fetched which happens in google-api-core. #}
272277
{% if not method.server_streaming %}
273278
"payload": response_payload,
274279
{% endif %}{# if not method.server_streaming #}

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ 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 response iterator is in google-api-core #}
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. #}
224226
{% if not method.server_streaming %}
225227
try:
226228
response_payload = {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(response){% else %}json_format.MessageToJson(resp){% endif %}
@@ -230,6 +232,9 @@ class Async{{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
230232
response_payload = None
231233
{% endif %}{# if not method.server_streaming #}
232234
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. #}
233238
{% if not method.server_streaming %}
234239
"payload": response_payload,
235240
{% endif %}{# if not method.server_streaming #}

0 commit comments

Comments
 (0)