feat: JSON-Logging mit Correlation-ID, Anfrage-Log und Audit (M2.4)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 17:39:03 +01:00
parent 2ec9eccde6
commit 6cb930d0b0
31 changed files with 1050 additions and 67 deletions

View File

@ -70,9 +70,12 @@ impl Runtime {
if running.engine.health(&running.handle).await != Health::Gone {
return Ok(running.engine.endpoint(&running.handle));
}
tracing::warn!(model = %plan.model, instance_id = running.handle.id, "Instanz ist verschwunden, wird neu gestartet");
*guard = None;
}
tracing::info!(model = %plan.model, engine = %plan.engine_name, "Modell wird gestartet");
let started = std::time::Instant::now();
let spec = ProfileSpec {
model_alias: plan.model.clone(),
model_path: plan.model_path.clone(),
@ -80,14 +83,22 @@ impl Runtime {
context: plan.context,
extra_args: plan.extra_args.clone(),
};
let handle = engine
.start(&spec)
.await
.map_err(|source| RuntimeError::Start {
let handle = engine.start(&spec).await.map_err(|source| {
tracing::error!(model = %plan.model, fehler = %source, "Modellstart fehlgeschlagen");
RuntimeError::Start {
model: plan.model.clone(),
source,
})?;
}
})?;
let endpoint = engine.endpoint(&handle);
tracing::info!(
model = %plan.model,
instance_id = handle.id,
pid = handle.pid,
port = handle.port,
duration_ms = started.elapsed().as_millis() as u64,
"Modell bereit"
);
*guard = Some(Running { engine, handle });
Ok(endpoint)
}
@ -102,10 +113,13 @@ impl Runtime {
.cloned()
.collect();
for slot in slots {
if let Some(running) = slot.lock().await.take()
&& let Err(e) = running.engine.stop(&running.handle, self.stop_grace).await
{
eprintln!("FEHLER Beenden einer Instanz: {e}");
if let Some(running) = slot.lock().await.take() {
match running.engine.stop(&running.handle, self.stop_grace).await {
Ok(()) => tracing::info!(instance_id = running.handle.id, "Instanz beendet"),
Err(e) => {
tracing::error!(instance_id = running.handle.id, fehler = %e, "Beenden einer Instanz fehlgeschlagen")
}
}
}
}
}