> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# System Health Dashboard — Integration

> Feature ID: PF-36 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-…

**Feature ID:** PF-36\
**Status:** ✅ Phase 1 & Phase 2 Complete\
**Spec:** [PF-36-system-health-dashboard.md](../../../specs/pf/specs/PF-36-system-health-dashboard.md)\
**Phase 2 Expansion:** [PF-36-PHASE-2-EXPANSION.md](../../../specs/pf/specs/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)

| Dependency                    | Pattern                | Purpose                                                                                    |
| ----------------------------- | ---------------------- | ------------------------------------------------------------------------------------------ |
| PF-10 (Notifications)         | Platform Layer / Event | Alert delivery (Phase 1 threshold alerts; Phase 2 SLA violation alerts — in-app and email) |
| PF-07 (Error Monitoring)      | Platform Layer / Data  | Metrics collection infrastructure; performance monitoring patterns                         |
| PF-01 (Organizations & Sites) | Data                   | Multi-tenant isolation; org-scoped custom metrics and SLA config                           |
| PF-04 (Audit Logging)         | Platform Layer         | Metric and SLA change audit (referenced in Phase 2 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_minutes` per 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'))` and `createLogger` from `_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.

***

## Consumers of PF-36

| Consumer                             | Pattern         | Purpose                                                                             |
| ------------------------------------ | --------------- | ----------------------------------------------------------------------------------- |
| PF-48 (Security Event Monitoring)    | Event / Data    | Security events displayed on health dashboard                                       |
| PF-52 (Query Performance Monitoring) | Data / Platform | Query performance metrics and slow-query summary on or linked from health dashboard |

***

## Related Docs

* [EVENT\_CONTRACTS.md](./EVENT_CONTRACTS.md)
* [PLATFORM\_INTEGRATION\_LAYERS.md](./PLATFORM_INTEGRATION_LAYERS.md)
* [CROSS\_CORE\_INTEGRATIONS.md](./CROSS_CORE_INTEGRATIONS.md)
