def _call_before_write_log_iterator(self, rpc_request, call_mode=EnumCallMode.Simple, timeout=None, trace_info=None): """ 远程调用前写日志,并返回要调用的iterator对象 """ for _request in rpc_request: # 增加调用链信息 _request.trace_id = trace_info.trace_id _request.parent_id = trace_info.call_id _request.trace_level = trace_info.trace_level if self._logger is not None: # 逐个登记调用日志 _info_dict = self._get_request_info_dict(_request, call_mode=call_mode, timeout=timeout, trace_info=trace_info) _info_dict['api_info_type'] = 'STREAM-SEND' _info_dict['err_log_msg'] = 'api call chain send log error' SimpleGRpcTools.write_api_call_chain_log( self._logger, _info_dict) # 返回调用对象 yield _request
def _call_after_write_log_iterator(self, cresult_iterator, start_time, call_mode=EnumCallMode.Simple, timeout=None, trace_info=None): for _cresult in cresult_iterator: if self._logger is not None: # 逐个登记返回结果日志 _info_dict = self._get_cresult_info_dict(_cresult, start_time, call_mode=call_mode, timeout=timeout, trace_info=trace_info) _info_dict['err_log_msg'] = 'api call chain back log error' SimpleGRpcTools.write_api_call_chain_log( self._logger, _info_dict) # 返回结果对象 yield _cresult
def _call_after_write_log(self, cresult, start_time, call_mode=EnumCallMode.Simple, timeout=None, trace_info=None): """ 登记返回结果日志 """ if self._logger is not None: # 登记返回结果日志 _info_dict = self._get_cresult_info_dict(cresult, start_time, call_mode=call_mode, timeout=timeout, trace_info=trace_info) _info_dict['err_log_msg'] = 'api call chain back log error' SimpleGRpcTools.write_api_call_chain_log(self._logger, _info_dict) return cresult
def _call_before_write_log(self, rpc_request, call_mode=EnumCallMode.Simple, timeout=None, trace_info=None): """ 远程调用前写日志,并返回要调用的参数 """ # 增加调用链信息 rpc_request.trace_id = trace_info.trace_id rpc_request.parent_id = trace_info.call_id rpc_request.trace_level = trace_info.trace_level if self._logger is not None: # 登记调用日志 _info_dict = self._get_request_info_dict(rpc_request, call_mode=call_mode, timeout=timeout, trace_info=trace_info) _info_dict['err_log_msg'] = 'api call chain send log error' SimpleGRpcTools.write_api_call_chain_log(self._logger, _info_dict) return rpc_request