# Monitoring Plan — frontend-shell Decisions: [monitoring-setup-plan.md](../plans/monitoring-setup-plan.md) (Q1 = A, Q2 = D, Q3 = A, Q4 = A, Q5 = A, Q6 = A + production now, Q7 = A). ## Overview ```mermaid graph LR Visitor["Visitor browser"] -->|"JS errors"| Sentry["Sentry (EU), existing org"] Visitor -->|"page views, cookieless"| Umami["Umami on the Pi, analytics.slpsoftware.nl"] Uptime["UptimeRobot"] -->|"HTTP checks"| Site["andreaslop.nl and test.andreaslop.nl"] Sentry -->|"e-mail, new error type"| Owner["Owner"] Uptime -->|"e-mail, site down"| Owner classDef visitor fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000; classDef service fill:#e9d5ff,stroke:#6b21a8,stroke-width:1px,color:#000; classDef site fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000; classDef owner fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000; class Visitor visitor; class Sentry,Umami,Uptime service; class Site site; class Owner owner; ``` Text alternative: visitors' browsers send JavaScript errors to Sentry and cookieless page views to Umami; UptimeRobot checks both sites from outside; Sentry and UptimeRobot e-mail the owner. ## Chosen Approach (all three, reusing existing services) | Area | Service | What it covers | Code needed | |---|---|---|---| | **Logging** | **Sentry** (existing EU organisation, new project `andreaslop-fotografie`) | JavaScript errors in visitors' browsers: render errors caught by `ErrorPage` and unhandled errors, tagged `test` or `production` | Yes | | **Dashboards: visitors** | **Umami** (existing install on the Pi, two new "websites": test and production) | Page views, referrers, devices, without cookies or personal data | Yes | | **Dashboards: availability** | **UptimeRobot** (existing account, new monitors) | Whether test and production respond; response time history | No | | **Alerting** | Sentry + UptimeRobot defaults | E-mail on a **new** type of error (Sentry) and when a site is **down** (UptimeRobot) | No | ## Key Decisions | # | Decision | Why | |---|---|---| | M1 | **One build for both environments**: the browser picks the environment from the hostname (`andreaslop.nl` → production, `test.andreaslop.nl` → test). Any other host (localhost, Lighthouse CI, previews) sends **nothing**. | Keeps "deploy exactly what was tested" (D-pipeline). Local runs and CI never pollute the dashboards. | | M2 | **Sentry and Umami settings live in code** (`src/monitoring/config.ts`), not in Gitea variables. | The Sentry DSN and Umami website IDs are public by design: they end up in every visitor's browser anyway. In code they are reviewed, tested and versioned. | | M3 | **Sentry sends directly** to `*.ingest.de.sentry.io` (no tunnel). | Q4 = A: the IIS host serves only static files until the .NET API exists; some errors from visitors with ad-blockers are missed. Follow-up: tunnel via the API. | | M4 | **Sentry loads after the page**, not in the main bundle. | Keeps the performance budget: the home page on mobile already sits just above its 0.8 target. Errors are queued until Sentry is ready. | | M5 | **Sentry: errors only.** No performance tracing, no session replay, no personal data (`sendDefaultPii: false`, IP storage off in the project settings). | Smallest bundle, least data, simplest privacy story. | | M6 | **Umami: separate websites for test and production**; `data-domains` restricts counting to the right hostname, and `data-do-not-track` respects the browser's Do Not Track setting. | Test traffic never mixes with real numbers. | | M7 | **CSP exceptions as narrow as possible**, generated into `web.config` and the nginx config like the other headers. | Nothing else is opened. | | M8 | **UptimeRobot**: production monitor now (it watches the current WordPress site until the DNS switch, then the new site automatically), test now, and the `/portfolio` deep-link monitors. | Q6 = A, owner: production can start now. | ## Explicitly Out of Scope - Sentry tunnel against ad-blockers: comes with the .NET API (follow-up). - Server-side logging (nginx, IIS): not managed by this project. nginx logs on the Pi and the hoster's IIS logs stay where they are. - Performance tracing, session replay, custom Umami events. - Alerts other than e-mail. ## Privacy (action item for the privacy statement page) The privacy statement (still a placeholder) must mention: - **Umami**: anonymous, cookieless visit statistics, self-hosted in the Netherlands, no personal data. - **Sentry**: technical error reports, sent to Sentry (EU region) without IP address or personal data. Umami without cookies needs no cookie banner under the Dutch DPA's guidance for analytics that are set up privacy-friendly. Sentry error reporting falls under legitimate interest. **This is not legal advice; check it when writing the privacy statement.**