diff --git a/agentops/session.py b/agentops/session.py index 8351ec738..45b35aaf8 100644 --- a/agentops/session.py +++ b/agentops/session.py @@ -95,6 +95,7 @@ def endpoint(self): def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult: try: events = [] + breakpoint() for span in spans: # Convert span to AgentOps event format assert hasattr(span, "attributes") @@ -376,7 +377,7 @@ def set_tags(self, tags): self.tags = tags self._update_session() - def record(self, event: Union[Event, ErrorEvent]): + def record(self, event: Union[Event, ErrorEvent], flush_now=False): """Record an event using OpenTelemetry spans""" if not self.is_running: return @@ -408,8 +409,7 @@ def record(self, event: Union[Event, ErrorEvent]): event.end_timestamp = get_ISO_time() span.set_attribute("event.end_timestamp", event.end_timestamp) - # Force flush to ensure events are sent immediately in tests - if getattr(self.config, "testing", False): + if flush_now: for processor in SessionExporter.get_tracer_provider().span_processors: processor.force_flush()