use api_bones::{OrgId, OrganizationContext, Principal, RequestId};
use axum::{Extension, Router, routing::get};
use std::error::Error;
use uuid::Uuid;
async fn hello() -> &'static str {
tracing::info!("handling request");
"hello"
}
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn Error>> {
let handles = otel_bootstrap::init_telemetry("axum-org-context-example")?;
let ctx = OrganizationContext::new(
OrgId::generate(),
Principal::human(Uuid::new_v4()),
RequestId::new(),
);
let _app: Router = Router::new()
.route("/", get(hello))
.layer(otel_bootstrap::org_context_span_enricher_layer())
.layer(Extension(ctx))
.layer(otel_bootstrap::axum_layer());
handles.shutdown()?;
Ok(())
}