add version info to health endpoint

This commit is contained in:
Markus Brueckner 2026-01-29 18:22:10 +01:00
parent 2fa785c1de
commit 1ae0533f2d

View file

@ -99,6 +99,7 @@ pub async fn put_cache_item(
#[derive(Serialize)]
pub struct HealthStatus {
pub version: &'static str,
pub cache_entries: usize,
pub cache_size: u64,
pub cache_capacity: u64,
@ -123,6 +124,7 @@ pub async fn get_heath_status(app_data: Data<AppState>, auth: BearerAuth) -> imp
let now = SystemTime::now();
if let Ok(shared) = app_data.shared.read() {
HttpResponse::Ok().json(HealthStatus {
version: env!("CARGO_PKG_VERSION"),
cache_entries: shared.lru_cache.len(),
cache_size: shared.stats.cache_size,
cache_capacity: app_data.config.max_cache_size.unwrap_or(u64::MAX),