Skip to content

Commit

Permalink
Add sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
lrdiv committed Jan 14, 2025
1 parent 85e855c commit 0ee2bb2
Show file tree
Hide file tree
Showing 8 changed files with 1,019 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ jobs:
# - run: npx nx-cloud record -- echo Hello World
# Nx Affected runs only tasks affected by the changes in this PR/commit. Learn more: https://nx.dev/ci/features/affected
- run: npx nx affected -t lint test build
- run: npm run sentry:sourcemaps
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ vitest.config.*.timestamp*
.env*
!.envrc
!.env.*sample

# Sentry Config File
.sentryclirc
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
FROM node:20
LABEL authors="Lawrence Davis"

ARG SENTRY_AUTH_TOKEN
ENV SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN

RUN npm install -g nx@latest

WORKDIR /usr/src/app
Expand Down
2 changes: 1 addition & 1 deletion apps/spin-cycle/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"executor": "nx:run-commands",
"options": {
"command": "webpack-cli build",
"args": ["node-env=production"]
"args": ["node-env=production", "devtool=sourcemap"]
},
"configurations": {
"development": {
Expand Down
4 changes: 4 additions & 0 deletions apps/spin-cycle/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { RedisClientType, createClient } from 'redis';

import { AppModule } from './app.module';

if (process.env.NODE_ENV === 'production') {
import('./sentry');
}

const corsOrigin: string[] =
process.env.NODE_ENV === 'production'
? ['https://spincycle.lrdiv.co', 'https://discogs.com']
Expand Down
9 changes: 9 additions & 0 deletions apps/spin-cycle/src/sentry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Sentry from '@sentry/node';
import { nodeProfilingIntegration } from '@sentry/profiling-node';

Sentry.init({
dsn: 'https://c0355c18b86a8fcba144b81b086635a2@o4508644576002048.ingest.us.sentry.io/4508644576329728',
integrations: [nodeProfilingIntegration()],
tracesSampleRate: 1.0, // Capture 100% of the transactions
profilesSampleRate: 1.0,
});
Loading

0 comments on commit 0ee2bb2

Please sign in to comment.