Skip to content

Commit 30c14c1

Browse files
committed
chore: Gracefully exit logfire trace
1 parent 00ddb9a commit 30c14c1

File tree

1 file changed

+8
-0
lines changed
  • agents_mcp_usage/multi_mcp/multi_mcp_use

1 file changed

+8
-0
lines changed

agents_mcp_usage/multi_mcp/multi_mcp_use/adk_mcp.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import asyncio
22
import contextlib
33
import os
4+
import time
45

56
import logfire
67
from dotenv import load_dotenv
@@ -123,6 +124,13 @@ async def main(query: str = "Hi!", request_limit: int = 5) -> None:
123124
await exit_stack.aclose()
124125
print("Cleanup complete.")
125126

127+
# Give Logfire time to complete any pending exports
128+
print("Shutting down Logfire...")
129+
logfire.shutdown()
130+
# Small delay to ensure export completes
131+
time.sleep(0.5)
132+
print("Logfire shutdown complete.")
133+
126134

127135
if __name__ == "__main__":
128136
query = f"Add the current time and fix the mermaid diagram syntax using the validator: {invalid_mermaid_diagram_easy}. Return only the fixed mermaid diagram between backticks."

0 commit comments

Comments
 (0)