Applies to:
Summary
Issue: Traces display empty fields or remain “in progress” indefinitely. Cause: Application terminates beforeflush() completes or spans aren’t properly ended, particularly in serverless/container environments.
Resolution: Explicitly call flush() before termination and ensure all spans are ended.
Resolution Steps
Step 1: Use context managers (recommended)
Python
TypeScript
Step 2: Call flush() explicitly before process exit
Python
TypeScript
Key Points
flush()waits for completion- Context managers automatically call
span.end() - Manual spans: call
span.end()in finally blocks or they remain incomplete - For serverless functions, call
flush()before the handler returns