hotpath 0.26.0

One profiler for CPU, time, memory, SQL, and async code - quickly find and debug performance bottlenecks.
Documentation
#[cfg(all(test, feature = "hotpath"))]
mod tests {
    use std::process::Command;

    use hotpath::json::JsonReport;

    /// The fork case: a job that measures untrusted code gets no OIDC token, so
    /// it writes the JSON report for a trusted job to upload. Nothing may be
    /// posted, and the file must carry what an upload would have sent.
    // cargo run -p test-all-features --example basic_all_features --features hotpath,hotpath-cloud
    #[test]
    fn json_file_is_an_upload_payload() {
        let path = std::env::temp_dir().join("hotpath_cloud_json_file_test.json");
        let _ = std::fs::remove_file(&path);

        let output = Command::new("cargo")
            .args([
                "run",
                "-p",
                "test-all-features",
                "--example",
                "basic_all_features",
                "--features",
                "hotpath,hotpath-cloud",
            ])
            .env("HOTPATH_REPORT", "functions-timing")
            .env("HOTPATH_OUTPUT_FORMAT", "json")
            .env("HOTPATH_OUTPUT_PATH", &path)
            .env("HOTPATH_BENCHMARK", "fork-test")
            .env("HOTPATH_LIMIT", "1")
            .env_remove("ACTIONS_ID_TOKEN_REQUEST_URL")
            .env_remove("ACTIONS_ID_TOKEN_REQUEST_TOKEN")
            .env_remove("HOTPATH_UPLOAD")
            .env_remove("HOTPATH_UPLOAD_LIMIT")
            .output()
            .expect("Failed to execute command");
        assert!(
            output.status.success(),
            "Process did not exit successfully.\n\nstderr:\n{}",
            String::from_utf8_lossy(&output.stderr)
        );

        let stderr = String::from_utf8_lossy(&output.stderr);
        assert!(
            !stderr.contains("upload"),
            "nothing should attempt an upload:\n{stderr}"
        );

        let body = std::fs::read_to_string(&path).expect("report file was not written");
        let report: JsonReport = serde_json::from_str(&body).expect("file is not a JSON report");
        assert_eq!(report.meta.benchmark.as_deref(), Some("fork-test"));
        assert!(
            report.meta.git.is_some(),
            "no git provenance in the payload"
        );

        let functions = report
            .functions_timing
            .expect("No functions_timing section in report");
        assert!(
            functions.total_count > 1,
            "example must measure several functions"
        );
        assert_eq!(
            functions.included_count, functions.total_count,
            "payload must ignore HOTPATH_LIMIT"
        );

        let _ = std::fs::remove_file(&path);
    }
}