Fix dd-trace init timing in index.ts (FRE-4806)
Import datadog-init as first module to ensure dd-trace .init() runs before any other imports, fixing P1 auto-instrumentation issue. Removed redundant manual initDatadog/initSentry calls since datadog-init.ts already invokes all three init functions. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// dd-trace must be initialized before any other module is loaded for auto-instrumentation
|
||||
import '@shieldai/monitoring/datadog-init';
|
||||
import Fastify from 'fastify';
|
||||
import cors from '@fastify/cors';
|
||||
import helmet from '@fastify/helmet';
|
||||
@@ -8,7 +10,6 @@ import { errorHandlingMiddleware } from './middleware/error-handling.middleware'
|
||||
import { loggingMiddleware } from './middleware/logging.middleware';
|
||||
import { apiEnv, loggingConfig, getCorsOrigins } from './config/api.config';
|
||||
import { routes } from './routes';
|
||||
import { initDatadog, initSentry } from '@shieldai/monitoring';
|
||||
|
||||
const fastify = Fastify({
|
||||
logger: loggingConfig,
|
||||
@@ -16,10 +17,6 @@ const fastify = Fastify({
|
||||
maxParamLength: 500,
|
||||
});
|
||||
|
||||
// Initialize monitoring (must be first import for auto-instrumentation)
|
||||
initDatadog();
|
||||
initSentry();
|
||||
|
||||
// Register plugins
|
||||
async function registerPlugins() {
|
||||
// CORS configuration
|
||||
|
||||
Reference in New Issue
Block a user