fix: traces inputs and outputs not being sent to tracing services (#4669)
* Fix node inputs not being captured, add runtime inputs as well to be captured by the tracers properly * Fix outputs missing on traces due to them being reset before ending the traces because of race conditions * Fallback to project name if none * Remove 'dynamic inputs' to stop sending the component code every time * fix: Add async flow name retrieval in graph building process * fix: Retrieve flow name from database when building graph from data * Fix: make session.exec call awaitable in chat API * Refactor `_get_flow_name` to manage session internally * Refactor session handling to use `async_session_scope` in chat API * Refactor test cases to remove unnecessary async usage in mock functions * [autofix.ci] apply automated fixes --------- Co-authored-by: Gabriel Luiz Freitas Almeida <gabriel@langflow.org> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
b1a552fa9e
commit
1532da59f5
6 changed files with 32 additions and 25 deletions
|
|
@ -36,21 +36,6 @@ class TestEventManager:
|
|||
assert "on_test_event" in manager.events
|
||||
assert manager.events["on_test_event"].func == manager.send_event
|
||||
|
||||
# Sending an event with valid event_type and data using pytest-asyncio plugin
|
||||
async def test_sending_event_with_valid_type_and_data_asyncio_plugin(self):
|
||||
async def mock_queue_put_nowait(item):
|
||||
await queue.put(item)
|
||||
|
||||
queue = asyncio.Queue()
|
||||
queue.put_nowait = mock_queue_put_nowait
|
||||
manager = EventManager(queue)
|
||||
manager.register_event("on_test_event", "test_type", manager.noop)
|
||||
event_type = "test_type"
|
||||
data = "test_data"
|
||||
manager.send_event(event_type=event_type, data=data)
|
||||
await queue.join()
|
||||
assert queue.empty()
|
||||
|
||||
# Accessing a non-registered event callback via __getattr__ with the recommended fix
|
||||
def test_accessing_non_registered_event_callback_with_recommended_fix(self):
|
||||
queue = asyncio.Queue()
|
||||
|
|
@ -70,7 +55,7 @@ class TestEventManager:
|
|||
|
||||
# Handling a large number of events in the queue
|
||||
def test_handling_large_number_of_events(self):
|
||||
async def mock_queue_put_nowait(item):
|
||||
def mock_queue_put_nowait(item):
|
||||
pass
|
||||
|
||||
queue = asyncio.Queue()
|
||||
|
|
@ -97,6 +82,7 @@ class TestEventManager:
|
|||
# Sending an event with complex data and verifying successful event transmission
|
||||
async def test_sending_event_with_complex_data(self):
|
||||
queue = asyncio.Queue()
|
||||
|
||||
manager = EventManager(queue)
|
||||
manager.register_event("on_test_event", "test_type", manager.noop)
|
||||
data = {"key": "value", "nested": [1, 2, 3]}
|
||||
|
|
@ -134,7 +120,7 @@ class TestEventManager:
|
|||
|
||||
# Checking the performance impact of frequent event registrations
|
||||
def test_performance_impact_frequent_registrations(self):
|
||||
async def mock_callback(event_type: str, data: LoggableType):
|
||||
def mock_callback(event_type: str, data: LoggableType):
|
||||
pass
|
||||
|
||||
queue = asyncio.Queue()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue