Skip to main content

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

LevelWhen
infoSuccessful page renders, API proxy calls
warn4xx from upstream, token refresh attempts
error5xx from upstream, unhandled exceptions

Sensitive data (tokens, cookies, API keys) is never logged.

2. Metrics

GET /api/health for Kubernetes probes. OpenTelemetry instrumentation emits:

MetricTypeLabels
portal_request_totalCountermethod, path, status
portal_request_duration_msHistogrammethod, path
portal_upstream_error_totalCounterupstream, status
portal_auth_refresh_totalCounterresult

3. Error Tracking

Sentry for server-side and client-side errors. Sensitive header/cookie values scrubbed in beforeSend hook.

4. Alerting

AlertConditionSeverity
PortalHighErrorRateUpstream 5xx > 5/min for 3 minwarning
PortalAuthFailureSpikeAuth refresh failures > 20/mincritical
PortalPodNotReadyReadiness probe failing > 2 mincritical