Skip to Content
Potik Docs
Runbooks

Browser metrics and web probes

Browser metrics are off by default. The React application samples once per document when the configured rate is positive. A sampled page observes Largest Contentful Paint (LCP), Interaction to Next Paint (INP), Cumulative Layout Shift (CLS), uncaught JavaScript errors and unhandled promise rejections. Browser support and user interactions determine which Web Vitals are available.

Configuration

Web server variableMeaning
WEB_TELEMETRY_SAMPLE_RATEProbability from 0 to 1. The default is 0. Start with a small sample such as 0.05 and measure the effect.
WEB_TELEMETRY_OTLP_ENDPOINTFull, trusted collector URL ending in /v1/metrics. Use HTTPS. HTTP is supported on loopback for development.
APP_ORIGINExisting canonical public origin in OIDC mode.
WEB_TELEMETRY_ORIGINCanonical public web origin in demo mode when metrics are enabled. HTTP is supported on loopback.

Pass these variables into the web process. For a local check, start an OTLP/HTTP receiver on the same machine or container network namespace and set the sample rate to 1. Point the endpoint to http://127.0.0.1:4318/v1/metrics and use the exact browser origin, such as http://127.0.0.1:3000. Open the web app, interact with it and switch tabs. The exporter sends aggregates every 30 seconds. Set the sample rate to 0 and restart the web service to disable collection.

The browser sends numeric samples or one of two error classifications to the same-origin POST /telemetry/browser endpoint. Requests omit browser credentials and referrers. The receiver validates the exact configured origin, accepts only known JSON fields, caps payloads at 256 bytes and accepts up to 100 samples per second per web replica. Each sampled document sends at most 20 reports. Browsers can drop reports on exit. Treat these metrics as approximate population measurements.

Collector output

MetricTypeUnit or dimensions
browser.lcpHistogramMilliseconds
browser.inpHistogramMilliseconds
browser.clsHistogramUnitless layout shift score
browser.errorsCounterkind is error or unhandledrejection

The OTLP resource identifies the service as potik-web. Events contain no URLs, identifiers, messages, stack traces, request headers or timestamps supplied by the browser. The server maintains bounded aggregate series. It performs at most one export at a time with a two-second transport timeout. Serving the application and accepting a sample never wait for a collector response.

Health and readiness

GET /healthz reports that the web process is serving HTTP. GET /readyz checks the API's /readyz at the configured GRAPHQL_URL origin. The web probe returns 503 when the API fails readiness, times out after two seconds or the web process is draining. These probes send no user credentials.

Run npm run test:auth in apps/web for the loopback collector, browser privacy and readiness tests. Set TEST_DATABASE_URL to the disposable PostgreSQL test database to include the existing OIDC session integration tests.

On this page