Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
9f1bf349
Commit
9f1bf349
authored
Sep 30, 2022
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sentry tags for app instance
parent
582f030e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
8 deletions
+18
-8
.env.template
.env.template
+1
-0
react.ts
configs/sentry/react.ts
+4
-2
useConfigSentry.tsx
lib/hooks/useConfigSentry.tsx
+11
-0
_app.tsx
pages/_app.tsx
+2
-6
No files found.
.env.template
View file @
9f1bf349
...
...
@@ -5,3 +5,4 @@ NEXT_PUBLIC_FOOTER_TWITTER_LINK=APP_NEXT_NEXT_PUBLIC_FOOTER_TWITTER_LINK
NEXT_PUBLIC_FOOTER_TELEGRAM_LINK=APP_NEXT_NEXT_PUBLIC_FOOTER_TELEGRAM_LINK
NEXT_PUBLIC_FOOTER_STAKING_LINK=APP_NEXT_NEXT_PUBLIC_FOOTER_STAKING_LINK
NEXT_PUBLIC_SENTRY_DSN=APP_NEXT_NEXT_PUBLIC_SENTRY_DSN
NEXT_PUBLIC_APP_INSTANCE=APP_NEXT_NEXT_PUBLIC_APP_INSTANCE
configs/sentry/react.ts
View file @
9f1bf349
import
type
*
as
Sentry
from
'
@sentry/react
'
;
import
{
BrowserTracing
}
from
'
@sentry/tracing
'
;
const
config
:
Sentry
.
BrowserOptions
=
{
export
const
config
:
Sentry
.
BrowserOptions
=
{
environment
:
process
.
env
.
VERCEL_ENV
||
process
.
env
.
NODE_ENV
,
dsn
:
process
.
env
.
NEXT_PUBLIC_SENTRY_DSN
,
integrations
:
[
new
BrowserTracing
()
],
...
...
@@ -10,4 +10,6 @@ const config: Sentry.BrowserOptions = {
tracesSampleRate
:
1.0
,
};
export
default
config
;
export
function
configureScope
(
scope
:
Sentry
.
Scope
)
{
scope
.
setTag
(
'
app_instance
'
,
process
.
env
.
NEXT_PUBLIC_APP_INSTANCE
);
}
lib/hooks/useConfigSentry.tsx
0 → 100644
View file @
9f1bf349
import
*
as
Sentry
from
'
@sentry/react
'
;
import
{
config
,
configureScope
}
from
'
configs/sentry/react
'
;
import
React
from
'
react
'
;
export
default
function
useConfigSentry
()
{
React
.
useEffect
(()
=>
{
// gotta init sentry in browser
Sentry
.
init
(
config
);
Sentry
.
configureScope
(
configureScope
);
},
[]);
}
pages/_app.tsx
View file @
9f1bf349
import
{
ChakraProvider
}
from
'
@chakra-ui/react
'
;
import
*
as
Sentry
from
'
@sentry/react
'
;
import
{
QueryClient
,
QueryClientProvider
}
from
'
@tanstack/react-query
'
;
import
{
ReactQueryDevtools
}
from
'
@tanstack/react-query-devtools
'
;
import
sentryConfig
from
'
configs/sentry/react
'
;
import
type
{
AppProps
}
from
'
next/app
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
useConfigSentry
from
'
lib/hooks/useConfigSentry
'
;
import
type
{
ErrorType
}
from
'
lib/hooks/useFetch
'
;
import
theme
from
'
theme
'
;
function
MyApp
({
Component
,
pageProps
}:
AppProps
)
{
React
.
useEffect
(()
=>
{
// gotta init sentry in browser
Sentry
.
init
(
sentryConfig
);
},
[]);
useConfigSentry
();
const
[
queryClient
]
=
useState
(()
=>
new
QueryClient
({
defaultOptions
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment