📈(collaboration) add sentry
Add sentry to the collaboration server. It will be used to log errors and exceptions.
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@hocuspocus/server": "2.14.0",
|
||||
"@sentry/node": "8.41.0",
|
||||
"@sentry/profiling-node": "8.41.0",
|
||||
"express": "4.21.1",
|
||||
"express-ws": "5.0.2",
|
||||
"y-protocols": "1.0.6"
|
||||
|
||||
@@ -5,3 +5,4 @@ export const COLLABORATION_SERVER_ORIGIN =
|
||||
export const COLLABORATION_SERVER_SECRET =
|
||||
process.env.COLLABORATION_SERVER_SECRET || 'secret-api-key';
|
||||
export const PORT = Number(process.env.PORT || 4444);
|
||||
export const SENTRY_DSN = process.env.SENTRY_DSN || '';
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
// eslint-disable-next-line import/order
|
||||
import './services/sentry';
|
||||
import { Server } from '@hocuspocus/server';
|
||||
import * as Sentry from '@sentry/node';
|
||||
import express, { Request, Response } from 'express';
|
||||
import expressWebsockets from 'express-ws';
|
||||
|
||||
@@ -130,6 +133,8 @@ export const initServer = () => {
|
||||
},
|
||||
);
|
||||
|
||||
Sentry.setupExpressErrorHandler(app);
|
||||
|
||||
app.get('/ping', (req, res) => {
|
||||
res.status(200).json({ message: 'pong' });
|
||||
});
|
||||
|
||||
11
src/frontend/servers/y-provider/src/services/sentry.ts
Normal file
11
src/frontend/servers/y-provider/src/services/sentry.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { nodeProfilingIntegration } from '@sentry/profiling-node';
|
||||
|
||||
import { SENTRY_DSN } from '../env';
|
||||
|
||||
Sentry.init({
|
||||
dsn: SENTRY_DSN,
|
||||
integrations: [nodeProfilingIntegration()],
|
||||
tracesSampleRate: 1.0,
|
||||
profilesSampleRate: 1.0,
|
||||
});
|
||||
Reference in New Issue
Block a user