feat: add monitoring resources (alerts, dashboard, service-monitor)

- PrometheusRule with 16 alerts across 6 groups:
  availability, ingest, query, dependencies, resources, errors
- Grafana dashboard (ConfigMap, sidecar auto-discovery):
  8 rows covering overview, ingest pipeline, query perf,
  context retrieval, database, relevance, error breakdown,
  app resources, logs
- ServiceMonitor moved from k8s/app/ to k8s/monitoring/
- Dashboard generator script (Python, matches homelab pattern)
- Separate k8s/monitoring/ path for ArgoCD Application
- sqlx::migrate!() added to server startup for seamless migrations
This commit is contained in:
2026-09-16 11:52:47 +09:00
parent 6d74ba5d93
commit 8902e1b6fa
6 changed files with 614 additions and 7 deletions
+10 -3
View File
@@ -200,12 +200,19 @@ pub async fn start_server(port: u16, api_key: String, database_url: &str) -> Res
let pool = PgPool::connect(database_url).await?;
tracing::info!("Connected to database");
// Initialize schema
// Initialize base schema (CREATE TABLE IF NOT EXISTS)
match init_schema(&pool).await {
Ok(_) => tracing::info!("Schema initialized"),
Ok(_) => tracing::info!("Base schema initialized"),
Err(e) => {
tracing::warn!("Schema init error (may be non-fatal): {}", e);
// Continue anyway - tables might exist
}
}
// Run numbered migrations (001-009+) — idempotent, tracks state in _sqlx_migrations table
match sqlx::migrate!("./migrations").run(&pool).await {
Ok(_) => tracing::info!("Migrations applied"),
Err(e) => {
tracing::warn!("Migration error (may be non-fatal): {}", e);
}
}