Commit 9ce2cf9
obs: New Relic browser agent + VITE_COMMIT_ID + ErrorBoundary (track 8/8)
Adds @newrelic/browser-agent for SPA error reporting, AJAX failure tracking,
and SPA route navigation tracking. Stamps every event with the dashboard's
build SHA (VITE_COMMIT_ID) so frontend errors correlate to the same commit
identifier the api/worker/provisioner Go services emit via -ldflags.
- vite.config.ts: define VITE_COMMIT_ID from GIT_SHA env (defaults "dev"),
plus VITE_NEWRELIC_LICENSE_KEY + VITE_NEWRELIC_APP_ID at build time
- src/main.tsx: init BrowserAgent before React mount, fail-open when license
key absent (mirrors Go services on empty NEW_RELIC_LICENSE_KEY)
- src/components/ErrorBoundary.tsx: top-level boundary that catches render
errors, ships them via window.newrelic.noticeError with commit_id attr,
renders an inline fallback so users can reload
- src/components/ErrorBoundary.test.tsx: 5 unit tests (happy path, error
catch + fallback, NR noticeError with commit_id, no-crash when agent
absent, custom fallback override)
- .github/workflows/deploy-pages.yml: export GIT_SHA before npm run build
and expose VITE_NEWRELIC_* secrets
Tests: 209 passed | 3 skipped (was 204 | 3). Build smoke verified —
GIT_SHA=test123abc produces `commit_id:"test123abc"` in dist/assets/index-*.js.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 3cd4103 commit 9ce2cf9
7 files changed
Lines changed: 446 additions & 45 deletions
File tree
- .github/workflows
- src
- components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
27 | 33 | | |
28 | 34 | | |
29 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
30 | 40 | | |
31 | 41 | | |
32 | 42 | | |
| |||
0 commit comments