def _add_response_as_metadata( self, method_name: str = None, data: Any = None, subsegment: aws_xray_sdk.core.models.subsegment = None, capture_response: bool = True, ): """Add response as metadata for given subsegment Parameters ---------- method_name : str, optional method name to add as metadata key, by default None data : Any, optional data to add as subsegment metadata, by default None subsegment : aws_xray_sdk.core.models.subsegment, optional existing subsegment to add metadata on, by default None capture_response : bool, optional Do not include response as metadata, by default True """ if data is None or not capture_response or subsegment is None: return subsegment.put_metadata(key=f"{method_name} response", value=data, namespace=self._config["service"])
def _add_full_exception_as_metadata( self, method_name: str = None, error: Exception = None, subsegment: aws_xray_sdk.core.models.subsegment = None, capture_error: Optional[bool] = None, ): """Add full exception object as metadata for given subsegment Parameters ---------- method_name : str, optional method name to add as metadata key, by default None error : Exception, optional error to add as subsegment metadata, by default None subsegment : aws_xray_sdk.core.models.subsegment, optional existing subsegment to add metadata on, by default None capture_error : bool, optional Do not include error as metadata, by default True """ if not capture_error: return subsegment.put_metadata(key=f"{method_name} error", value=error, namespace=self._config["service"])
def _add_full_exception_as_metadata( self, function_name: str = None, error: Exception = None, subsegment: aws_xray_sdk.core.models.subsegment = None ): """Add full exception object as metadata for given subsegment Parameters ---------- function_name : str, optional function name to add as metadata key, by default None error : Exception, optional error to add as subsegment metadata, by default None subsegment : aws_xray_sdk.core.models.subsegment, optional existing subsegment to add metadata on, by default None """ subsegment.put_metadata(key=f"{function_name} error", value=error, namespace=self._config["service"])
def _add_response_as_metadata( self, function_name: str = None, data: Any = None, subsegment: aws_xray_sdk.core.models.subsegment = None ): """Add response as metadata for given subsegment Parameters ---------- function_name : str, optional function name to add as metadata key, by default None data : Any, optional data to add as subsegment metadata, by default None subsegment : aws_xray_sdk.core.models.subsegment, optional existing subsegment to add metadata on, by default None """ if data is None or subsegment is None: return subsegment.put_metadata(key=f"{function_name} response", value=data, namespace=self._config["service"])