1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-10 04:32:35 +01:00

Sentry stuff?

This commit is contained in:
Madeline 2022-10-30 11:33:27 +11:00
parent 61b9f824f4
commit 5a5a20c203
4 changed files with 123 additions and 74 deletions

175
package-lock.json generated
View File

@ -11,8 +11,9 @@
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"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",
@ -1428,13 +1429,12 @@
} }
}, },
"node_modules/@sentry/core": { "node_modules/@sentry/core": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.17.2.tgz",
"integrity": "sha512-hB46fklmKrSDMEvZOF8qBHhys7PONBFyxQtbNDZUlv/kabs4gF3VEg1ftCaXnjx4lLNlsUl/ScFdM6194RvISg==", "integrity": "sha512-mBFjngWJPN3V1A/tz/qa1jkQvmZtU07hhlWg+kmajD0nFulPHUWEvZhsi8NFveGcxMxc/wmaSSLcEOpKq5L29g==",
"dependencies": { "dependencies": {
"@sentry/hub": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/types": "7.13.0", "@sentry/utils": "7.17.2",
"@sentry/utils": "7.13.0",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"engines": { "engines": {
@ -1446,33 +1446,33 @@
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}, },
"node_modules/@sentry/hub": { "node_modules/@sentry/integrations": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.17.2.tgz",
"integrity": "sha512-88/GsD1BoyrBwRKJCmVHZtSH5rizOsImUHWEXc1AOa1aR8nanfn56JdAbd6tC55pA+nT4R4H4vN/PrUaomTbtg==", "integrity": "sha512-xHS5AK3YOpFIlCWX3rSfxwNUJ/lOKSXU0vx+AI0PAGJFNK4KEu47SKthhq1AArVr3jqFjcy3ZV5+XTjxbzydAA==",
"dependencies": { "dependencies": {
"@sentry/types": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/utils": "7.13.0", "@sentry/utils": "7.17.2",
"localforage": "^1.8.1",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/@sentry/hub/node_modules/tslib": { "node_modules/@sentry/integrations/node_modules/tslib": {
"version": "1.14.1", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}, },
"node_modules/@sentry/node": { "node_modules/@sentry/node": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.17.2.tgz",
"integrity": "sha512-uP3bPAIRHPilnOEiYGQQDLaQphc/c7d87wm91bZrTJ+WPnMW4D/NmT7fna5zGGDQIr/KTdQ/LEpDeZOILbkCqQ==", "integrity": "sha512-dMHff7C3MgKpIlbLkrEEtq1nX8o1Tiax/DWOtj5dLrPMsjQyivMs906GeS3GJkX7YeMMfy93j8gC+qIK54gqFw==",
"dependencies": { "dependencies": {
"@sentry/core": "7.13.0", "@sentry/core": "7.17.2",
"@sentry/hub": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/types": "7.13.0", "@sentry/utils": "7.17.2",
"@sentry/utils": "7.13.0",
"cookie": "^0.4.1", "cookie": "^0.4.1",
"https-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0",
"lru_map": "^0.3.3", "lru_map": "^0.3.3",
@ -1496,13 +1496,13 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}, },
"node_modules/@sentry/tracing": { "node_modules/@sentry/tracing": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.17.2.tgz",
"integrity": "sha512-/MKSd25rGv6Pc0FPBLXJifkfvSaYVPA8XUOLzVeDN0gl07h8AXli4qG9amTh/4Wb5h4dFpbcscOvW2VC+pxkIA==", "integrity": "sha512-j9I/g6SMkQjMPrBdzYQJSDk0qc30LJ9wZl6uKXes7dpfASq+IPcRdkPyRc5ZZX6HD/iUAlaCrBKNmYsK4+I5aw==",
"dependencies": { "dependencies": {
"@sentry/hub": "7.13.0", "@sentry/core": "7.17.2",
"@sentry/types": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/utils": "7.13.0", "@sentry/utils": "7.17.2",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"engines": { "engines": {
@ -1515,19 +1515,19 @@
"integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
}, },
"node_modules/@sentry/types": { "node_modules/@sentry/types": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.17.2.tgz",
"integrity": "sha512-ttckM1XaeyHRLMdr79wmGA5PFbTGx2jio9DCD/mkEpSfk6OGfqfC7gpwy7BNstDH/VKyQj/lDCJPnwvWqARMoQ==", "integrity": "sha512-zxhNQ8Xt/hfP8bFZEV66ovJZK7aUqok5w1wjsHgkUz/S6/gkiMrDYT3OtRCRuY3mfQu9KmeBniM0xZkaxREJ1w==",
"engines": { "engines": {
"node": ">=8" "node": ">=8"
} }
}, },
"node_modules/@sentry/utils": { "node_modules/@sentry/utils": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.17.2.tgz",
"integrity": "sha512-jnR85LgRLSk7IQe2OhKOPMY4fasJCNQNW0iCXsH+S2R1qnsF+N4ksNkQ+7JyyM9E7F03YpI2qd76bKY0VIn5iA==", "integrity": "sha512-l8t6qzyi+UUzD0a/oOYn4i+Eii+Ei29/TVwj/+9ogfJzBk6dSwSLvXievsyCRpcN3tftpWP0cHREcbZN64ZOWw==",
"dependencies": { "dependencies": {
"@sentry/types": "7.13.0", "@sentry/types": "7.17.2",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"engines": { "engines": {
@ -3696,6 +3696,11 @@
"node": ">=14.0.0" "node": ">=14.0.0"
} }
}, },
"node_modules/immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"node_modules/imurmurhash": { "node_modules/imurmurhash": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@ -3921,6 +3926,22 @@
"node": ">= 0.8.0" "node": ">= 0.8.0"
} }
}, },
"node_modules/lie": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
"integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==",
"dependencies": {
"immediate": "~3.0.5"
}
},
"node_modules/localforage": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz",
"integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==",
"dependencies": {
"lie": "3.1.1"
}
},
"node_modules/lodash.includes": { "node_modules/lodash.includes": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",
@ -7380,13 +7401,12 @@
} }
}, },
"@sentry/core": { "@sentry/core": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.17.2.tgz",
"integrity": "sha512-hB46fklmKrSDMEvZOF8qBHhys7PONBFyxQtbNDZUlv/kabs4gF3VEg1ftCaXnjx4lLNlsUl/ScFdM6194RvISg==", "integrity": "sha512-mBFjngWJPN3V1A/tz/qa1jkQvmZtU07hhlWg+kmajD0nFulPHUWEvZhsi8NFveGcxMxc/wmaSSLcEOpKq5L29g==",
"requires": { "requires": {
"@sentry/hub": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/types": "7.13.0", "@sentry/utils": "7.17.2",
"@sentry/utils": "7.13.0",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"dependencies": { "dependencies": {
@ -7397,13 +7417,14 @@
} }
} }
}, },
"@sentry/hub": { "@sentry/integrations": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.17.2.tgz",
"integrity": "sha512-88/GsD1BoyrBwRKJCmVHZtSH5rizOsImUHWEXc1AOa1aR8nanfn56JdAbd6tC55pA+nT4R4H4vN/PrUaomTbtg==", "integrity": "sha512-xHS5AK3YOpFIlCWX3rSfxwNUJ/lOKSXU0vx+AI0PAGJFNK4KEu47SKthhq1AArVr3jqFjcy3ZV5+XTjxbzydAA==",
"requires": { "requires": {
"@sentry/types": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/utils": "7.13.0", "@sentry/utils": "7.17.2",
"localforage": "^1.8.1",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"dependencies": { "dependencies": {
@ -7415,14 +7436,13 @@
} }
}, },
"@sentry/node": { "@sentry/node": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.17.2.tgz",
"integrity": "sha512-uP3bPAIRHPilnOEiYGQQDLaQphc/c7d87wm91bZrTJ+WPnMW4D/NmT7fna5zGGDQIr/KTdQ/LEpDeZOILbkCqQ==", "integrity": "sha512-dMHff7C3MgKpIlbLkrEEtq1nX8o1Tiax/DWOtj5dLrPMsjQyivMs906GeS3GJkX7YeMMfy93j8gC+qIK54gqFw==",
"requires": { "requires": {
"@sentry/core": "7.13.0", "@sentry/core": "7.17.2",
"@sentry/hub": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/types": "7.13.0", "@sentry/utils": "7.17.2",
"@sentry/utils": "7.13.0",
"cookie": "^0.4.1", "cookie": "^0.4.1",
"https-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0",
"lru_map": "^0.3.3", "lru_map": "^0.3.3",
@ -7442,13 +7462,13 @@
} }
}, },
"@sentry/tracing": { "@sentry/tracing": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.17.2.tgz",
"integrity": "sha512-/MKSd25rGv6Pc0FPBLXJifkfvSaYVPA8XUOLzVeDN0gl07h8AXli4qG9amTh/4Wb5h4dFpbcscOvW2VC+pxkIA==", "integrity": "sha512-j9I/g6SMkQjMPrBdzYQJSDk0qc30LJ9wZl6uKXes7dpfASq+IPcRdkPyRc5ZZX6HD/iUAlaCrBKNmYsK4+I5aw==",
"requires": { "requires": {
"@sentry/hub": "7.13.0", "@sentry/core": "7.17.2",
"@sentry/types": "7.13.0", "@sentry/types": "7.17.2",
"@sentry/utils": "7.13.0", "@sentry/utils": "7.17.2",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"dependencies": { "dependencies": {
@ -7460,16 +7480,16 @@
} }
}, },
"@sentry/types": { "@sentry/types": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.17.2.tgz",
"integrity": "sha512-ttckM1XaeyHRLMdr79wmGA5PFbTGx2jio9DCD/mkEpSfk6OGfqfC7gpwy7BNstDH/VKyQj/lDCJPnwvWqARMoQ==" "integrity": "sha512-zxhNQ8Xt/hfP8bFZEV66ovJZK7aUqok5w1wjsHgkUz/S6/gkiMrDYT3OtRCRuY3mfQu9KmeBniM0xZkaxREJ1w=="
}, },
"@sentry/utils": { "@sentry/utils": {
"version": "7.13.0", "version": "7.17.2",
"resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.13.0.tgz", "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.17.2.tgz",
"integrity": "sha512-jnR85LgRLSk7IQe2OhKOPMY4fasJCNQNW0iCXsH+S2R1qnsF+N4ksNkQ+7JyyM9E7F03YpI2qd76bKY0VIn5iA==", "integrity": "sha512-l8t6qzyi+UUzD0a/oOYn4i+Eii+Ei29/TVwj/+9ogfJzBk6dSwSLvXievsyCRpcN3tftpWP0cHREcbZN64ZOWw==",
"requires": { "requires": {
"@sentry/types": "7.13.0", "@sentry/types": "7.17.2",
"tslib": "^1.9.3" "tslib": "^1.9.3"
}, },
"dependencies": { "dependencies": {
@ -9160,6 +9180,11 @@
"queue": "6.0.2" "queue": "6.0.2"
} }
}, },
"immediate": {
"version": "3.0.6",
"resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
"integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ=="
},
"imurmurhash": { "imurmurhash": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
@ -9353,6 +9378,22 @@
"type-check": "~0.3.2" "type-check": "~0.3.2"
} }
}, },
"lie": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/lie/-/lie-3.1.1.tgz",
"integrity": "sha512-RiNhHysUjhrDQntfYSfY4MU24coXXdEOgw9WGcKHNeEwffDYbF//u87M1EWaMGzuFoSbqW0C9C6lEEhDOAswfw==",
"requires": {
"immediate": "~3.0.5"
}
},
"localforage": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/localforage/-/localforage-1.10.0.tgz",
"integrity": "sha512-14/H1aX7hzBBmmh7sGPd+AOMkkIrHM3Z1PAyGgZigA1H1p5O5ANnMyWzvpAETtG68/dC4pC0ncy3+PPGzXZHPg==",
"requires": {
"lie": "3.1.1"
}
},
"lodash.includes": { "lodash.includes": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz",

View File

@ -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",

View File

@ -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,

View File

@ -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.withScope((scope) => {
scope.setSpan(transaction);
Sentry.captureException(error); Sentry.captureException(error);
transaction.finish(); });
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);