Customer Portal — Observability
Status: populated Owner: Product Engineering (Frontend) Last updated: 2026-04-18
1. Logging
The portal uses structured JSON logging via pino in the Next.js server runtime.
Log Format
{
"time": "2026-04-18T12:00:00.000Z",
"level": "info",
"service": "customer-portal",
"requestId": "req_01H...",
"accountId": "acc_01H...",
"method": "GET",
"path": "/messages",
"status": 200,
"durationMs": 142
}
Log Levels
| Level | When |
|---|---|
info | Successful page renders, API proxy calls |
warn | 4xx from upstream, token refresh attempts |
error | 5xx from upstream, unhandled exceptions |
Sensitive data (tokens, cookies, API keys) is never logged.
2. Metrics
GET /api/health for Kubernetes probes. OpenTelemetry instrumentation emits:
| Metric | Type | Labels |
|---|---|---|
portal_request_total | Counter | method, path, status |
portal_request_duration_ms | Histogram | method, path |
portal_upstream_error_total | Counter | upstream, status |
portal_auth_refresh_total | Counter | result |
3. Error Tracking
Sentry for server-side and client-side errors. Sensitive header/cookie values scrubbed in beforeSend hook.
4. Alerting
| Alert | Condition | Severity |
|---|---|---|
PortalHighErrorRate | Upstream 5xx > 5/min for 3 min | warning |
PortalAuthFailureSpike | Auth refresh failures > 20/min | critical |
PortalPodNotReady | Readiness probe failing > 2 min | critical |