diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-10-30 11:33:27 +1100 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-10-30 11:34:25 +1100 |
commit | 45aadf327d7cd596e8a21e0ca1a19a7e9e6246ce (patch) | |
tree | e1e5b75c5d3c3914498b27f2c6037080ef4d578a | |
parent | Added fast connect to index (diff) | |
download | server-45aadf327d7cd596e8a21e0ca1a19a7e9e6246ce.tar.xz |
Sentry stuff?
-rw-r--r-- | package-lock.json | 179 | ||||
-rw-r--r-- | package.json | 5 | ||||
-rw-r--r-- | src/bundle/Server.ts | 4 | ||||
-rw-r--r-- | src/gateway/events/Message.ts | 13 |
4 files changed, 125 insertions, 76 deletions
diff --git a/package-lock.json b/package-lock.json index 4cba0900..3189e47b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,9 @@ "license": "AGPL-3.0-only", "dependencies": { "@aws-sdk/client-s3": "^3.178.0", - "@sentry/node": "^7.13.0", - "@sentry/tracing": "^7.13.0", + "@sentry/integrations": "^7.17.2", + "@sentry/node": "^7.17.2", + "@sentry/tracing": "^7.17.2", "ajv": "^8.6.2", "ajv-formats": "^2.1.1", "amqplib": "^0.10.3", @@ -1428,13 +1429,12 @@ } }, "node_modules/@sentry/core": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.13.0.tgz", - "integrity": "sha512-hB46fklmKrSDMEvZOF8qBHhys7PONBFyxQtbNDZUlv/kabs4gF3VEg1ftCaXnjx4lLNlsUl/ScFdM6194RvISg==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.17.2.tgz", + "integrity": "sha512-mBFjngWJPN3V1A/tz/qa1jkQvmZtU07hhlWg+kmajD0nFulPHUWEvZhsi8NFveGcxMxc/wmaSSLcEOpKq5L29g==", "dependencies": { - "@sentry/hub": "7.13.0", - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", "tslib": "^1.9.3" }, "engines": { @@ -1446,33 +1446,33 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, - "node_modules/@sentry/hub": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.13.0.tgz", - "integrity": "sha512-88/GsD1BoyrBwRKJCmVHZtSH5rizOsImUHWEXc1AOa1aR8nanfn56JdAbd6tC55pA+nT4R4H4vN/PrUaomTbtg==", + "node_modules/@sentry/integrations": { + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.17.2.tgz", + "integrity": "sha512-xHS5AK3YOpFIlCWX3rSfxwNUJ/lOKSXU0vx+AI0PAGJFNK4KEu47SKthhq1AArVr3jqFjcy3ZV5+XTjxbzydAA==", "dependencies": { - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", + "localforage": "^1.8.1", "tslib": "^1.9.3" }, "engines": { "node": ">=8" } }, - "node_modules/@sentry/hub/node_modules/tslib": { + "node_modules/@sentry/integrations/node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/node": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.13.0.tgz", - "integrity": "sha512-uP3bPAIRHPilnOEiYGQQDLaQphc/c7d87wm91bZrTJ+WPnMW4D/NmT7fna5zGGDQIr/KTdQ/LEpDeZOILbkCqQ==", - "dependencies": { - "@sentry/core": "7.13.0", - "@sentry/hub": "7.13.0", - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.17.2.tgz", + "integrity": "sha512-dMHff7C3MgKpIlbLkrEEtq1nX8o1Tiax/DWOtj5dLrPMsjQyivMs906GeS3GJkX7YeMMfy93j8gC+qIK54gqFw==", + "dependencies": { + "@sentry/core": "7.17.2", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", @@ -1496,13 +1496,13 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/tracing": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.13.0.tgz", - "integrity": "sha512-/MKSd25rGv6Pc0FPBLXJifkfvSaYVPA8XUOLzVeDN0gl07h8AXli4qG9amTh/4Wb5h4dFpbcscOvW2VC+pxkIA==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.17.2.tgz", + "integrity": "sha512-j9I/g6SMkQjMPrBdzYQJSDk0qc30LJ9wZl6uKXes7dpfASq+IPcRdkPyRc5ZZX6HD/iUAlaCrBKNmYsK4+I5aw==", "dependencies": { - "@sentry/hub": "7.13.0", - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "@sentry/core": "7.17.2", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", "tslib": "^1.9.3" }, "engines": { @@ -1515,19 +1515,19 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/types": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.13.0.tgz", - "integrity": "sha512-ttckM1XaeyHRLMdr79wmGA5PFbTGx2jio9DCD/mkEpSfk6OGfqfC7gpwy7BNstDH/VKyQj/lDCJPnwvWqARMoQ==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.17.2.tgz", + "integrity": "sha512-zxhNQ8Xt/hfP8bFZEV66ovJZK7aUqok5w1wjsHgkUz/S6/gkiMrDYT3OtRCRuY3mfQu9KmeBniM0xZkaxREJ1w==", "engines": { "node": ">=8" } }, "node_modules/@sentry/utils": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.13.0.tgz", - "integrity": "sha512-jnR85LgRLSk7IQe2OhKOPMY4fasJCNQNW0iCXsH+S2R1qnsF+N4ksNkQ+7JyyM9E7F03YpI2qd76bKY0VIn5iA==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.17.2.tgz", + "integrity": "sha512-l8t6qzyi+UUzD0a/oOYn4i+Eii+Ei29/TVwj/+9ogfJzBk6dSwSLvXievsyCRpcN3tftpWP0cHREcbZN64ZOWw==", "dependencies": { - "@sentry/types": "7.13.0", + "@sentry/types": "7.17.2", "tslib": "^1.9.3" }, "engines": { @@ -3696,6 +3696,11 @@ "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": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -3921,6 +3926,22 @@ "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": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", @@ -7380,13 +7401,12 @@ } }, "@sentry/core": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.13.0.tgz", - "integrity": "sha512-hB46fklmKrSDMEvZOF8qBHhys7PONBFyxQtbNDZUlv/kabs4gF3VEg1ftCaXnjx4lLNlsUl/ScFdM6194RvISg==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.17.2.tgz", + "integrity": "sha512-mBFjngWJPN3V1A/tz/qa1jkQvmZtU07hhlWg+kmajD0nFulPHUWEvZhsi8NFveGcxMxc/wmaSSLcEOpKq5L29g==", "requires": { - "@sentry/hub": "7.13.0", - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", "tslib": "^1.9.3" }, "dependencies": { @@ -7397,13 +7417,14 @@ } } }, - "@sentry/hub": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-7.13.0.tgz", - "integrity": "sha512-88/GsD1BoyrBwRKJCmVHZtSH5rizOsImUHWEXc1AOa1aR8nanfn56JdAbd6tC55pA+nT4R4H4vN/PrUaomTbtg==", + "@sentry/integrations": { + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/integrations/-/integrations-7.17.2.tgz", + "integrity": "sha512-xHS5AK3YOpFIlCWX3rSfxwNUJ/lOKSXU0vx+AI0PAGJFNK4KEu47SKthhq1AArVr3jqFjcy3ZV5+XTjxbzydAA==", "requires": { - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", + "localforage": "^1.8.1", "tslib": "^1.9.3" }, "dependencies": { @@ -7415,14 +7436,13 @@ } }, "@sentry/node": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.13.0.tgz", - "integrity": "sha512-uP3bPAIRHPilnOEiYGQQDLaQphc/c7d87wm91bZrTJ+WPnMW4D/NmT7fna5zGGDQIr/KTdQ/LEpDeZOILbkCqQ==", - "requires": { - "@sentry/core": "7.13.0", - "@sentry/hub": "7.13.0", - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-7.17.2.tgz", + "integrity": "sha512-dMHff7C3MgKpIlbLkrEEtq1nX8o1Tiax/DWOtj5dLrPMsjQyivMs906GeS3GJkX7YeMMfy93j8gC+qIK54gqFw==", + "requires": { + "@sentry/core": "7.17.2", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", "cookie": "^0.4.1", "https-proxy-agent": "^5.0.0", "lru_map": "^0.3.3", @@ -7442,13 +7462,13 @@ } }, "@sentry/tracing": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.13.0.tgz", - "integrity": "sha512-/MKSd25rGv6Pc0FPBLXJifkfvSaYVPA8XUOLzVeDN0gl07h8AXli4qG9amTh/4Wb5h4dFpbcscOvW2VC+pxkIA==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-7.17.2.tgz", + "integrity": "sha512-j9I/g6SMkQjMPrBdzYQJSDk0qc30LJ9wZl6uKXes7dpfASq+IPcRdkPyRc5ZZX6HD/iUAlaCrBKNmYsK4+I5aw==", "requires": { - "@sentry/hub": "7.13.0", - "@sentry/types": "7.13.0", - "@sentry/utils": "7.13.0", + "@sentry/core": "7.17.2", + "@sentry/types": "7.17.2", + "@sentry/utils": "7.17.2", "tslib": "^1.9.3" }, "dependencies": { @@ -7460,16 +7480,16 @@ } }, "@sentry/types": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.13.0.tgz", - "integrity": "sha512-ttckM1XaeyHRLMdr79wmGA5PFbTGx2jio9DCD/mkEpSfk6OGfqfC7gpwy7BNstDH/VKyQj/lDCJPnwvWqARMoQ==" + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.17.2.tgz", + "integrity": "sha512-zxhNQ8Xt/hfP8bFZEV66ovJZK7aUqok5w1wjsHgkUz/S6/gkiMrDYT3OtRCRuY3mfQu9KmeBniM0xZkaxREJ1w==" }, "@sentry/utils": { - "version": "7.13.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.13.0.tgz", - "integrity": "sha512-jnR85LgRLSk7IQe2OhKOPMY4fasJCNQNW0iCXsH+S2R1qnsF+N4ksNkQ+7JyyM9E7F03YpI2qd76bKY0VIn5iA==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.17.2.tgz", + "integrity": "sha512-l8t6qzyi+UUzD0a/oOYn4i+Eii+Ei29/TVwj/+9ogfJzBk6dSwSLvXievsyCRpcN3tftpWP0cHREcbZN64ZOWw==", "requires": { - "@sentry/types": "7.13.0", + "@sentry/types": "7.17.2", "tslib": "^1.9.3" }, "dependencies": { @@ -9160,6 +9180,11 @@ "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": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -9353,6 +9378,22 @@ "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": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", diff --git a/package.json b/package.json index ef2cc223..ea9c9b40 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,9 @@ }, "dependencies": { "@aws-sdk/client-s3": "^3.178.0", - "@sentry/node": "^7.13.0", - "@sentry/tracing": "^7.13.0", + "@sentry/integrations": "^7.17.2", + "@sentry/node": "^7.17.2", + "@sentry/tracing": "^7.17.2", "ajv": "^8.6.2", "ajv-formats": "^2.1.1", "amqplib": "^0.10.3", diff --git a/src/bundle/Server.ts b/src/bundle/Server.ts index b98a3776..2bc45f84 100644 --- a/src/bundle/Server.ts +++ b/src/bundle/Server.ts @@ -10,6 +10,7 @@ import { green, bold, yellow } from "picocolors"; import { Config, initDatabase, BannedWords } from "@fosscord/util"; import * as Sentry from "@sentry/node"; import * as Tracing from "@sentry/tracing"; +import * as Integrations from "@sentry/integrations"; const app = express(); const server = http.createServer(); @@ -73,6 +74,9 @@ async function main() { new Sentry.Integrations.Http({ tracing: true }), new Tracing.Integrations.Express({ app }), new Tracing.Integrations.Mysql(), + new Integrations.RewriteFrames({ + root: __dirname, + }), ], tracesSampleRate: Config.get().sentry.traceSampleRate, environment: Config.get().sentry.environment, diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts index 9fafae1e..4ed715b2 100644 --- a/src/gateway/events/Message.ts +++ b/src/gateway/events/Message.ts @@ -42,22 +42,25 @@ export async function Message(this: WebSocket, buffer: WS.Data) { return; } - const transaction = Sentry.startTransaction({ + const transaction = data.op != 1 ? Sentry.startTransaction({ op: OPCODES[data.op], name: `GATEWAY ${OPCODES[data.op]}`, data: { ...data.d, token: data?.d?.token ? "[Redacted]" : undefined, }, - }); + }) : undefined; try { var ret = await OPCodeHandler.call(this, data); - transaction.finish(); + transaction?.finish(); return ret; } catch (error) { - Sentry.captureException(error); - transaction.finish(); + Sentry.withScope((scope) => { + scope.setSpan(transaction); + Sentry.captureException(error); + }); + transaction?.finish(); console.error(`Error: Op ${data.op}`, error); // if (!this.CLOSED && this.CLOSING) return this.close(CLOSECODES.Unknown_error); |