diff --git a/src/apm.ts b/src/apm.ts new file mode 100644 index 0000000..8c20720 --- /dev/null +++ b/src/apm.ts @@ -0,0 +1,5 @@ +export const startAPm = async () => { + if (process.env.ENV !== 'local') + return await import('elastic-apm-node/start'); +}; +startAPm(); diff --git a/src/main.ts b/src/main.ts index c0505ac..33c5e54 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,6 @@ +import './apm'; import { NestFactory } from '@nestjs/core'; import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'; -import { writeFileSync } from 'fs'; import helmet from 'helmet'; import { DadosferaLogger } from 'dadosfera-logs'; @@ -9,8 +9,6 @@ import documentEmpty from '../swagger_empty.json'; import { AppModule } from './app.module'; async function bootstrap() { - if (process.env.ENV !== 'local') await import('elastic-apm-node/start'); - DadosferaLogger.setupLogger({ serviceName: 'maestro', serviceEnvironment: process.env.ENV,