generated from Patagia/template-nix
39 lines
957 B
Rust
39 lines
957 B
Rust
use anyhow::Result;
|
|
use clap::Parser;
|
|
use tokio::time::{sleep, Duration};
|
|
|
|
mod patagia_api;
|
|
|
|
#[derive(Parser, Debug)]
|
|
#[command(version, about, long_about = None)]
|
|
struct Cli {
|
|
#[arg(
|
|
long = "telemetry-otlp-endpoint",
|
|
default_value = "http://localhost:4317",
|
|
value_name = "OTEL_EXPORTER_OTLP_ENDPOINT"
|
|
)]
|
|
otlp_endpoint: Option<String>,
|
|
|
|
#[arg(
|
|
long = "log-stderr",
|
|
short = 'v',
|
|
default_value = "false",
|
|
value_name = "LOG_TO_STDERR"
|
|
)]
|
|
log_stderr: bool,
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> Result<()> {
|
|
let args = Cli::parse();
|
|
let _tracing = instrumentation::init_tracing(args.otlp_endpoint.as_ref(), args.log_stderr)?;
|
|
|
|
tracing::info!("Patagia Agent");
|
|
|
|
let client = patagia_api::Client::new("http://localhost:9474");
|
|
let result = client.version().await?;
|
|
tracing::info!("Result: {:?}", result);
|
|
|
|
sleep(Duration::from_secs(3)).await;
|
|
Ok(())
|
|
}
|