diff --git a/libraries/logger/logging-manager.js b/libraries/logger/logging-manager.js index 1dac0bc2a3..7bfad1aa5e 100644 --- a/libraries/logger/logging-manager.js +++ b/libraries/logger/logging-manager.js @@ -1,7 +1,6 @@ const Stream = require('node:stream') const bunyan = require('bunyan') const GCPManager = require('./gcp-manager') -const SentryManager = require('./sentry-manager') const Serializers = require('./serializers') const { FileLogLevelChecker, @@ -33,10 +32,6 @@ const LoggingManager = { return this }, - initializeErrorReporting(dsn, options) { - this.sentryManager = new SentryManager() - }, - /** * @param {Record|string} attributes - Attributes to log (nice serialization for err, req, res) * @param {string} [message] - Optional message @@ -68,9 +63,6 @@ const LoggingManager = { }) } this.logger.error(attributes, message, ...Array.from(args)) - if (this.sentryManager) { - this.sentryManager.captureExceptionRateLimited(attributes, message) - } }, /** @@ -98,9 +90,6 @@ const LoggingManager = { */ fatal(attributes, message) { this.logger.fatal(attributes, message) - if (this.sentryManager) { - this.sentryManager.captureException(attributes, message, 'fatal') - } }, _getOutputStreamConfig() { diff --git a/libraries/logger/package.json b/libraries/logger/package.json index 6c939dda70..6ff154def7 100644 --- a/libraries/logger/package.json +++ b/libraries/logger/package.json @@ -23,7 +23,6 @@ "@google-cloud/logging-bunyan": "^5.1.0", "@overleaf/fetch-utils": "*", "@overleaf/o-error": "*", - "@sentry/node": "^6.13.2", "bunyan": "^1.8.14" }, "devDependencies": { diff --git a/libraries/logger/sentry-manager.js b/libraries/logger/sentry-manager.js deleted file mode 100644 index 15a667fd2a..0000000000 --- a/libraries/logger/sentry-manager.js +++ /dev/null @@ -1,106 +0,0 @@ -const Serializers = require('./serializers') -const RATE_LIMIT_MAX_ERRORS = 5 -const RATE_LIMIT_INTERVAL_MS = 60000 - -class SentryManager { - constructor(dsn, options) { - this.Sentry = require('@sentry/node') - this.Sentry.init({ dsn, ...options }) - // for rate limiting on sentry reporting - this.lastErrorTimeStamp = 0 - this.lastErrorCount = 0 - } - - captureExceptionRateLimited(attributes, message) { - const now = Date.now() - // have we recently reported an error? - const recentSentryReport = - now - this.lastErrorTimeStamp < RATE_LIMIT_INTERVAL_MS - // if so, increment the error count - if (recentSentryReport) { - this.lastErrorCount++ - } else { - this.lastErrorCount = 0 - this.lastErrorTimeStamp = now - } - // only report 5 errors every minute to avoid overload - if (this.lastErrorCount < RATE_LIMIT_MAX_ERRORS) { - // add a note if the rate limit has been hit - const note = - this.lastErrorCount + 1 === RATE_LIMIT_MAX_ERRORS - ? '(rate limited)' - : '' - // report the exception - this.captureException(attributes, message, `error${note}`) - } - } - - captureException(attributes, message, level) { - // handle case of logger.error "message" - if (typeof attributes === 'string') { - attributes = { err: new Error(attributes) } - } - - // extract any error object - let error = Serializers.err(attributes.err || attributes.error) - - // avoid reporting errors twice - for (const key in attributes) { - const value = attributes[key] - if (value instanceof Error && value.reportedToSentry) { - return - } - } - - // include our log message in the error report - if (error == null) { - if (typeof message === 'string') { - error = { message } - } - } else if (message != null) { - attributes.description = message - } - - // report the error - if (error != null) { - // capture attributes and use *_id objects as tags - const tags = {} - const extra = {} - for (const key in attributes) { - let value = attributes[key] - if (Serializers[key]) { - value = Serializers[key](value) - } - if (key.match(/_id/) && typeof value === 'string') { - tags[key] = value - } - extra[key] = value - } - - // OError integration - extra.info = error.info - delete error.info - - // Sentry wants to receive an Error instance. - const errInstance = new Error(error.message) - Object.assign(errInstance, error) - - try { - // send the error to sentry - this.Sentry.captureException(errInstance, { tags, extra, level }) - - // put a flag on the errors to avoid reporting them multiple times - for (const key in attributes) { - const value = attributes[key] - if (value instanceof Error) { - value.reportedToSentry = true - } - } - } catch (err) { - // ignore Sentry errors - } - } - } -} - -module.exports = SentryManager diff --git a/libraries/logger/test/unit/logging-manager-tests.js b/libraries/logger/test/unit/logging-manager-tests.js index f920255a01..9b571c3ce5 100644 --- a/libraries/logger/test/unit/logging-manager-tests.js +++ b/libraries/logger/test/unit/logging-manager-tests.js @@ -43,20 +43,14 @@ describe('LoggingManager', function () { .stub() .returns(this.GCEMetadataLogLevelChecker), } - this.SentryManager = { - captureException: sinon.stub(), - captureExceptionRateLimited: sinon.stub(), - } this.LoggingManager = SandboxedModule.require(MODULE_PATH, { requires: { bunyan: this.Bunyan, './log-level-checker': this.LogLevelChecker, - './sentry-manager': sinon.stub().returns(this.SentryManager), }, }) this.loggerName = 'test' this.logger = this.LoggingManager.initialize(this.loggerName) - this.logger.initializeErrorReporting('test_dsn') }) afterEach(function () { @@ -160,13 +154,6 @@ describe('LoggingManager', function () { }) }) - describe('logger.error', function () { - it('should report errors to Sentry', function () { - this.logger.error({ foo: 'bar' }, 'message') - expect(this.SentryManager.captureExceptionRateLimited).to.have.been.called - }) - }) - describe('ringbuffer', function () { beforeEach(function () { this.logBufferMock = [ diff --git a/libraries/logger/test/unit/sentry-manager-tests.js b/libraries/logger/test/unit/sentry-manager-tests.js deleted file mode 100644 index 5bd2578734..0000000000 --- a/libraries/logger/test/unit/sentry-manager-tests.js +++ /dev/null @@ -1,247 +0,0 @@ -const Path = require('node:path') -const SandboxedModule = require('sandboxed-module') -const { expect } = require('chai') -const sinon = require('sinon') - -const MODULE_PATH = Path.join(__dirname, '../../sentry-manager.js') - -describe('SentryManager', function () { - beforeEach(function () { - this.clock = sinon.useFakeTimers(Date.now()) - this.Sentry = { - init: sinon.stub(), - captureException: sinon.stub(), - } - this.SentryManager = SandboxedModule.require(MODULE_PATH, { - requires: { - '@sentry/node': this.Sentry, - }, - }) - this.sentryManager = new this.SentryManager('test_dsn') - }) - - afterEach(function () { - this.clock.restore() - }) - - describe('captureExceptionRateLimited', function () { - it('should report a single error to sentry', function () { - this.sentryManager.captureExceptionRateLimited({ foo: 'bar' }, 'message') - expect(this.Sentry.captureException).to.have.been.calledOnce - }) - - it('should report the same error to sentry only once', function () { - const error1 = new Error('this is the error') - this.sentryManager.captureExceptionRateLimited( - { foo: error1 }, - 'first message' - ) - this.sentryManager.captureExceptionRateLimited( - { bar: error1 }, - 'second message' - ) - expect(this.Sentry.captureException).to.have.been.calledOnce - }) - - it('should report two different errors to sentry individually', function () { - const error1 = new Error('this is the error') - const error2 = new Error('this is the error') - this.sentryManager.captureExceptionRateLimited( - { foo: error1 }, - 'first message' - ) - this.sentryManager.captureExceptionRateLimited( - { bar: error2 }, - 'second message' - ) - expect(this.Sentry.captureException).to.have.been.calledTwice - }) - - it('for multiple errors should only report a maximum of 5 errors to sentry', function () { - for (let i = 0; i < 10; i++) { - this.sentryManager.captureExceptionRateLimited( - { foo: 'bar' }, - 'message' - ) - } - expect(this.Sentry.captureException).to.have.callCount(5) - }) - - it('for multiple errors with a minute delay should report 10 errors to sentry', function () { - for (let i = 0; i < 10; i++) { - this.sentryManager.captureExceptionRateLimited( - { foo: 'bar' }, - 'message' - ) - } - expect(this.Sentry.captureException).to.have.callCount(5) - - // allow a minute to pass - this.clock.tick(61 * 1000) - - for (let i = 0; i < 10; i++) { - this.sentryManager.captureExceptionRateLimited( - { foo: 'bar' }, - 'message' - ) - } - expect(this.Sentry.captureException).to.have.callCount(10) - }) - }) - - describe('captureException', function () { - it('should remove the path from fs errors', function () { - const fsError = new Error( - "Error: ENOENT: no such file or directory, stat '/tmp/3279b8d0-da10-11e8-8255-efd98985942b'" - ) - fsError.path = '/tmp/3279b8d0-da10-11e8-8255-efd98985942b' - this.sentryManager.captureException({ err: fsError }, 'message', 'error') - expect(this.Sentry.captureException).to.have.been.calledWith( - sinon.match.has( - 'message', - 'Error: ENOENT: no such file or directory, stat' - ) - ) - }) - - it('should sanitize error', function () { - const err = { - name: 'CustomError', - message: 'hello', - _oErrorTags: [{ stack: 'here:1', info: { one: 1 } }], - stack: 'here:0', - info: { key: 'value' }, - code: 42, - signal: 9, - path: '/foo', - } - this.sentryManager.captureException({ err }, 'message', 'error') - const expectedErr = { - name: 'CustomError', - message: 'hello', - stack: 'here:0\nhere:1', - code: 42, - signal: 9, - path: '/foo', - } - expect(this.Sentry.captureException).to.have.been.calledWith( - sinon.match(expectedErr), - sinon.match({ - tags: sinon.match.any, - level: sinon.match.any, - extra: { - description: 'message', - info: sinon.match({ - one: 1, - key: 'value', - }), - }, - }) - ) - // Chai is very picky with comparing Error instances. Go the long way of comparing all the fields manually. - const gotErr = this.Sentry.captureException.args[0][0] - for (const [key, wanted] of Object.entries(expectedErr)) { - expect(gotErr).to.have.property(key, wanted) - } - }) - it('should sanitize request', function () { - const req = { - ip: '1.2.3.4', - method: 'GET', - url: '/foo', - headers: { - referer: 'abc', - 'content-length': 1337, - 'user-agent': 'curl', - authorization: '42', - }, - } - this.sentryManager.captureException({ req }, 'message', 'error') - const expectedReq = { - remoteAddress: '1.2.3.4', - method: 'GET', - url: '/foo', - headers: { - referer: 'abc', - 'content-length': 1337, - 'user-agent': 'curl', - }, - } - expect(this.Sentry.captureException).to.have.been.calledWith( - sinon.match({ - message: 'message', - }), - sinon.match({ - tags: sinon.match.any, - level: sinon.match.any, - extra: { - info: sinon.match.any, - req: expectedReq, - }, - }) - ) - expect(this.Sentry.captureException.args[0][1].extra.req).to.deep.equal( - expectedReq - ) - }) - it('should sanitize response', function () { - const res = { - statusCode: 417, - body: Buffer.from('foo'), - getHeader(key) { - expect(key).to.be.oneOf(['content-length']) - if (key === 'content-length') return 1337 - }, - } - this.sentryManager.captureException({ res }, 'message', 'error') - const expectedRes = { - statusCode: 417, - headers: { - 'content-length': 1337, - }, - } - expect(this.Sentry.captureException).to.have.been.calledWith( - sinon.match({ - message: 'message', - }), - sinon.match({ - tags: sinon.match.any, - level: sinon.match.any, - extra: { - info: sinon.match.any, - res: expectedRes, - }, - }) - ) - expect(this.Sentry.captureException.args[0][1].extra.res).to.deep.equal( - expectedRes - ) - }) - - describe('reportedToSentry', function () { - it('should mark the error as reported to sentry', function () { - const err = new Error() - this.sentryManager.captureException({ err }, 'message') - expect(this.Sentry.captureException).to.have.been.called - expect(err.reportedToSentry).to.equal(true) - }) - - it('should mark two errors as reported to sentry', function () { - const err1 = new Error() - const err2 = new Error() - this.sentryManager.captureException({ err: err1, err2 }, 'message') - expect(this.Sentry.captureException).to.have.been.called - expect(err1.reportedToSentry).to.equal(true) - expect(err2.reportedToSentry).to.equal(true) - }) - - it('should not mark arbitrary objects as reported to sentry', function () { - const err = new Error() - const ctx = { foo: 'bar' } - this.sentryManager.captureException({ err, ctx }, 'message') - expect(this.Sentry.captureException).to.have.been.called - expect(ctx.reportedToSentry).not.to.exist - }) - }) - }) -}) diff --git a/package-lock.json b/package-lock.json index 91edcce9d2..492472de69 100644 --- a/package-lock.json +++ b/package-lock.json @@ -186,7 +186,6 @@ "@google-cloud/logging-bunyan": "^5.1.0", "@overleaf/fetch-utils": "*", "@overleaf/o-error": "*", - "@sentry/node": "^6.13.2", "bunyan": "^1.8.14" }, "devDependencies": { @@ -8879,94 +8878,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/@sentry/core": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.17.3.tgz", - "integrity": "sha512-h7WgrNL0RVlr8Dceh97ZiXNdmEumDutpoqFijjiX4x72IiC6zSaVD4IsqrdGln+v8iJ3l3lX44HHqzubDub1OQ==", - "dependencies": { - "@sentry/hub": "6.17.3", - "@sentry/minimal": "6.17.3", - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/core/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/hub": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.17.3.tgz", - "integrity": "sha512-TDxv8nRvk45xvfQg6zs8GYzQzgo0EMhI3wjQZLiNfW2rzybKmIwVp2x3O4PAc3WPzwg4bYNgSAkYKVlHmYjRCg==", - "dependencies": { - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/hub/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/minimal": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.17.3.tgz", - "integrity": "sha512-zvGGfHNNA92Lqx6P8ZwOUkmRmAiQl0AQFRXl9So1Ayq9bJRnFLJZv4YFVnp2wE4HXYIlfBYb51+GlGB5LIuPmw==", - "dependencies": { - "@sentry/hub": "6.17.3", - "@sentry/types": "6.17.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/minimal/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": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.17.3.tgz", - "integrity": "sha512-LvpB6bCQTytoOlrcQgR80aeEEBi2Sm1hNf+VvoPT6CW7tKI1/6pMWXaNnRu2dpyWS/j6tooz8rd/3dl1SZoGvg==", - "dependencies": { - "@sentry/core": "6.17.3", - "@sentry/hub": "6.17.3", - "@sentry/tracing": "6.17.3", - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "cookie": "^0.4.1", - "https-proxy-agent": "^5.0.0", - "lru_map": "^0.3.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/node/node_modules/cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==", - "engines": { - "node": ">= 0.6" - } - }, - "node_modules/@sentry/node/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/replay": { "version": "7.46.0", "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.46.0.tgz", @@ -9023,51 +8934,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/@sentry/tracing": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.17.3.tgz", - "integrity": "sha512-GnHugxw5qkWwYmeQbbrswuWpb0bpYqyJr/dO25QQOCwp+cckQrvBYTMC8zGJG10u94O4el0lQaQnNFz9WF3r6g==", - "dependencies": { - "@sentry/hub": "6.17.3", - "@sentry/minimal": "6.17.3", - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/tracing/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/types": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.17.3.tgz", - "integrity": "sha512-0AXCjYcfl8Vx26GfyLY4rBQ78Lyt1oND3UozTTMaVXlcKYIjzV+f7TOo5IZx+Kbr6EGUNDLdpA4xfbkWdW/1NA==", - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/utils": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.17.3.tgz", - "integrity": "sha512-6/2awDIeHSj0JgiC7DDdV1lxvLmf+/BisWhw09dKvmhVQB3ADvQZbohjUgM+Qam5zE0xmZAfQhvuDwC41W8Wnw==", - "dependencies": { - "@sentry/types": "6.17.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/utils/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/@sideway/address": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", @@ -26301,11 +26167,6 @@ "tslib": "^2.0.3" } }, - "node_modules/lru_map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", - "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=" - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -50296,7 +50157,6 @@ "@google-cloud/logging-bunyan": "^5.1.0", "@overleaf/fetch-utils": "*", "@overleaf/o-error": "*", - "@sentry/node": "^6.13.2", "bunyan": "^1.8.14", "chai": "^4.3.6", "mocha": "^10.2.0", @@ -53504,87 +53364,6 @@ } } }, - "@sentry/core": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.17.3.tgz", - "integrity": "sha512-h7WgrNL0RVlr8Dceh97ZiXNdmEumDutpoqFijjiX4x72IiC6zSaVD4IsqrdGln+v8iJ3l3lX44HHqzubDub1OQ==", - "requires": { - "@sentry/hub": "6.17.3", - "@sentry/minimal": "6.17.3", - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "@sentry/hub": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.17.3.tgz", - "integrity": "sha512-TDxv8nRvk45xvfQg6zs8GYzQzgo0EMhI3wjQZLiNfW2rzybKmIwVp2x3O4PAc3WPzwg4bYNgSAkYKVlHmYjRCg==", - "requires": { - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "@sentry/minimal": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.17.3.tgz", - "integrity": "sha512-zvGGfHNNA92Lqx6P8ZwOUkmRmAiQl0AQFRXl9So1Ayq9bJRnFLJZv4YFVnp2wE4HXYIlfBYb51+GlGB5LIuPmw==", - "requires": { - "@sentry/hub": "6.17.3", - "@sentry/types": "6.17.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "@sentry/node": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.17.3.tgz", - "integrity": "sha512-LvpB6bCQTytoOlrcQgR80aeEEBi2Sm1hNf+VvoPT6CW7tKI1/6pMWXaNnRu2dpyWS/j6tooz8rd/3dl1SZoGvg==", - "requires": { - "@sentry/core": "6.17.3", - "@sentry/hub": "6.17.3", - "@sentry/tracing": "6.17.3", - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "cookie": "^0.4.1", - "https-proxy-agent": "^5.0.0", - "lru_map": "^0.3.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" - }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, "@sentry/replay": { "version": "7.46.0", "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.46.0.tgz", @@ -53631,46 +53410,6 @@ } } }, - "@sentry/tracing": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.17.3.tgz", - "integrity": "sha512-GnHugxw5qkWwYmeQbbrswuWpb0bpYqyJr/dO25QQOCwp+cckQrvBYTMC8zGJG10u94O4el0lQaQnNFz9WF3r6g==", - "requires": { - "@sentry/hub": "6.17.3", - "@sentry/minimal": "6.17.3", - "@sentry/types": "6.17.3", - "@sentry/utils": "6.17.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, - "@sentry/types": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.17.3.tgz", - "integrity": "sha512-0AXCjYcfl8Vx26GfyLY4rBQ78Lyt1oND3UozTTMaVXlcKYIjzV+f7TOo5IZx+Kbr6EGUNDLdpA4xfbkWdW/1NA==" - }, - "@sentry/utils": { - "version": "6.17.3", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.17.3.tgz", - "integrity": "sha512-6/2awDIeHSj0JgiC7DDdV1lxvLmf+/BisWhw09dKvmhVQB3ADvQZbohjUgM+Qam5zE0xmZAfQhvuDwC41W8Wnw==", - "requires": { - "@sentry/types": "6.17.3", - "tslib": "^1.9.3" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - } - } - }, "@sideway/address": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", @@ -67593,11 +67332,6 @@ "tslib": "^2.0.3" } }, - "lru_map": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/lru_map/-/lru_map-0.3.3.tgz", - "integrity": "sha1-tcg1G5Rky9dQM1p5ZQoOwOVhGN0=" - }, "lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", diff --git a/services/clsi/README.md b/services/clsi/README.md index 0626bb4cfe..33a9c95c1c 100644 --- a/services/clsi/README.md +++ b/services/clsi/README.md @@ -27,7 +27,6 @@ The CLSI can be configured through the following environment variables: * `FILESTORE_PARALLEL_FILE_DOWNLOADS` - Number of parallel file downloads * `LISTEN_ADDRESS` - The address for the RESTful service to listen on. Set to `0.0.0.0` to listen on all network interfaces * `PROCESS_LIFE_SPAN_LIMIT_MS` - Process life span limit in milliseconds -* `SENTRY_DSN` - Sentry [Data Source Name](https://docs.sentry.io/product/sentry-basics/dsn-explainer/) * `SMOKE_TEST` - Whether to run smoke tests * `TEXLIVE_IMAGE` - The TeX Live Docker image to use for sibling containers, e.g. `gcr.io/overleaf-ops/texlive-full:2017.1` * `TEX_LIVE_IMAGE_NAME_OVERRIDE` - The name of the registry for the Docker image e.g. `gcr.io/overleaf-ops` diff --git a/services/clsi/app.js b/services/clsi/app.js index 07d4eddd4e..f132eb00f6 100644 --- a/services/clsi/app.js +++ b/services/clsi/app.js @@ -6,9 +6,6 @@ const ContentController = require('./app/js/ContentController') const Settings = require('@overleaf/settings') const logger = require('@overleaf/logger') logger.initialize('clsi') -if (Settings.sentry.dsn != null) { - logger.initializeErrorReporting(Settings.sentry.dsn) -} const Metrics = require('@overleaf/metrics') const smokeTest = require('./test/smoke/js/SmokeTests') diff --git a/services/clsi/config/settings.defaults.js b/services/clsi/config/settings.defaults.js index beb9c28926..21fe82e533 100644 --- a/services/clsi/config/settings.defaults.js +++ b/services/clsi/config/settings.defaults.js @@ -60,10 +60,6 @@ module.exports = { texliveImageNameOveride: process.env.TEX_LIVE_IMAGE_NAME_OVERRIDE, texliveOpenoutAny: process.env.TEXLIVE_OPENOUT_ANY, texliveMaxPrintLine: process.env.TEXLIVE_MAX_PRINT_LINE, - sentry: { - dsn: process.env.SENTRY_DSN, - }, - enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true', enablePdfCachingDark: process.env.ENABLE_PDF_CACHING_DARK === 'true', pdfCachingMinChunkSize: diff --git a/services/document-updater/app.js b/services/document-updater/app.js index fab33150c3..ddb3d9ac77 100644 --- a/services/document-updater/app.js +++ b/services/document-updater/app.js @@ -9,10 +9,6 @@ logger.initialize('document-updater') logger.logger.addSerializers(require('./app/js/LoggerSerializers')) -if (Settings.sentry != null && Settings.sentry.dsn != null) { - logger.initializeErrorReporting(Settings.sentry.dsn) -} - const RedisManager = require('./app/js/RedisManager') const DispatchManager = require('./app/js/DispatchManager') const DeleteQueueManager = require('./app/js/DeleteQueueManager') diff --git a/services/document-updater/config/settings.defaults.js b/services/document-updater/config/settings.defaults.js index 3cf251384f..0cd29d325b 100755 --- a/services/document-updater/config/settings.defaults.js +++ b/services/document-updater/config/settings.defaults.js @@ -176,10 +176,6 @@ module.exports = { }, }, - sentry: { - dsn: process.env.SENTRY_DSN, - }, - publishOnIndividualChannels: process.env.PUBLISH_ON_INDIVIDUAL_CHANNELS === 'true', diff --git a/services/filestore/app.js b/services/filestore/app.js index bc2d270132..23d01f1ca3 100644 --- a/services/filestore/app.js +++ b/services/filestore/app.js @@ -23,10 +23,6 @@ const app = express() app.use(RequestLogger.middleware) -if (settings.sentry && settings.sentry.dsn) { - logger.initializeErrorReporting(settings.sentry.dsn) -} - Metrics.open_sockets.monitor(true) Metrics.memory.monitor(logger) if (Metrics.event_loop) { diff --git a/services/filestore/config/settings.defaults.js b/services/filestore/config/settings.defaults.js index 7d762afb72..a926115b5c 100644 --- a/services/filestore/config/settings.defaults.js +++ b/services/filestore/config/settings.defaults.js @@ -99,10 +99,6 @@ const settings = { enableConversions: process.env.ENABLE_CONVERSIONS === 'true', - sentry: { - dsn: process.env.SENTRY_DSN, - }, - gracefulShutdownDelayInMs: parseInt(process.env.GRACEFUL_SHUTDOWN_DELAY_SECONDS ?? '30', 10) * 1000, } diff --git a/services/project-history/app/js/server.js b/services/project-history/app/js/server.js index e573848e3e..4f13198eea 100644 --- a/services/project-history/app/js/server.js +++ b/services/project-history/app/js/server.js @@ -1,4 +1,3 @@ -import Settings from '@overleaf/settings' import Metrics from '@overleaf/metrics' import logger from '@overleaf/logger' import express from 'express' @@ -9,10 +8,6 @@ import * as Validation from './Validation.js' const HistoryLogger = logger.initialize('project-history').logger -if (Settings.sentry.dsn) { - logger.initializeErrorReporting(Settings.sentry.dsn) -} - Metrics.event_loop.monitor(logger) Metrics.memory.monitor(logger) Metrics.leaked_sockets.monitor(logger) diff --git a/services/project-history/config/settings.defaults.cjs b/services/project-history/config/settings.defaults.cjs index fb90adb327..15a96a8373 100644 --- a/services/project-history/config/settings.defaults.cjs +++ b/services/project-history/config/settings.defaults.cjs @@ -101,9 +101,5 @@ module.exports = { uploadFolder: process.env.UPLOAD_FOLDER || '/tmp/', }, - sentry: { - dsn: process.env.SENTRY_DSN, - }, - maxFileSizeInBytes: 100 * 1024 * 1024, // 100 megabytes } diff --git a/services/real-time/app.js b/services/real-time/app.js index 88250d5175..61b3f0cad1 100644 --- a/services/real-time/app.js +++ b/services/real-time/app.js @@ -13,9 +13,6 @@ Metrics.open_sockets.monitor() const express = require('express') const session = require('express-session') const redis = require('@overleaf/redis-wrapper') -if (Settings.sentry && Settings.sentry.dsn) { - logger.initializeErrorReporting(Settings.sentry.dsn) -} const sessionRedisClient = redis.createClient(Settings.redis.websessions) diff --git a/services/real-time/config/settings.defaults.js b/services/real-time/config/settings.defaults.js index c05fb69265..1cc0c0f107 100644 --- a/services/real-time/config/settings.defaults.js +++ b/services/real-time/config/settings.defaults.js @@ -162,10 +162,6 @@ const settings = { // the deployment colour for this app. deploymentFile: process.env.DEPLOYMENT_FILE, - sentry: { - dsn: process.env.SENTRY_DSN, - }, - errors: { catchUncaughtErrors: true, shutdownOnUncaughtError: true, diff --git a/services/web/app.mjs b/services/web/app.mjs index 9a66d0f3ec..418d0582cd 100644 --- a/services/web/app.mjs +++ b/services/web/app.mjs @@ -23,9 +23,6 @@ logger.logger.serializers.user = Serializers.user logger.logger.serializers.docs = Serializers.docs logger.logger.serializers.files = Serializers.files logger.logger.serializers.project = Serializers.project -if (Settings.sentry?.dsn != null) { - logger.initializeErrorReporting(Settings.sentry.dsn) -} http.globalAgent.keepAlive = false http.globalAgent.maxSockets = Settings.limits.httpGlobalAgentMaxSockets https.globalAgent.keepAlive = false