diff --git a/rasa_sdk/tracing/instrumentation/attribute_extractors.py b/rasa_sdk/tracing/instrumentation/attribute_extractors.py index ff389438c..40fd0051f 100644 --- a/rasa_sdk/tracing/instrumentation/attribute_extractors.py +++ b/rasa_sdk/tracing/instrumentation/attribute_extractors.py @@ -25,7 +25,7 @@ def extract_attrs_for_action_executor( :param action_call: The `ActionCall` argument. :return: A dictionary containing the attributes. """ - attributes = {"sender_id": action_call["sender_id"]} + attributes = {"sender_id": action_call.get("sender_id", "None")} action_name = action_call.get("next_action") if action_name: diff --git a/rasa_sdk/tracing/utils.py b/rasa_sdk/tracing/utils.py index 719b9f1ac..55b89dbfd 100644 --- a/rasa_sdk/tracing/utils.py +++ b/rasa_sdk/tracing/utils.py @@ -43,7 +43,7 @@ def set_span_attributes(span: Any, action_call: dict) -> None: "next_action": action_call.get("next_action"), "version": action_call.get("version"), "sender_id": tracker.get("sender_id"), - "message_id": tracker.get("latest_message", {}).get("message_id"), + "message_id": tracker.get("latest_message", {}).get("message_id", "None"), } if span.is_recording():