Skip to main content

Signature

Parameters

None.

Example

Behavior

When called, shutdown():
  1. Stops the background flush timer
  2. Flushes all pending traces
  3. Cleans up the RDK client instance
  4. Removes SDK instrumentation

Use Cases

FastAPI lifespan:
Script completion:
Signal handling:

Importance

Always call shutdown() before your application exits. Otherwise, pending traces may be lost.
Traces are batched in memory. Without shutdown():
  • Traces below the batch size won’t be sent
  • Traces waiting for the flush interval won’t be sent

Thread Safety

shutdown() is thread-safe but should only be called once.

See Also

  • init() - Initialize the client
  • flush() - Manual flush without shutdown