-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(backend): ajout du déploiement et de la configuration sentry
- Loading branch information
Showing
7 changed files
with
939 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import * as Sentry from '@sentry/nestjs'; | ||
import { nodeProfilingIntegration } from '@sentry/profiling-node'; | ||
|
||
export const SENTRY_DSN = process.env.SENTRY_DSN || ''; | ||
|
||
// Ensure to call this before requiring any other modules! | ||
Sentry.init({ | ||
dsn: SENTRY_DSN, | ||
integrations: [ | ||
// Add our Profiling integration | ||
nodeProfilingIntegration(), | ||
], | ||
|
||
// Add Tracing by setting tracesSampleRate | ||
// We recommend adjusting this value in production | ||
tracesSampleRate: 1.0, | ||
|
||
// Set sampling rate for profiling | ||
// This is relative to tracesSampleRate | ||
profilesSampleRate: 1.0, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
import { NestFactory } from '@nestjs/core'; | ||
// WARNING: Do this import first | ||
import './common/configs/SentryInit'; | ||
import * as Sentry from '@sentry/nestjs'; | ||
import { | ||
BaseExceptionFilter, | ||
HttpAdapterHost, | ||
NestFactory, | ||
} from '@nestjs/core'; | ||
import { AppModule } from './app.module'; | ||
import { SENTRY_DSN } from './common/configs/SentryInit'; | ||
|
||
const port = process.env.PORT || 8080; | ||
console.log(`Launching NestJS app on port ${port}`); | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(AppModule); | ||
const { httpAdapter } = app.get(HttpAdapterHost); | ||
|
||
if (SENTRY_DSN) { | ||
console.log('Sentry enabled with DSN:', SENTRY_DSN); | ||
Sentry.setupNestErrorHandler(app, new BaseExceptionFilter(httpAdapter)); | ||
} | ||
|
||
await app.listen(port); | ||
} | ||
bootstrap(); |
Oops, something went wrong.