2024-11-23 19:57:17 +01:00
|
|
|
use anyhow::Result;
|
|
|
|
use clap::Parser;
|
|
|
|
use tokio::time::{sleep, Duration};
|
|
|
|
|
2024-12-14 22:47:40 +01:00
|
|
|
mod patagia_api;
|
|
|
|
|
2024-11-23 19:57:17 +01:00
|
|
|
#[derive(Parser, Debug)]
|
|
|
|
#[command(version, about, long_about = None)]
|
2024-12-25 00:11:50 +01:00
|
|
|
struct Cli {
|
|
|
|
#[arg(long = "telemetry-otlp-endpoint", default_value = "http://localhost:4317", value_name = "OTEL_EXPORTER_OTLP_ENDPOINT")]
|
|
|
|
otlp_endpoint: Option<String>,
|
2024-12-25 17:52:55 +01:00
|
|
|
|
|
|
|
#[arg(long = "log-stderr", short = 'v', default_value = "false", value_name = "LOG_TO_STDERR")]
|
|
|
|
log_stderr: bool
|
2024-12-25 00:11:50 +01:00
|
|
|
}
|
2024-11-23 19:57:17 +01:00
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<()> {
|
2024-12-25 00:11:50 +01:00
|
|
|
let args = Cli::parse();
|
2024-12-25 17:52:55 +01:00
|
|
|
let _tracing = instrumentation::init_tracing(args.otlp_endpoint.as_ref(), args.log_stderr)?;
|
2024-11-23 19:57:17 +01:00
|
|
|
|
|
|
|
tracing::info!("Patagia Agent");
|
|
|
|
|
2024-12-14 22:47:40 +01:00
|
|
|
let client = patagia_api::Client::new("http://localhost:9474");
|
|
|
|
let result = client.version().await?;
|
|
|
|
tracing::info!("Result: {:?}", result);
|
|
|
|
|
2024-11-23 19:57:17 +01:00
|
|
|
sleep(Duration::from_secs(3)).await;
|
|
|
|
Ok(())
|
|
|
|
}
|