Unverified Commit ed290f0a authored by Graham King's avatar Graham King Committed by GitHub
Browse files

feat(dynamo-run): Print HTTP routes on startup (#1010)

For #1006

Prints this on startup:
```
2025-05-09T13:06:34.529Z DEBUG dynamo_run::input::http: Supported routes: ["GET /metrics", "GET /dynamo/alpha/list-models", "GET /v1/models", "POST /v1/chat/completions", "POST /v1/completions"]
```
parent 087d398d
......@@ -98,6 +98,14 @@ pub async fn run(
manager.add_completions_model(model.service_name(), cmpl_pipeline)?;
}
}
tracing::debug!(
"Supported routes: {:?}",
http_service
.route_docs()
.iter()
.map(|rd| rd.to_string())
.collect::<Vec<String>>()
);
http_service.run(runtime.primary_token()).await?;
runtime.shutdown(); // Cancel primary token
Ok(())
......
......@@ -231,7 +231,7 @@ impl DeploymentState {
}
/// Documentation for a route
#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct RouteDoc {
method: axum::http::Method,
path: String,
......
......@@ -15,6 +15,7 @@
use super::metrics;
use super::ModelManager;
use super::RouteDoc;
use crate::request_template::RequestTemplate;
use anyhow::Result;
use derive_builder::Builder;
......@@ -27,6 +28,7 @@ pub struct HttpService {
router: axum::Router,
port: u16,
host: String,
route_docs: Vec<RouteDoc>,
}
#[derive(Clone, Builder)]
......@@ -82,6 +84,11 @@ impl HttpService {
Ok(())
}
/// Documentation of exposed HTTP endpoints
pub fn route_docs(&self) -> &[RouteDoc] {
&self.route_docs
}
}
impl HttpServiceConfigBuilder {
......@@ -133,6 +140,7 @@ impl HttpServiceConfigBuilder {
router,
port: config.port,
host: config.host,
route_docs: all_docs,
})
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment