6 releases
| 0.0.6 | Nov 7, 2025 |
|---|---|
| 0.0.5 | Nov 4, 2025 |
| 0.0.4 | Oct 17, 2025 |
#1075 in HTTP server
47KB
1K
SLoC
AIKO Monitor Rust
Rust SDK for AIKO Monitoring.
Install
cargo add aiko-monitor --features actix
Set AIKO_PROJECT_KEY and AIKO_SECRET_KEY in your environment before building and running.
Usage
use std::env;
use std::io::Result as IoResult;
use actix_web::middleware::Logger;
use actix_web::{App, HttpResponse, HttpServer, Responder, web};
use aiko_monitor::{Monitor, integrations::actix::ActixMonitor};
use dotenvy::dotenv;
async fn get_users() -> impl Responder {
HttpResponse::Ok()
.content_type("application/json")
.body(r#"{"users": []}"#)
}
#[actix_web::main]
async fn main() -> IoResult<()> {
dotenv().ok();
let monitor = Monitor::new(
env::var("AIKO_PROJECT_KEY").expect("AIKO_PROJECT_KEY must be set"),
env::var("AIKO_SECRET_KEY").expect("AIKO_SECRET_KEY must be set"),
)
.expect("valid monitor configuration");
HttpServer::new(move || {
let monitor = monitor.clone();
App::new()
.wrap(Logger::default())
.wrap(ActixMonitor::new(monitor))
.route("/api/users", web::get().to(get_users))
})
.bind(("127.0.0.1", 3000))?
.run()
.await
}
Dependencies
~4–21MB
~263K SLoC