summaryrefslogtreecommitdiff
path: root/packages/backend/src/boot
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2024-05-28 17:06:33 +0900
committerGitHub <noreply@github.com>2024-05-28 17:06:33 +0900
commit80f3cb96b02eaaeb513670224d33b8842414963e (patch)
treead54a85773701b2d60b73bd09ae7bf471451c1ff /packages/backend/src/boot
parentfix(federation): InboxにきたCreate, AnnounceのobjectがBearcaps urlだっ... (diff)
downloadsharkey-80f3cb96b02eaaeb513670224d33b8842414963e.tar.gz
sharkey-80f3cb96b02eaaeb513670224d33b8842414963e.tar.bz2
sharkey-80f3cb96b02eaaeb513670224d33b8842414963e.zip
feat: sentry integration (#13897)
* wip * wip * wip * wip * Update CHANGELOG.md * Update ApiCallService.ts * Update config.ts
Diffstat (limited to 'packages/backend/src/boot')
-rw-r--r--packages/backend/src/boot/master.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/backend/src/boot/master.ts b/packages/backend/src/boot/master.ts
index 30f9477ccf..75e1a80cd1 100644
--- a/packages/backend/src/boot/master.ts
+++ b/packages/backend/src/boot/master.ts
@@ -10,6 +10,8 @@ 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';
@@ -71,6 +73,24 @@ export async function masterMain() {
bootLogger.succ('Misskey initialized');
+ if (config.sentryForBackend) {
+ Sentry.init({
+ integrations: [
+ ...(config.sentryForBackend.enableNodeProfiling ? [nodeProfilingIntegration()] : []),
+ ],
+
+ // Performance Monitoring
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+
+ // Set sampling rate for profiling - this is relative to tracesSampleRate
+ profilesSampleRate: 1.0,
+
+ maxBreadcrumbs: 0,
+
+ ...config.sentryForBackend.options,
+ });
+ }
+
if (envOption.disableClustering) {
if (envOption.onlyServer) {
await server();