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):
208
208
return jsonify (response )
209
209
210
210
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
+
211
226
def start (args ):
212
227
api = None
213
228
try :
Original file line number Diff line number Diff line change @@ -398,6 +398,21 @@ def predict(deployment_name, api_name):
398
398
return jsonify (response )
399
399
400
400
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
+
401
416
def extract_signature ():
402
417
signature_def = local_cache ["metadata" ]["signatureDef" ]
403
418
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