diff options
| author | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-11-30 14:04:41 +0900 |
|---|---|---|
| committer | syuilo <4439005+syuilo@users.noreply.github.com> | 2025-11-30 14:04:41 +0900 |
| commit | d55f51a69b385ccdecb6272653c9d4f09ff8fc31 (patch) | |
| tree | 65553a6dd4b018856a02d398a013a7fbf30cc0ea /packages/backend/src/boot | |
| parent | refactor: localesをworkspace管理下のパッケージに (#16895) (diff) | |
| download | misskey-d55f51a69b385ccdecb6272653c9d4f09ff8fc31.tar.gz misskey-d55f51a69b385ccdecb6272653c9d4f09ff8fc31.tar.bz2 misskey-d55f51a69b385ccdecb6272653c9d4f09ff8fc31.zip | |
perf(backend): lazy load sentry
Diffstat (limited to 'packages/backend/src/boot')
| -rw-r--r-- | packages/backend/src/boot/master.ts | 5 | ||||
| -rw-r--r-- | packages/backend/src/boot/worker.ts | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts index 5ec362fb34..4776d0d412 100644 --- a/packages/backend/src/boot/master.ts +++ b/packages/backend/src/boot/master.ts @@ -10,8 +10,6 @@ import * as os from 'node:os'; import cluster from 'node:cluster'; import chalk from 'chalk'; import chalkTemplate from 'chalk-template'; -import * as Sentry from '@sentry/node'; -import { nodeProfilingIntegration } from '@sentry/profiling-node'; import Logger from '@/logger.js'; import { loadConfig } from '@/config.js'; import type { Config } from '@/config.js'; @@ -74,6 +72,9 @@ export async function masterMain() { bootLogger.succ('Misskey initialized'); if (config.sentryForBackend) { + const Sentry = await import('@sentry/node'); + const { nodeProfilingIntegration } = await import('@sentry/profiling-node'); + Sentry.init({ integrations: [ ...(config.sentryForBackend.enableNodeProfiling ? [nodeProfilingIntegration()] : []), diff --git a/packages/backend/src/boot/worker.ts b/packages/backend/src/boot/worker.ts index 5d4a15b29f..3feb6fd199 100644 --- a/packages/backend/src/boot/worker.ts +++ b/packages/backend/src/boot/worker.ts @@ -4,8 +4,6 @@ */ import cluster from 'node:cluster'; -import * as Sentry from '@sentry/node'; -import { nodeProfilingIntegration } from '@sentry/profiling-node'; import { envOption } from '@/env.js'; import { loadConfig } from '@/config.js'; import { jobQueue, server } from './common.js'; @@ -17,6 +15,9 @@ export async function workerMain() { const config = loadConfig(); if (config.sentryForBackend) { + const Sentry = await import('@sentry/node'); + const { nodeProfilingIntegration } = await import('@sentry/profiling-node'); + Sentry.init({ integrations: [ ...(config.sentryForBackend.enableNodeProfiling ? [nodeProfilingIntegration()] : []), |