pub(crate) fn shutdown(
exit_code: i32,
sentinel: Option<&SentinelClient>,
run_ctx: Option<Arc<Mutex<RunContext>>>,
shutdown_flag: Option<Arc<AtomicBool>>,
upload_handle: Option<JoinHandle<Vec<String>>>,
remaining: Vec<Sample>,
interval_secs: u64,
) -> !Expand description
Flush remaining samples, close the Sentinel run, then exit.
Called on both shell-wrapper child exit and SIGTERM. Replaces the former
bare std::process::exit() calls so the upload thread always gets a chance
to flush.