Skip to content

Commit

Permalink
Merge pull request #49 from zer0-os/feat/sentry
Browse files Browse the repository at this point in the history
* chore: install `@sentry/react`

* feat: initialise Sentry

* feat: remove error button

* chore: change sentry org

* chore: error button to test sentry

* chore: remove `tracePropogationTargets`

* feat: remove error button

* feat: log transaction errors
  • Loading branch information
colbr authored Dec 11, 2024
2 parents dd5325b + 6916939 commit b48f44d
Show file tree
Hide file tree
Showing 8 changed files with 823 additions and 38 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ yarn-error.log*
/test-results/
/playwright-report/
/playwright/.cache/

# Sentry Config File
.env.sentry-build-plugin
10 changes: 7 additions & 3 deletions dev-environment/src/components/DevApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@ import { useAccount, useConnect } from 'wagmi';
import { useEthersProvider } from '../lib/useEthersProvider';
import { injectedConnector } from '../lib/connectors';

import * as Sentry from '@sentry/react';

import { DevControls } from './DevControls';

const SentryRoute = Sentry.withSentryRouting(Route);

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const RPC_URL = import.meta.env.VITE_RPC_URL_1;
Expand All @@ -32,7 +36,7 @@ export const DevApp = () => {
<>
<DevControls />
<Switch>
<Route
<SentryRoute
path="/:znsRoute/:app"
component={() => (
<StakingZApp
Expand All @@ -48,9 +52,9 @@ export const DevApp = () => {
/>
)}
/>
<Route>
<SentryRoute>
<Redirect to={'/0.wilder/staking/pools'} />
</Route>
</SentryRoute>
</Switch>
</>
);
Expand Down
15 changes: 15 additions & 0 deletions dev-environment/src/lib/instrument.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import * as Sentry from '@sentry/react';

// @ts-ignore
const { VITE_SENTRY_DSN } = import.meta.env;

Sentry.init({
dsn: VITE_SENTRY_DSN,
integrations: [
Sentry.reactRouterV5BrowserTracingIntegration({ history }),
Sentry.replayIntegration(),
],
tracesSampleRate: 1.0,
replaysSessionSampleRate: 0.1,
replaysOnErrorSampleRate: 1.0,
});
1 change: 1 addition & 0 deletions dev-environment/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './lib/instrument';
import './vite-setup';

import React from 'react';
Expand Down
14 changes: 13 additions & 1 deletion dev-environment/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
import { sentryVitePlugin } from '@sentry/vite-plugin';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import tsconfigPaths from 'vite-tsconfig-paths';
import { nodePolyfills } from 'vite-plugin-node-polyfills';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react(), tsconfigPaths(), nodePolyfills()],
plugins: [
react(),
tsconfigPaths(),
nodePolyfills(),
sentryVitePlugin({
org: 'factory-5k',
project: 'zapp-staking',
}),
],
root: 'dev-environment',
resolve: {
alias: {
Expand All @@ -16,4 +25,7 @@ export default defineConfig({
define: {
VITE_STAKING_SUPABASE_URL: process.env.VITE_STAKING_SUPABASE_URL,
},
build: {
sourcemap: true,
},
});
Loading

0 comments on commit b48f44d

Please sign in to comment.