feat: Resilienz (Fallback-Ketten) und Metriken (#5)
- Fallback-Provider (app/providers/fallback.py) fuer STT/LLM/TTS: Provider-Kette der Reihe nach; Config *_FALLBACK; build_orchestrator baut Ketten (dedupliziert) - LLM-Stream-Fallback nur solange kein Token gesendet wurde - Metriken (app/metrics.py): In-Memory Counter/Timer, keine externe Dependency - HTTP-Middleware (Requests/Latenz/Status je Pfad); Pipeline-Stufen-Timing stt/llm/tts; Fallback-/Fehlerzaehler; GET /api/metrics (JSON + Prometheus) - Tests: 58 gruen (+6); Doku aktualisiert (README, BEDIENUNGSANLEITUNG, Architektur, .env.example) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
093da817d8
commit
6422444017
13 changed files with 452 additions and 23 deletions
|
|
@ -3,16 +3,18 @@ import pytest
|
|||
import app.dependencies as deps
|
||||
from app.config import settings
|
||||
from app.store import SQLiteStore
|
||||
from app.metrics import metrics
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def reset_state(tmp_path, monkeypatch):
|
||||
"""Pro Test: frische SQLite-DB, frischer Singleton-Audio-Router, Auth aus.
|
||||
"""Pro Test: frische SQLite-DB, frischer Singleton-Audio-Router, Auth aus, Metriken leer.
|
||||
|
||||
Auth-Tests schalten `settings.auth_enabled` selbst wieder ein.
|
||||
"""
|
||||
deps._store = SQLiteStore(str(tmp_path / "test.db"))
|
||||
deps._audio_router = None
|
||||
metrics.reset()
|
||||
monkeypatch.setattr(settings, "auth_enabled", False)
|
||||
monkeypatch.setattr(settings, "admin_api_key", "")
|
||||
yield
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue