Skip to content

Commit

Permalink
status tool
Browse files Browse the repository at this point in the history
  • Loading branch information
rescrv committed Dec 3, 2024
1 parent 3568a4e commit d807065
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions rust/load/src/bin/chroma-load-status.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//! Inspect chroma-load
use clap::Parser;

#[derive(Parser, Debug)]
struct Args {
#[arg(long)]
host: String,
}

#[tokio::main]
async fn main() {
let args = Args::parse();
let client = reqwest::Client::new();
match client
.get(&args.host)
.header(reqwest::header::ACCEPT, "application/json")
.send()
.await
{
Ok(resp) => {
if resp.status().is_success() {
let status = resp.json::<chroma_load::rest::Status>().await;
println!("{:#?}", status);
} else {
eprintln!(
"Failed to get workload status on {}: {}",
args.host,
resp.status()
);
}
}
Err(e) => eprintln!("Failed to get workload status on {}: {}", args.host, e),
}
}
2 changes: 1 addition & 1 deletion rust/load/src/rest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl From<&dyn crate::DataSet> for Description {
pub struct Status {
pub running: Vec<WorkloadSummary>,
pub data_sets: Vec<Description>,
pub workloads: Vec<Description>,
pub workloads: Vec<serde_json::Value>,
}

#[derive(Clone, Debug, serde::Deserialize, serde::Serialize)]
Expand Down

0 comments on commit d807065

Please sign in to comment.