Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
"build:no-sentry": "vite build --mode no-sentry",
"build:init-only": "vite build --mode init-only",
"build:errors-only": "vite build --mode errors-only",
"build:minimal-integrations": "vite build --mode minimal-integrations",
"build:no-integrations": "vite build --mode no-integrations",
"build:no-browser-api-errors": "vite build --mode no-browser-api-errors",
"build:no-breadcrumbs": "vite build --mode no-breadcrumbs",
"build:tracing": "vite build --mode tracing",
"build:tracing-lazy-import": "vite build --mode tracing-lazy-import",
"build:tracing-replay": "vite build --mode tracing-replay",
"preview": "vite preview",
"clean": "npx rimraf node_modules pnpm-lock.yaml dist",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function App() {
</header>

<section className="hero">
<img src="/logo.svg" alt="Lighthouse logo" width={120} height={120} />
<img src="/logo.svg" alt="Lighthouse logo" width={120} height={120} elementtiming="logo-svg" />
<h1>Lighthouse Fixture</h1>
<p>
This app exists to measure JavaScript bundle size and runtime cost across three Sentry instrumentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { createRoot } from 'react-dom/client';
import App from './App';

const sentryInitStart = performance.now();

performance.measure('sentry-sdk-pre-init-duration', {
detail: { mode: import.meta.env.MODE ?? 'unknown_mode' },
start: performance.timeOrigin,
end: sentryInitStart,
});
Comment thread
cursor[bot] marked this conversation as resolved.
Comment thread
sentry[bot] marked this conversation as resolved.

performance.mark('sentry-sdk-init-start', {
detail: { mode: import.meta.env.MODE ?? 'unknown_mode' },
});
Expand All @@ -26,13 +33,43 @@ if (import.meta.env.MODE === 'tracing-replay') {
integrations: [Sentry.browserTracingIntegration()],
tracesSampleRate: 1.0,
});
} else if (import.meta.env.MODE === 'tracing-lazy-import') {
// Tracing + errors, but browsertracing loaded lazily.
// (We don't recommend this setup anywhere and neither will it work well.
// this is purely for testing if it changes anything about overhead.)
Sentry.init({
dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined,
release: 'lighthouse-fixture',
environment: 'qa',
tracesSampleRate: 1.0,
});

import('@sentry/react').then(lazySentry => {
Sentry.addIntegration(lazySentry.browserTracingIntegration());
});
} else if (import.meta.env.MODE === 'errors-only') {
// Default integrations only — errors are always captured, no tracing or replay.
Sentry.init({
dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined,
release: 'lighthouse-fixture',
environment: 'qa',
});
} else if (import.meta.env.MODE === 'minimal-integrations') {
// Minimal integratoins setup only (everything necessary to automatically get errors)
Sentry.init({
dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined,
release: 'lighthouse-fixture',
environment: 'qa',
defaultIntegrations: false,
integrations: [
Sentry.globalHandlersIntegration(),
Sentry.linkedErrorsIntegration(),
Sentry.dedupeIntegration(),
// for good measure, let's include event filters since noise reduction is usually desired
// 99% of this integration's work is done in an event processor, so outside the hot path
Sentry.eventFiltersIntegration(),
],
});
} else if (import.meta.env.MODE === 'no-integrations') {
// DSN set but every integration disabled. Isolates the cost of the enabled
// client itself from the default instrumentation that wraps DOM/timer/network APIs.
Expand All @@ -54,6 +91,15 @@ if (import.meta.env.MODE === 'tracing-replay') {
integrations: defaultIntegrations =>
defaultIntegrations.filter(integration => integration.name !== 'BrowserApiErrors'),
});
} else if (import.meta.env.MODE === 'no-browser-breadcrumbs') {
Comment thread
cursor[bot] marked this conversation as resolved.
Outdated
// Default integrations minus Breadcrumbs, which adds a lot of monkey patching to
// DOM and Network APIs as well as event targets and listeners
Sentry.init({
dsn: import.meta.env.VITE_E2E_TEST_DSN as string | undefined,
release: 'lighthouse-fixture',
environment: 'qa',
integrations: defaultIntegrations => defaultIntegrations.filter(integration => integration.name !== 'Breadcrumbs'),
});
} else if (import.meta.env.MODE === 'init-only') {
// enabled: false makes the SDK a guaranteed no-op (no transport allocation,
// no DSN warning). We're measuring pure SDK-loading + tree-shaking cost.
Expand Down
15 changes: 9 additions & 6 deletions scripts/lighthouse-bundle-and-upload.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
* Bundle the `lighthouse-react` test app for each mode (no-sentry, init-only,
* errors-only, no-integrations, no-browser-api-errors, tracing, tracing-replay)
* and POST the tarballs to the Sentry Lighthouse lab
* (https://lighthouse.sentry.gg). The lab runs Lighthouse asynchronously and
* ships results to Sentry on its own schedule — this script exits as soon as
* the upload succeeds.
* errors-only, minimal-integrations, no-integrations, no-browser-api-errors,
* no-breadcrumbs, tracing, tracing-lazy-import, tracing-replay) and POST the
* tarballs to the Sentry Lighthouse lab (https://lighthouse.sentry.gg). The lab
* runs Lighthouse asynchronously and ships results to Sentry on its own
* schedule — this script exits as soon as the upload succeeds.
*
* Single-app static matrix: 1 app × 7 modes = 7 cells.
* Single-app static matrix: 1 app × 10 modes = 10 cells.
*
* Zero runtime dependencies — uses Node 22 builtins (fetch, FormData, Blob) and
* the system `tar`. Every external command is invoked via `execFileSync` with
Expand Down Expand Up @@ -38,9 +38,12 @@ const MODES = [
'no-sentry',
'init-only',
'errors-only',
'minimal-integrations',
'no-integrations',
'no-browser-api-errors',
'no-breadcrumbs',
'tracing',
'tracing-lazy-import',
'tracing-replay',
];
const STATIC_DIR = 'dist';
Expand Down
Loading