Skip to content

Commit

Permalink
Revert "POC Sentry (#206)" (#212)
Browse files Browse the repository at this point in the history
This reverts commit 99df07e.
  • Loading branch information
github-zoe-cade authored Oct 18, 2023
1 parent 99df07e commit 1ec6cab
Show file tree
Hide file tree
Showing 17 changed files with 40 additions and 277 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ jobs:
- run: pnpm run -r lint
- run: pnpm run -r type-check
- run: pnpm run test:all
- run: pnpm run -r build-no-sourcemaps
- run: pnpm run -r build
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,4 @@ Thumbs.db

# Firebase
firebase-debug.log
ui-debug.log
# Sentry Config File
.sentryclirc
ui-debug.log
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
"@remix-run/node": "^1.19.3",
"@remix-run/react": "^1.19.3",
"@remix-run/serve": "^1.19.3",
"@sentry/remix": "^7.74.0",
"@tanstack/react-table": "^8.10.6",
"@tanstack/react-virtual": "3.0.0-beta.61",
"clsx": "^1.2.1",
Expand Down
7 changes: 1 addition & 6 deletions packages/app-builder/.env.local
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ SESSION_SECRET=SESSION_SECRET
SESSION_MAX_AGE=43200

MARBLE_API_DOMAIN=http://127.0.0.1:8080
MARBLE_APP_DOMAIN=http://127.0.0.1:3000

FIREBASE_AUTH_EMULATOR=true
FIREBASE_AUTH_EMULATOR_HOST=http://localhost:9099
Expand All @@ -15,8 +14,4 @@ FIREBASE_AUTH_DOMAIN=tokyo-country-381508.firebaseapp.com
FIREBASE_PROJECT_ID=tokyo-country-381508
FIREBASE_STORAGE_BUCKET=tokyo-country-381508.appspot.com
FIREBASE_MESSAGING_SENDER_ID=1047691849054
FIREBASE_APP_ID=1:1047691849054:web:a5b69dd2ac584c1160b3cf

SENTRY_AUTH_TOKEN=dummy
SENTRY_DSN=dummy
SENTRY_ENVIRONMENT=development
FIREBASE_APP_ID=1:1047691849054:web:a5b69dd2ac584c1160b3cf
3 changes: 1 addition & 2 deletions packages/app-builder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
"lint": "eslint .",
"type-check": "npx tsc --noEmit",
"dev": "dotenv -e .env.local -- remix dev",
"build-no-sourcemaps": "remix build",
"build": "remix build --sourcemap && sentry-upload-sourcemaps --org checkmarble --project marble-frontend",
"build": "remix build",
"start": "remix start",
"generate-routes": "source scripts/generateRoutes.sh"
},
Expand Down
38 changes: 2 additions & 36 deletions packages/app-builder/src/entry.client.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { RemixBrowser, useLocation, useMatches } from '@remix-run/react';
import * as Sentry from '@sentry/remix';
import { startTransition, StrictMode, useEffect } from 'react';
import { RemixBrowser } from '@remix-run/react';
import { startTransition, StrictMode } from 'react';
import { hydrateRoot } from 'react-dom/client';
import { I18nextProvider } from 'react-i18next';

import { clientServices } from './services/init.client';
import { getClientEnv } from './utils/environment.client';

async function hydrate() {
const { i18nextClientService } = clientServices;
Expand All @@ -32,35 +30,3 @@ if (window.requestIdleCallback) {
// eslint-disable-next-line @typescript-eslint/no-misused-promises
window.setTimeout(hydrate, 1);
}

Sentry.init({
dsn: getClientEnv('SENTRY_DSN'),
environment: getClientEnv('SENTRY_ENVIRONMENT'),
integrations: [
new Sentry.BrowserTracing({
routingInstrumentation: Sentry.remixRouterInstrumentation(
useEffect,
useLocation,
useMatches
),
}),
// Replay is only available in the client
new Sentry.Replay(),
],

// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,

// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
tracePropagationTargets: [
getClientEnv('MARBLE_APP_DOMAIN'),
getClientEnv('MARBLE_API_DOMAIN'),
],

// Capture Replay for 10% of all sessions,
// plus for 100% of sessions with an error
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
29 changes: 1 addition & 28 deletions packages/app-builder/src/entry.server.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
import {
type DataFunctionArgs,
type EntryContext,
Response,
} from '@remix-run/node';
import { type EntryContext, Response } from '@remix-run/node';
import { RemixServer } from '@remix-run/react';
import * as Sentry from '@sentry/remix';
import isbot from 'isbot';
import { renderToPipeableStream } from 'react-dom/server';
import { I18nextProvider } from 'react-i18next';
import { PassThrough } from 'stream';

import { serverServices } from './services/init.server';
import { getServerEnv } from './utils/environment.server';

const ABORT_DELAY = 5000;

Expand Down Expand Up @@ -111,24 +105,3 @@ function handleBrowserRequest(
setTimeout(abort, ABORT_DELAY);
});
}

Sentry.init({
dsn: getServerEnv('SENTRY_DSN'),
environment: getServerEnv('SENTRY_ENVIRONMENT'),
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});

export async function handleError(
error: unknown,
{ request }: DataFunctionArgs
) {
if (error instanceof Error) {
await Sentry.captureRemixServerException(error, 'remix.server', request);
} else {
// Optionally capture non-Error objects
Sentry.captureException(error);
}
}
6 changes: 1 addition & 5 deletions packages/app-builder/src/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
useLoaderData,
useRouteError,
} from '@remix-run/react';
import { captureRemixErrorBoundaryError, withSentry } from '@sentry/remix';
import { Tooltip } from '@ui-design-system';
import { LogoStandard } from '@ui-icons';
import { type Namespace } from 'i18next';
Expand Down Expand Up @@ -102,7 +101,6 @@ export const meta: V2_MetaFunction = () => [

export function ErrorBoundary() {
const error = useRouteError();
captureRemixErrorBoundaryError(error);

return (
<html lang="en">
Expand Down Expand Up @@ -137,7 +135,7 @@ export function ErrorBoundary() {
);
}

function App() {
export default function App() {
const { locale, ENV, toastMessage, csrf } = useLoaderData<typeof loader>();

const { i18n } = useTranslation(handle.i18n);
Expand Down Expand Up @@ -171,5 +169,3 @@ function App() {
</html>
);
}

export default withSentry(App);
6 changes: 1 addition & 5 deletions packages/app-builder/src/routes/__builder/decisions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
import { DecisionsPage } from '@app-builder/components/Decisions';
import { getRoute } from '@app-builder/utils/routes';
import { Outlet, useRouteError } from '@remix-run/react';
import { captureRemixErrorBoundaryError } from '@sentry/remix';
import { Decision } from '@ui-icons';
import { type Namespace } from 'i18next';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -53,8 +52,5 @@ export default function DecisionsLayout() {
}

export function ErrorBoundary() {
const error = useRouteError();
captureRemixErrorBoundaryError(error);

return <ErrorComponent error={error} />;
return <ErrorComponent error={useRouteError()} />;
}
6 changes: 2 additions & 4 deletions packages/app-builder/src/routes/__builder/lists/$listId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { serverServices } from '@app-builder/services/init.server';
import { fromParams } from '@app-builder/utils/short-uuid';
import { json, type LoaderArgs } from '@remix-run/node';
import { Link, useLoaderData, useRouteError } from '@remix-run/react';
import { captureRemixErrorBoundaryError } from '@sentry/remix';
import {
type ColumnDef,
getCoreRowModel,
Expand Down Expand Up @@ -152,10 +151,9 @@ export default function Lists() {
</Page.Container>
);
}

export function ErrorBoundary() {
const error = useRouteError();
captureRemixErrorBoundaryError(error);
return <ErrorComponent error={error} />;
return <ErrorComponent error={useRouteError()} />;
}

// Correspond to this part of the UI : https://www.figma.com/file/JW6QvnhBtdZDcKvLdg9s5T/Marble-Portal?node-id=6377%3A53150&mode=dev
Expand Down
6 changes: 2 additions & 4 deletions packages/app-builder/src/routes/__builder/lists/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { getRoute } from '@app-builder/utils/routes';
import { fromUUID } from '@app-builder/utils/short-uuid';
import { json, type LoaderArgs } from '@remix-run/node';
import { useLoaderData, useNavigate, useRouteError } from '@remix-run/react';
import { captureRemixErrorBoundaryError } from '@sentry/remix';
import {
type ColumnDef,
getCoreRowModel,
Expand Down Expand Up @@ -115,8 +114,7 @@ export default function ListsPage() {
</Page.Container>
);
}

export function ErrorBoundary() {
const error = useRouteError();
captureRemixErrorBoundaryError(error);
return <ErrorComponent error={error} />;
return <ErrorComponent error={useRouteError()} />;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { serverServices } from '@app-builder/services/init.server';
import { fromParams } from '@app-builder/utils/short-uuid';
import { json, type LoaderArgs, type SerializeFrom } from '@remix-run/node';
import { Outlet, useRouteError, useRouteLoaderData } from '@remix-run/react';
import { captureRemixErrorBoundaryError } from '@sentry/remix';
import { type Namespace } from 'i18next';

export const handle = {
Expand Down Expand Up @@ -31,8 +30,7 @@ export const useCurrentScenario = () =>
export default function CurrentScenarioProvider() {
return <Outlet />;
}

export function ErrorBoundary() {
const error = useRouteError();
captureRemixErrorBoundaryError(error);
return <ErrorComponent error={error} />;
return <ErrorComponent error={useRouteError()} />;
}
28 changes: 0 additions & 28 deletions packages/app-builder/src/routes/sentry.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions packages/app-builder/src/utils/environment.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ export type ClientEnvVars = {
AUTH_EMULATOR_HOST?: string;
FIREBASE_OPTIONS: FirebaseOptions;
MARBLE_API_DOMAIN: string;
MARBLE_APP_DOMAIN: string;
SENTRY_DSN: string;
SENTRY_ENVIRONMENT: string;
};

export function getClientEnv<K extends keyof ClientEnvVars>(
Expand Down
10 changes: 1 addition & 9 deletions packages/app-builder/src/utils/environment.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,13 @@ type ServerPublicEnvVarName =
| 'FIREBASE_PROJECT_ID'
| 'FIREBASE_STORAGE_BUCKET'
| 'MARBLE_API_DOMAIN'
| 'MARBLE_APP_DOMAIN'
| 'NODE_ENV'
| 'SENTRY_ENVIRONMENT'
| 'SESSION_MAX_AGE';

/**
* List of all secret env vars to defined on each deployed environments
*/
type ServerSecretEnvVarName =
| 'SENTRY_AUTH_TOKEN'
| 'SENTRY_DSN'
| 'SESSION_SECRET';
type ServerSecretEnvVarName = 'SESSION_SECRET';

type ServerEnvVarName =
| DevServerEnvVarName
Expand Down Expand Up @@ -89,8 +84,5 @@ export function getClientEnvVars(): ClientEnvVars {
appId: getServerEnv('FIREBASE_APP_ID'),
},
MARBLE_API_DOMAIN: getServerEnv('MARBLE_API_DOMAIN'),
MARBLE_APP_DOMAIN: getServerEnv('MARBLE_APP_DOMAIN'),
SENTRY_DSN: getServerEnv('SENTRY_DSN'),
SENTRY_ENVIRONMENT: getServerEnv('SENTRY_ENVIRONMENT'),
};
}
5 changes: 0 additions & 5 deletions packages/app-builder/src/utils/routes/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ export const routes = [
}
]
},
{
"id": "routes/sentry",
"path": "sentry",
"file": "routes/sentry.tsx"
},
{
"id": "routes/index",
"index": true,
Expand Down
Loading

0 comments on commit 1ec6cab

Please sign in to comment.