diff --git a/agentops/session/exporter.py b/agentops/session/exporter.py index b85d6e3e..93e9d8c9 100644 --- a/agentops/session/exporter.py +++ b/agentops/session/exporter.py @@ -120,9 +120,14 @@ def from_span_attributes(attrs: Union[Dict[str, AttributeValue], Mapping[str, At init_timestamp = attrs.get("event.timestamp") or event_data.get("init_timestamp", current_time) end_timestamp = attrs.get("event.end_timestamp") or event_data.get("end_timestamp", current_time) + # Get event ID - ensure it's a valid UUID string + event_id = event_data.get("id") + if not event_id: + event_id = str(uuid4()) + # Build base event structure base_kwargs = { - "id": attrs.get("event.id", str(uuid4())), + "id": event_id, # Use string ID directly "event_type": attrs.get("event.type", event_data.get("event_type", "unknown")), "init_timestamp": init_timestamp, "end_timestamp": end_timestamp,