feat: better context + try catch
This commit is contained in:
parent
24e64fd97d
commit
41c3bbf0bf
|
|
@ -11,7 +11,7 @@ import { HttpExceptionFilter } from '@gitroom/nestjs-libraries/services/exceptio
|
|||
import { ConfigurationChecker } from '@gitroom/helpers/configuration/configuration.checker';
|
||||
import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
|
||||
|
||||
initializeSentry();
|
||||
initializeSentry('backend');
|
||||
|
||||
async function bootstrap() {
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { NestFactory } from '@nestjs/core';
|
|||
import { CronModule } from './cron.module';
|
||||
import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
|
||||
|
||||
initializeSentry();
|
||||
initializeSentry('cron');
|
||||
|
||||
async function bootstrap() {
|
||||
// some comment again
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import { MicroserviceOptions } from '@nestjs/microservices';
|
|||
import { BullMqServer } from '@gitroom/nestjs-libraries/bull-mq-transport-new/strategy';
|
||||
import { initializeSentry } from '@gitroom/nestjs-libraries/sentry/initialize.sentry';
|
||||
|
||||
initializeSentry();
|
||||
initializeSentry('workers');
|
||||
|
||||
async function bootstrap() {
|
||||
process.env.IS_WORKER = 'true';
|
||||
|
|
|
|||
|
|
@ -1,21 +1,33 @@
|
|||
import * as Sentry from '@sentry/nestjs';
|
||||
import { nodeProfilingIntegration } from "@sentry/profiling-node";
|
||||
import { nodeProfilingIntegration } from '@sentry/profiling-node';
|
||||
import { capitalize } from 'lodash';
|
||||
|
||||
export const initializeSentry = () => {
|
||||
export const initializeSentry = (appName: string) => {
|
||||
if (!process.env.NEXT_PUBLIC_SENTRY_DSN) {
|
||||
return null;
|
||||
}
|
||||
|
||||
console.log('loading sentry');
|
||||
Sentry.init({
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
integrations: [
|
||||
// Add our Profiling integration
|
||||
nodeProfilingIntegration(),
|
||||
],
|
||||
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
|
||||
profilesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
|
||||
});
|
||||
|
||||
try {
|
||||
Sentry.init({
|
||||
initialScope: {
|
||||
tags: {
|
||||
service: appName,
|
||||
component: 'nestjs',
|
||||
},
|
||||
contexts: {
|
||||
app: {
|
||||
name: `Postiz ${capitalize(appName)}`,
|
||||
},
|
||||
},
|
||||
},
|
||||
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
|
||||
integrations: [
|
||||
// Add our Profiling integration
|
||||
nodeProfilingIntegration(),
|
||||
],
|
||||
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
|
||||
profilesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
|
||||
});
|
||||
} catch (err) {}
|
||||
return true;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue