Skip to content

Commit

Permalink
feat(session/exporter): add event ID generation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
teocns committed Nov 27, 2024
1 parent 8e8d173 commit 1e771a6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion agentops/session/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1e771a6

Please sign in to comment.