Skip to content

Commit

Permalink
chore: skip logging for streaming rest RPCs
Browse files Browse the repository at this point in the history
  • Loading branch information
ohmayr committed Dec 9, 2024
1 parent 8ceeaae commit b5b9f17
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ class {{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
{% endif %}{# method.lro #}
{#- TODO(https://github.com/googleapis/gapic-generator-python/issues/2274): Add debug log before intercepting a request #}
resp = self._interceptor.post_{{ method.name|snake_case }}(resp)
{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2279): Add logging support for rest streaming. #}
{% if not method.server_streaming %}
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER
http_response = {
"payload": {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(resp){% else %}json_format.MessageToJson(resp){% endif %},
Expand All @@ -272,6 +274,7 @@ class {{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
"httpResponse": http_response,
},
)
{% endif %}{# if not method.server_streaming #}
return resp

{% endif %}{# method.void #}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ class Async{{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
json_format.Parse(content, pb_resp, ignore_unknown_fields=True)
{% endif %}{# if method.server_streaming #}
resp = await self._interceptor.post_{{ method.name|snake_case }}(resp)
{# TODO(https://github.com/googleapis/gapic-generator-python/issues/2279): Add logging support for rest streaming. #}
{% if not method.server_streaming %}
if CLIENT_LOGGING_SUPPORTED and _LOGGER.isEnabledFor(logging.DEBUG): # pragma: NO COVER
http_response = {
"payload": {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(response){% else %}json_format.MessageToJson(response){% endif %},
Expand All @@ -232,7 +234,7 @@ class Async{{service.name}}RestTransport(_Base{{ service.name }}RestTransport):
"httpResponse": http_response,
},
)

{% endif %}{# if not method.server_streaming #}
return resp

{% endif %}{# method.void #}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _DeleteInstance(_BaseCloudRedisRestTransport._BaseDeleteInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -934,7 +933,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _ExportInstance(_BaseCloudRedisRestTransport._BaseExportInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1054,7 +1052,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _FailoverInstance(_BaseCloudRedisRestTransport._BaseFailoverInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1174,7 +1171,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _GetInstance(_BaseCloudRedisRestTransport._BaseGetInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1288,7 +1284,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _GetInstanceAuthString(_BaseCloudRedisRestTransport._BaseGetInstanceAuthString, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1402,7 +1397,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _ImportInstance(_BaseCloudRedisRestTransport._BaseImportInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1522,7 +1516,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _ListInstances(_BaseCloudRedisRestTransport._BaseListInstances, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1638,7 +1631,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _RescheduleMaintenance(_BaseCloudRedisRestTransport._BaseRescheduleMaintenance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1758,7 +1750,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _UpdateInstance(_BaseCloudRedisRestTransport._BaseUpdateInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1878,7 +1869,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

class _UpgradeInstance(_BaseCloudRedisRestTransport._BaseUpgradeInstance, AsyncCloudRedisRestStub):
Expand Down Expand Up @@ -1998,7 +1988,6 @@ async def __call__(self,
"httpResponse": http_response,
},
)

return resp

@property
Expand Down

0 comments on commit b5b9f17

Please sign in to comment.