mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
33 lines
1002 B
TypeScript
33 lines
1002 B
TypeScript
import { Application } from 'express';
|
|
import * as Sentry from '@sentry/node';
|
|
import Logger from './logger';
|
|
import config from '../config';
|
|
import fs from 'fs';
|
|
import { parseVersion } from '../config/util';
|
|
|
|
export default async ({ expressApp }: { expressApp: Application }) => {
|
|
const { version } = await parseVersion(config.versionFile);
|
|
|
|
Sentry.init({
|
|
ignoreErrors: [
|
|
/SequelizeUniqueConstraintError/i,
|
|
/Validation error/i,
|
|
/UnauthorizedError/i,
|
|
/celebrate request validation failed/i,
|
|
],
|
|
dsn: 'https://8b5c84cfef3e22541bc84de0ed00497b@o1098464.ingest.sentry.io/6122819',
|
|
integrations: [
|
|
new Sentry.Integrations.Http({ tracing: true }),
|
|
new Sentry.Integrations.Express({ app: expressApp }),
|
|
],
|
|
tracesSampleRate: 0.8,
|
|
release: version,
|
|
});
|
|
|
|
expressApp.use(Sentry.Handlers.requestHandler());
|
|
expressApp.use(Sentry.Handlers.tracingHandler());
|
|
|
|
Logger.info('✌️ Sentry loaded');
|
|
console.log('✌️ Sentry loaded');
|
|
};
|