diff --git a/src/index.ts b/src/index.ts index a0819d7..7402f12 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,18 @@ #!/usr/bin/env node import * as Sentry from '@sentry/node'; +import {nodeProfilingIntegration} from '@sentry/profiling-node'; + +Sentry.init({ + dsn: process.env.SENTRY_DSN, + integrations: [nodeProfilingIntegration()], + profilesSampleRate: 1, + tracesSampleRate: 1, + _experiments: { + metricsAggregator: true, + }, +}); + import dotenv from 'dotenv'; import yargs from 'yargs'; @@ -11,7 +23,6 @@ import {renderStream} from './renderStream'; import {PollingConfig} from './types'; dotenv.config(); -Sentry.init({dsn: process.env.SENTRY_DSN}); const defaultPollingConfig: PollingConfig = { /** diff --git a/src/renderServer.ts b/src/renderServer.ts index a0424f4..3842aab 100644 --- a/src/renderServer.ts +++ b/src/renderServer.ts @@ -2,7 +2,6 @@ import {performance} from 'node:perf_hooks'; import * as Sentry from '@sentry/node'; -import {nodeProfilingIntegration} from '@sentry/profiling-node'; import express from 'express'; import {ConfigService} from './config'; @@ -17,16 +16,6 @@ export function renderServer(config: ConfigService) { const app = express(); const renderRoutes = express.Router(); - Sentry.init({ - dsn: process.env.SENTRY_DSN, - integrations: [nodeProfilingIntegration()], - profilesSampleRate: 1, - tracesSampleRate: 1, - _experiments: { - metricsAggregator: true, - }, - }); - renderRoutes.use(express.json({limit: '20mb'})); renderRoutes.use((req, resp) => { if (!config.isLoaded) {