From 821121d72b981b1af2b2cc9c10f77b1834579adf Mon Sep 17 00:00:00 2001 From: gmbronco <83549293+gmbronco@users.noreply.github.com> Date: Mon, 11 Dec 2023 15:22:41 +0100 Subject: [PATCH] add sentry profiling to webApp --- app.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app.ts b/app.ts index 49b240ff8..6f3a2f4ec 100644 --- a/app.ts +++ b/app.ts @@ -16,6 +16,7 @@ import { resolvers } from './app/gql/resolvers'; import helmet from 'helmet'; import GraphQLJSON from 'graphql-type-json'; import * as Sentry from '@sentry/node'; +import { ProfilingIntegration } from '@sentry/profiling-node'; import { sentryPlugin } from './app/gql/sentry-apollo-plugin'; import { startWorker } from './worker/worker'; import { startScheduler } from './worker/scheduler'; @@ -33,9 +34,12 @@ async function startServer() { // new Tracing.Integrations.Apollo(), // new Tracing.Integrations.GraphQL(), // new Tracing.Integrations.Prisma({ client: prisma }), - // new Tracing.Integrations.Express({ app }), - // new Sentry.Integrations.Http({ tracing: true }), + new Sentry.Integrations.Express({ app }), + new Sentry.Integrations.Http({ tracing: true }), + new ProfilingIntegration(), ], + tracesSampleRate: 0.2, + profilesSampleRate: 0.1, beforeSend(event, hint) { const error = hint.originalException as string; if (error?.toString().includes('Unknown token:')) { @@ -55,7 +59,7 @@ async function startServer() { }); app.use(Sentry.Handlers.requestHandler()); - // app.use(Sentry.Handlers.tracingHandler()); + app.use(Sentry.Handlers.tracingHandler()); // app.use(Sentry.Handlers.errorHandler()); app.use(helmet.dnsPrefetchControl());