Skip to main content
Applies to:
  • Plan -
  • Deployment -

Summary

Issue: Traces for existing conversations using span.export() stop appearing in production logs after a server restart while new conversations continue to log correctly. Cause: Exported span context is not persisted across restarts. Without it, the SDK creates an orphan span with no parent instead of continuing the existing trace. Resolution: Persist exported span context to a durable store (e.g., a database) and reload it when needed to maintain trace continuity.

Resolution steps

Persist exported span context to maintain trace continuity

Step 1: Store exported span context in a durable location

Save the exported context to a database or persistent store after each operation.

Step 2: Retrieve and use the context for subsequent operations

Load the stored context before creating new spans to maintain the trace relationship.

Step 3: Verify trace continuity

After implementing persistence, confirm that operations appearing after a restart continue under the existing trace rather than creating new orphaned traces.