Sentry stuff?
This commit is contained in:
parent
61b9f824f4
commit
5a5a20c203
BIN
package-lock.json
generated
BIN
package-lock.json
generated
Binary file not shown.
@ -49,8 +49,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.178.0",
|
"@aws-sdk/client-s3": "^3.178.0",
|
||||||
"@sentry/node": "^7.13.0",
|
"@sentry/integrations": "^7.17.2",
|
||||||
"@sentry/tracing": "^7.13.0",
|
"@sentry/node": "^7.17.2",
|
||||||
|
"@sentry/tracing": "^7.17.2",
|
||||||
"ajv": "^8.6.2",
|
"ajv": "^8.6.2",
|
||||||
"ajv-formats": "^2.1.1",
|
"ajv-formats": "^2.1.1",
|
||||||
"amqplib": "^0.10.3",
|
"amqplib": "^0.10.3",
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import { green, bold, yellow } from "picocolors";
|
|||||||
import { Config, initDatabase, BannedWords } from "@fosscord/util";
|
import { Config, initDatabase, BannedWords } from "@fosscord/util";
|
||||||
import * as Sentry from "@sentry/node";
|
import * as Sentry from "@sentry/node";
|
||||||
import * as Tracing from "@sentry/tracing";
|
import * as Tracing from "@sentry/tracing";
|
||||||
|
import * as Integrations from "@sentry/integrations";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
const server = http.createServer();
|
const server = http.createServer();
|
||||||
@ -73,6 +74,9 @@ async function main() {
|
|||||||
new Sentry.Integrations.Http({ tracing: true }),
|
new Sentry.Integrations.Http({ tracing: true }),
|
||||||
new Tracing.Integrations.Express({ app }),
|
new Tracing.Integrations.Express({ app }),
|
||||||
new Tracing.Integrations.Mysql(),
|
new Tracing.Integrations.Mysql(),
|
||||||
|
new Integrations.RewriteFrames({
|
||||||
|
root: __dirname,
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
tracesSampleRate: Config.get().sentry.traceSampleRate,
|
tracesSampleRate: Config.get().sentry.traceSampleRate,
|
||||||
environment: Config.get().sentry.environment,
|
environment: Config.get().sentry.environment,
|
||||||
|
|||||||
@ -42,22 +42,25 @@ export async function Message(this: WebSocket, buffer: WS.Data) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const transaction = Sentry.startTransaction({
|
const transaction = data.op != 1 ? Sentry.startTransaction({
|
||||||
op: OPCODES[data.op],
|
op: OPCODES[data.op],
|
||||||
name: `GATEWAY ${OPCODES[data.op]}`,
|
name: `GATEWAY ${OPCODES[data.op]}`,
|
||||||
data: {
|
data: {
|
||||||
...data.d,
|
...data.d,
|
||||||
token: data?.d?.token ? "[Redacted]" : undefined,
|
token: data?.d?.token ? "[Redacted]" : undefined,
|
||||||
},
|
},
|
||||||
});
|
}) : undefined;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var ret = await OPCodeHandler.call(this, data);
|
var ret = await OPCodeHandler.call(this, data);
|
||||||
transaction.finish();
|
transaction?.finish();
|
||||||
return ret;
|
return ret;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Sentry.captureException(error);
|
Sentry.withScope((scope) => {
|
||||||
transaction.finish();
|
scope.setSpan(transaction);
|
||||||
|
Sentry.captureException(error);
|
||||||
|
});
|
||||||
|
transaction?.finish();
|
||||||
console.error(`Error: Op ${data.op}`, error);
|
console.error(`Error: Op ${data.op}`, error);
|
||||||
// if (!this.CLOSED && this.CLOSING)
|
// if (!this.CLOSED && this.CLOSING)
|
||||||
return this.close(CLOSECODES.Unknown_error);
|
return this.close(CLOSECODES.Unknown_error);
|
||||||
|
|||||||
Reference in New Issue
Block a user