File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -208,6 +208,21 @@ def get_signature(app_name, api_name):
208208 return jsonify (response )
209209
210210
211+ @app .after_request
212+ def after_request (response ):
213+ if request .full_path .startswith ("/healthz" ):
214+ return response
215+
216+ logger .info ("[%s] %s" , util .now_timestamp_rfc_3339 (), response .status )
217+ return response
218+
219+
220+ @app .errorhandler (Exception )
221+ def exceptions (e ):
222+ logger .exception (e )
223+ return jsonify (error = str (e )), 500
224+
225+
211226def start (args ):
212227 api = None
213228 try :
Original file line number Diff line number Diff line change @@ -398,6 +398,21 @@ def predict(deployment_name, api_name):
398398 return jsonify (response )
399399
400400
401+ @app .after_request
402+ def after_request (response ):
403+ if request .full_path .startswith ("/healthz" ):
404+ return response
405+
406+ logger .info ("[%s] %s" , util .now_timestamp_rfc_3339 (), response .status )
407+ return response
408+
409+
410+ @app .errorhandler (Exception )
411+ def exceptions (e ):
412+ logger .exception (e )
413+ return jsonify (error = str (e )), 500
414+
415+
401416def extract_signature ():
402417 signature_def = local_cache ["metadata" ]["signatureDef" ]
403418 if signature_def .get ("predict" ) is None or signature_def ["predict" ].get ("inputs" ) is None :
You can’t perform that action at this time.
0 commit comments