Container Environments
How to use the Sentry Native SDK in container environments.
The Sentry Native SDK uses a database path to store events and crash reports. When you are using a containerized environment, you may want to mount a volume to persist the database across container restarts to avoid losing this data.
Starting with SDK version 0.8.3, the option crashpad_wait_for_upload
allows the application (on Linux) to wait for the crashpad_handler
to finish before a shutdown-after-crash.
In SDK versions older than 0.8.3, you could use a script similar to the example below to tie container shutdown to the crashpad_handler
process:
Copied
#!/bin/bash
# ./execute-main-app
crashpad_timeout_s=10
crashpad_process_name=crashpad_handler
crashpad_pid=$(pgrep -n -f $crashpad_process_name)
if [ -n "$crashpad_pid" ]; then
echo "Waiting for crashpad to finish..."
timeout $crashpad_timeout_s tail --pid=$crashpad_pid -f /dev/null
if [ $? -eq 124 ]; then
echo "The crashpad process did not finish within $crashpad_timeout_s seconds"
else
echo "The crashpad process finished successfully"
fi
fi
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").