This commit is contained in:
Hugh Kaznowski
2026-09-05 12:23:46 +01:00
parent 818f8d09ea
commit 68548911bc
34 changed files with 3262 additions and 4 deletions
+46 -2
View File
@@ -1,3 +1,47 @@
fn main() {
println!("Hello, world!");
mod api;
mod data_value;
mod dto;
mod engine;
mod index_key;
mod ingest;
mod metric_primitive;
mod timestamp;
use clap::Parser;
use tokio::net::TcpListener;
use tokio::sync::mpsc;
/// Observability dashboard from terminal output.
#[derive(Parser, Debug)]
struct Args {
/// Port to serve the API and webapp on.
#[arg(long, default_value_t = 8420)]
port: u16,
/// Directory containing the built webapp (index.html + assets).
#[arg(long, default_value = "webapp/dist")]
static_dir: String,
}
#[tokio::main]
async fn main() {
let args = Args::parse();
let (engine_tx, engine_rx) = mpsc::channel(1024);
tokio::spawn(engine::run(engine_rx));
tokio::spawn(ingest::run(engine_tx.clone()));
let app = api::router(engine_tx, &args.static_dir);
let listener = TcpListener::bind(("0.0.0.0", args.port))
.await
.expect("failed to bind listener");
eprintln!(
"ottyl serving on http://localhost:{} (reading logs from stdin)",
args.port
);
axum::serve(listener, app)
.await
.expect("server error");
}