use http::{Response, StatusCode, header};
use http_body_util::Full;
use hyper::body::Bytes;
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct ProfilingInfo {
pub status: &'static str,
pub console_addr: String,
pub instructions: &'static str,
}
pub async fn profiling_info_handler(console_addr: String) -> Response<Full<Bytes>> {
let info = ProfilingInfo {
status: "running",
console_addr,
instructions: "Use `tokio-console <addr>` to connect to the console service",
};
let body = serde_json::to_vec(&info).unwrap_or_default();
Response::builder()
.status(StatusCode::OK)
.header(header::CONTENT_TYPE, "application/json")
.body(Full::new(Bytes::from(body)))
.unwrap()
}