diff --git a/agentops/session/exporter.py b/agentops/session/exporter.py index 28fd15dd..b4edfd85 100644 --- a/agentops/session/exporter.py +++ b/agentops/session/exporter.py @@ -59,7 +59,7 @@ def encode_event(obj: Any) -> Dict[str, Any]: return obj -class GenericAdapter: +class SessionSpanAdapter: """Adapts any object to a dictionary of span attributes""" @staticmethod @@ -207,7 +207,7 @@ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult: events = [] for span in spans: # Convert span attributes to event using adapter - event = GenericAdapter.from_span_attributes(span.attributes or {}) + event = SessionSpanAdapter.from_span_attributes(span.attributes or {}) # Add session ID event["session_id"] = str(self.session.session_id) events.append(event) @@ -313,7 +313,7 @@ def _record_otel_event(self, event: Union[Event, ErrorEvent], flush_now: bool = ) as span: try: # Use GenericAdapter to convert event to span attributes - span_attributes = GenericAdapter.to_span_attributes(event) + span_attributes = SessionSpanAdapter.to_span_attributes(event) span.set_attributes(span_attributes) except Exception as e: # Set error status on span and re-raise diff --git a/tests/session/test_exporter.py b/tests/session/test_exporter.py index 1ef85c15..4578c7c7 100644 --- a/tests/session/test_exporter.py +++ b/tests/session/test_exporter.py @@ -32,7 +32,7 @@ def test_generic_adapter_conversion(session): from datetime import datetime from uuid import UUID - from agentops.session.exporter import GenericAdapter + from agentops.session.exporter import SessionSpanAdapter from agentops.event import ActionEvent # Create a test event with various attribute types @@ -51,7 +51,7 @@ def test_generic_adapter_conversion(session): test_event.session_id = session.session_id # Test conversion to span attributes - span_attrs = GenericAdapter.to_span_attributes(test_event) + span_attrs = SessionSpanAdapter.to_span_attributes(test_event) # Verify basic attribute conversion assert span_attrs["event.type"] == "actions" @@ -76,7 +76,7 @@ def test_generic_adapter_conversion(session): assert span_attrs["session.id"] == str(session.session_id) # Test conversion back from span attributes - event_attrs = GenericAdapter.from_span_attributes(span_attrs) + event_attrs = SessionSpanAdapter.from_span_attributes(span_attrs) # Verify event structure assert event_attrs["event_type"] == "actions"