From e01546b16245818e8167f518bf02a185c4333b1c Mon Sep 17 00:00:00 2001 From: Gal Topper Date: Sun, 27 Oct 2024 19:16:10 +0800 Subject: [PATCH] [Model Monitoring] Log exception trace (#6544) * [Model Monitoring] Log exception trace Development version of #6542. [ML-8073](https://iguazio.atlassian.net/browse/ML-8073) * Keep error in event unchanged --- mlrun/model_monitoring/applications/_application_steps.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mlrun/model_monitoring/applications/_application_steps.py b/mlrun/model_monitoring/applications/_application_steps.py index 532203ba52f9..c155ddc6d365 100644 --- a/mlrun/model_monitoring/applications/_application_steps.py +++ b/mlrun/model_monitoring/applications/_application_steps.py @@ -13,6 +13,7 @@ # limitations under the License. import json +import traceback from typing import Any, Optional, Union import mlrun.common.schemas.alert as alert_objects @@ -164,11 +165,15 @@ def do(self, event): error_data = { "Endpoint ID": event.body.endpoint_id, "Application Class": event.body.application_name, - "Error": event.error, + "Error": "".join( + traceback.format_exception(None, event.error, event.error.__traceback__) + ), "Timestamp": event.timestamp, } logger.error("Error in application step", **error_data) + error_data["Error"] = event.error + event_data = alert_objects.Event( kind=alert_objects.EventKind.MM_APP_FAILED, entity=alert_objects.EventEntities(