docs: @nais/apm framework quickstarts (Next.js, React+Vite)#878
Merged
Conversation
Full-migration guide (no compat shim) for frontend teams moving off @sentry/* onto @nais/apm: concept map, copy-pasteable recipe, an honest what's-different section (no event id, setUser PII drop, Grafana Issues tab, server-side sourcemaps, Grafana alerts, events-tier replay, not-yet-supported features), and a checklist. Nav-gated.
…+Vite Add copy-pasteable @nais/apm quickstart guides ordered by real navikt usage: - Next.js quickstart (the largest NAV frontend framework): App Router as the primary path (initNaisAPMClient in instrumentation-client.ts, ApmErrorBoundary, useApmRouteTracking, opt-in tracing) with a Pages Router variant section (_app.tsx + next/router events). - React + Vite quickstart (the #2 frontend): init at the entry point, ApmErrorBoundary, enableApmReactRouterV6 + <ApmRoutes> for React Router v6 (with a v7 note), opt-in tracing. Both are nav-gated (conditional: [tenant, nav]), cover the server-side sourcemap resolution note and the PII/opaque-id rule, and link into the Sentry migration guide. Wire the new pages into the frontend section landing and point the raw-Faro Next.js tip at the new quickstart.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Authors
@nais/apmfrontend framework quickstart guides, ordered by real navikt usage (nais/grafana-apm-app#112).What's here
initNaisAPMClientininstrumentation-client.ts,ApmErrorBoundaryin the root layout +global-error.tsx,useApmRouteTrackingwith a<Suspense>note, opt-in tracing). Pages Router is a variant section within the same page (_app.tsxinit +next/routerevents), covering navikt's golden-path template.init({ namespace }),ApmErrorBoundary,enableApmReactRouterV6(...)+<ApmRoutes>for React Router v6 (with a v7 caveat), opt-in tracing.Both pages are nav-gated (
conditional: [tenant, nav]), copy-pasteable, and cover the server-side sourcemap-resolution note and the PII/opaque-id (setUser) rule. They link into the Sentry migration guide, the sourcemap guide, trace propagation, and the APM Issues tab.App Router vs Pages Router
Kept as one Next.js page with the App Router as the main flow and a Pages Router section for the two differences (where you init, how you track routes) — rather than two parallel pages. The existing raw-Faro
setup-nextjs.mdstays as the tenant-agnostic lower-level guide (ssb keeps it); its "prefer @nais/apm" tip now points at the new quickstart.Section wiring
Updated the frontend section landing (
README.md) — the nav "Get started" list and a new nav-gated framework-quickstart table in "Guides".Dependency on #877
This branch is stacked on #877 (the Sentry migration guide) so the inbound links resolve and the build is green. Merge #877 first; the shared commit then drops out of this diff automatically.
Verification
mise run build nav ssbis green. Both quickstarts render for nav and are absent for ssb; the raw-Faro guides remain for ssb. No leftover{% %}/<< >>tokens (<<tenant_url>>resolves tohttps://grafana.nav.cloud.nais.io/a/nais-apm-app/services). Internal links to sourcemaps, trace propagation, the migration guide, and the APM tabs resolve.