diff --git a/bin/tonos-se.js b/bin/tonos-se.js index 4c195d4..6fe915a 100755 --- a/bin/tonos-se.js +++ b/bin/tonos-se.js @@ -4,10 +4,19 @@ const commandLineArgs = require('command-line-args'); const getUsage = require('command-line-usage'); const boxen = require('boxen'); const cj = require('color-json'); +const Sentry = require('@sentry/node'); const control = require('../lib/tonos-se'); const PortsAlreadyInUseError = require('../lib/errors/ports-already-in-use'); const ReleaseNotFound = require('../lib/errors/release-not-found'); +require('@sentry/tracing'); + +Sentry.init({ + dsn: 'https://8b749c16284f4f55ab80fe52b72e66f1@o558177.ingest.sentry.io/5691337', + enabled: (process.env.TONOS_SE_SEND_DEBUG_INFO !== undefined), + tracesSampleRate: 1.0, +}); + /* first - parse the main command */ const mainDefinitions = [ { name: 'command', defaultOption: true }, @@ -50,6 +59,7 @@ async function main() { { name: '--arango-port', summary: 'Set listening port for ArangoDB' }, { name: '--tonos-se-version', summary: 'Set a version of TON OS SE' }, { name: '--github-binaries-repository', summary: 'GitHub repository with binaries. Default: {underline ton-actions/tonos-se-binaries}' }, + { name: '--send-debug-info', summary: 'Send debug info to sentry to notify mainteiners. Default: false' }, ], }, { @@ -113,6 +123,7 @@ async function main() { { name: 'ton-node-requests-port', type: Number }, { name: 'tonos-se-version', type: String }, { name: 'github-binaries-repository', type: String }, + { name: 'send-debug-info', type: Boolean }, ]; // show current config @@ -138,11 +149,22 @@ async function main() { } (async () => { + const transaction = Sentry.startTransaction({ + op: 'main', + name: 'main transaction', + }); + + let exitCode = 0; try { await main(); - } catch (error) { - console.error(error); - process.exit(1); + } catch (ex) { + console.error(ex); + Sentry.captureException(ex); + exitCode = 1; + } finally { + transaction.finish(); } + await Sentry.close(); + process.exit(exitCode); } )(); diff --git a/package-lock.json b/package-lock.json index 102d9e8..57988db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,6 +11,8 @@ "dependencies": { "@lifeomic/attempt": "^3.0.0", "@octokit/rest": "^18.3.5", + "@sentry/node": "^6.2.3", + "@sentry/tracing": "^6.2.3", "@webantic/nginx-config-parser": "^1.3.0", "arangojs": "^7.3.0", "axios": "^0.21.1", @@ -270,6 +272,101 @@ "@octokit/openapi-types": "^5.3.2" } }, + "node_modules/@sentry/core": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.2.3.tgz", + "integrity": "sha512-GpfHoSJiXchVXgyaMWVtIPVw2t97KkD1OJ4JdL3/TeH3auX5XvsN5iHTk+x/Er8t13IpOnvidH1xWdV1dnax2w==", + "dependencies": { + "@sentry/hub": "6.2.3", + "@sentry/minimal": "6.2.3", + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/hub": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.2.3.tgz", + "integrity": "sha512-D5Horfo2l0p52S7KPvy7qwWNMrE4IsCN8ODbfcCsfJu7hEXJmItbkbohIVSqO5neukhn5nu+x8kyCe9Q5u1Q6g==", + "dependencies": { + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/minimal": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.2.3.tgz", + "integrity": "sha512-Gpn9x4NQAG7E94EK1+hAz9GUcYrffTuqJ/XgqvHYk0jsHZ6RfsXYrmBac0ZwUxOivMf2t0n5opK0v5rhMDfF2w==", + "dependencies": { + "@sentry/hub": "6.2.3", + "@sentry/types": "6.2.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/node": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.2.3.tgz", + "integrity": "sha512-MaT8Uj+dOi1FPR4GkRGoQwaqxWKtfz+KpZ2RUT+x6aMqE8nieDFKts0i7O2vALg7LbRFzVsDsvK2GWcunfYkpA==", + "dependencies": { + "@sentry/core": "6.2.3", + "@sentry/hub": "6.2.3", + "@sentry/tracing": "6.2.3", + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.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/tracing": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.2.3.tgz", + "integrity": "sha512-OnQZKp7qVera+Z4ly6hgybGgyf10p2VDXqwueXkMVeLD+PwlPG8a8NMpKkZ+QxwRbQbSFhRLQaib3NX34tusBQ==", + "dependencies": { + "@sentry/hub": "6.2.3", + "@sentry/minimal": "6.2.3", + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/types": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.2.3.tgz", + "integrity": "sha512-BpA+9FherWgYlkMD/82bGFh/gAqZNlZX5UE8vWLKyyzNyOEEz3v9ScxE8dOSWE4v5iXJR1O3jjxaTcRQxPVgCA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/@sentry/utils": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.2.3.tgz", + "integrity": "sha512-YnkJm97wSvck39eRpqWjIuuwbvzPilvAcMqhbUy9yK/UBQMDGUzAKCOKH40udw1DwMUCWjJ71mOCDgUorE4Fog==", + "dependencies": { + "@sentry/types": "6.2.3", + "tslib": "^1.9.3" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -310,6 +407,17 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -754,6 +862,14 @@ "node": ">=0.10.0" } }, + "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/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -1503,6 +1619,18 @@ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, + "node_modules/https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -1872,6 +2000,11 @@ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" }, + "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": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -2661,6 +2794,11 @@ "strip-bom": "^3.0.0" } }, + "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/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -3080,6 +3218,80 @@ "@octokit/openapi-types": "^5.3.2" } }, + "@sentry/core": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.2.3.tgz", + "integrity": "sha512-GpfHoSJiXchVXgyaMWVtIPVw2t97KkD1OJ4JdL3/TeH3auX5XvsN5iHTk+x/Er8t13IpOnvidH1xWdV1dnax2w==", + "requires": { + "@sentry/hub": "6.2.3", + "@sentry/minimal": "6.2.3", + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "tslib": "^1.9.3" + } + }, + "@sentry/hub": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.2.3.tgz", + "integrity": "sha512-D5Horfo2l0p52S7KPvy7qwWNMrE4IsCN8ODbfcCsfJu7hEXJmItbkbohIVSqO5neukhn5nu+x8kyCe9Q5u1Q6g==", + "requires": { + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "tslib": "^1.9.3" + } + }, + "@sentry/minimal": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.2.3.tgz", + "integrity": "sha512-Gpn9x4NQAG7E94EK1+hAz9GUcYrffTuqJ/XgqvHYk0jsHZ6RfsXYrmBac0ZwUxOivMf2t0n5opK0v5rhMDfF2w==", + "requires": { + "@sentry/hub": "6.2.3", + "@sentry/types": "6.2.3", + "tslib": "^1.9.3" + } + }, + "@sentry/node": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.2.3.tgz", + "integrity": "sha512-MaT8Uj+dOi1FPR4GkRGoQwaqxWKtfz+KpZ2RUT+x6aMqE8nieDFKts0i7O2vALg7LbRFzVsDsvK2GWcunfYkpA==", + "requires": { + "@sentry/core": "6.2.3", + "@sentry/hub": "6.2.3", + "@sentry/tracing": "6.2.3", + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "cookie": "^0.4.1", + "https-proxy-agent": "^5.0.0", + "lru_map": "^0.3.3", + "tslib": "^1.9.3" + } + }, + "@sentry/tracing": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.2.3.tgz", + "integrity": "sha512-OnQZKp7qVera+Z4ly6hgybGgyf10p2VDXqwueXkMVeLD+PwlPG8a8NMpKkZ+QxwRbQbSFhRLQaib3NX34tusBQ==", + "requires": { + "@sentry/hub": "6.2.3", + "@sentry/minimal": "6.2.3", + "@sentry/types": "6.2.3", + "@sentry/utils": "6.2.3", + "tslib": "^1.9.3" + } + }, + "@sentry/types": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.2.3.tgz", + "integrity": "sha512-BpA+9FherWgYlkMD/82bGFh/gAqZNlZX5UE8vWLKyyzNyOEEz3v9ScxE8dOSWE4v5iXJR1O3jjxaTcRQxPVgCA==" + }, + "@sentry/utils": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.2.3.tgz", + "integrity": "sha512-YnkJm97wSvck39eRpqWjIuuwbvzPilvAcMqhbUy9yK/UBQMDGUzAKCOKH40udw1DwMUCWjJ71mOCDgUorE4Fog==", + "requires": { + "@sentry/types": "6.2.3", + "tslib": "^1.9.3" + } + }, "@types/json5": { "version": "0.0.29", "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", @@ -3112,6 +3324,14 @@ "dev": true, "requires": {} }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "requires": { + "debug": "4" + } + }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -3444,6 +3664,11 @@ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", "dev": true }, + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -4026,6 +4251,15 @@ "integrity": "sha512-f/wzC2QaWBs7t9IYqB4T3sR1xviIViXJRJTWBlx2Gf3g0Xi5vI7Yy4koXQ1c9OYDGHN9sBy1DQ2AB8fqZBWhUg==", "dev": true }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "requires": { + "agent-base": "6", + "debug": "4" + } + }, "ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", @@ -4293,6 +4527,11 @@ "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", "integrity": "sha1-soqmKIorn8ZRA1x3EfZathkDMaY=" }, + "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": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -4894,6 +5133,11 @@ "strip-bom": "^3.0.0" } }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, "type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", diff --git a/package.json b/package.json index 7af040b..17bca53 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,8 @@ "dependencies": { "@lifeomic/attempt": "^3.0.0", "@octokit/rest": "^18.3.5", + "@sentry/node": "^6.2.3", + "@sentry/tracing": "^6.2.3", "@webantic/nginx-config-parser": "^1.3.0", "arangojs": "^7.3.0", "axios": "^0.21.1",