Signature
Parameters
None.
Example
Behavior
When called, shutdown():
- Stops the background flush timer
- Flushes all pending traces
- Cleans up the RDK client instance
- 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