feat(PROJ-40,PROJ-41): Prometheus Metriken + Dashboard Zeitreihe
- PROJ-40: /api/health mit Version+Uptime, /metrics Prometheus-Format (mails_last_60min/24h/7d/30d, mails_total, storage_bytes, tenants_total, users_total, uptime_seconds) — Token-Schutz optional konfigurierbar - PROJ-41: GET /api/admin/stats/timeseries (30-Tage tagesgenau, Tenant-scoped) + SVG-Balkendiagramm im Dashboard (Mail-Eingang letzte 30 Tage) - storage.DBQueryRow() Helper für Metrics-Queries ohne Pool-Exposition - config.MetricsConfig (enabled, token) in config.go Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1280,3 +1280,18 @@ func (s *Store) GetVerifyStatus(ctx context.Context, id string) (VerifyStatus, e
|
||||
vs.VerifiedAt = at
|
||||
return vs, nil
|
||||
}
|
||||
|
||||
// DBQueryRow exposes a single DB query row for use by the API metrics handler.
|
||||
// Returns a no-op row if no DB is configured.
|
||||
func (s *Store) DBQueryRow(ctx context.Context, sql string, args ...interface{}) interface {
|
||||
Scan(dest ...interface{}) error
|
||||
} {
|
||||
if s.db == nil {
|
||||
return &noopRow{}
|
||||
}
|
||||
return s.db.QueryRow(ctx, sql, args...)
|
||||
}
|
||||
|
||||
type noopRow struct{}
|
||||
|
||||
func (n *noopRow) Scan(dest ...interface{}) error { return nil }
|
||||
|
||||
Reference in New Issue
Block a user