Status: ✅ Phase 1 & Phase 2 Complete
Spec: PF-36-system-health-dashboard.md
Phase 2 Expansion: PF-36-PHASE-2-EXPANSION.md
Last Updated: 2026-03-04
Overview
PF-36 (System Health Dashboard) provides real-time operational visibility, metrics collection, and alerting for administrators. Phase 1 delivers the core health dashboard, metrics storage, and threshold-based alerting. Phase 2 adds organization-specific custom metrics, SLA threshold configuration, SLA violation detection, and compliance reporting. This document covers integration points for both phases: consumption of PF-10 (Notifications) and PF-07 (Error Monitoring), and (Phase 2) custom metric collection and SLA alert delivery.Integration Points (from Spec)
Phase 2: Custom Metrics & SLA
PF-10 Notifications Integration
- Usage: SLA violation alerts are sent via PF-10 (in-app notification and email).
- Payload shape: Alert includes metric name, current value, threshold, severity. Recipients configured per threshold via
alert_recipients(email, name, user_id for in-app). - Cooldown:
alert_cooldown_minutesper threshold to prevent alert spam. - Implementation: Violation-detection job (edge function/cron, e.g. every 1 minute) evaluates thresholds, creates/updates
pf_sla_violations, and calls PF-10 for each new violation or first alert after cooldown.
PF-07 Error Monitoring Integration
- Usage: Leverage existing metric storage and collection patterns where applicable; custom metrics extend the platform’s observable surface.
- Data boundary: Custom metric values stored in
pf_custom_metric_values; no direct schema dependency on PF-07 tables.
Edge Functions (Phase 2)
- Metric collection: Edge function(s) for API/sql/edge_function collection methods. SQL collection MUST run server-side only (never client). Use
getCorsHeaders(req.headers.get('origin'))andcreateLoggerfrom_shared/per platform edge-function standards. - SLA violation detection: Scheduled job (e.g. cron every 1 minute) runs as edge function or pg_cron; uses service role or SECURITY DEFINER to INSERT/UPDATE
pf_sla_violations; then invokes PF-10 for delivery.