From 40a84c20af8d1c27fbfe1b1b19f9a5b9cce4753f Mon Sep 17 00:00:00 2001 From: Max Eliseev Date: Thu, 7 Jul 2022 20:20:13 +0500 Subject: [PATCH] =?UTF-8?q?feat:=20=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0?= =?UTF-8?q?=D0=BB=D0=B7=D0=B0=D1=86=D0=B8=D1=8F=20@sentry/next=20=D0=B8?= =?UTF-8?q?=D0=B7=20=D0=BC=D0=BE=D0=BD=D0=B8=D1=82=D0=BE=D1=80=D0=B8=D0=BD?= =?UTF-8?q?=D0=B3=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- next.config.js | 5 +- package-lock.json | 486 ++----------------- package.json | 2 +- src/monitoring.ts => sentry.client.config.ts | 6 +- sentry.server.config.ts | 33 ++ src/pages/_app.tsx | 1 - src/pages/api/test.ts | 12 + tsconfig.json | 8 +- 8 files changed, 97 insertions(+), 456 deletions(-) rename src/monitoring.ts => sentry.client.config.ts (76%) create mode 100644 sentry.server.config.ts create mode 100644 src/pages/api/test.ts diff --git a/next.config.js b/next.config.js index fb8d7fb..c8a19cb 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,4 @@ const {withAxiom} = require('next-axiom'); +const {withSentryConfig} = require("@gooditworks/monitoring/next") -module.exports = withAxiom({ - -}) +module.exports = withSentryConfig(withAxiom({})) diff --git a/package-lock.json b/package-lock.json index a2cca5f..712bdef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "@gooditworks/monitoring": "^1.3.0", + "@gooditworks/monitoring": "file:../shared/packages/monitoring", "classnames": "2.3.1", "next": "12.2.0", "next-axiom": "0.10.0", @@ -57,6 +57,23 @@ "node": ">=14.0.0" } }, + "../shared/monitroig": { + "extraneous": true + }, + "../shared/monitroing": { + "extraneous": true + }, + "../shared/packages/monitoring": { + "name": "@gooditworks/monitoring", + "version": "1.3.0", + "license": "MIT", + "dependencies": { + "@logdna/logger": "^2.6.6", + "@sentry/browser": "^7.5.1", + "@sentry/nextjs": "^7.5.1", + "@sentry/node": "^7.5.1" + } + }, "node_modules/@arkweid/lefthook": { "version": "0.7.7", "resolved": "https://registry.npmjs.org/@arkweid/lefthook/-/lefthook-0.7.7.tgz", @@ -1036,15 +1053,8 @@ } }, "node_modules/@gooditworks/monitoring": { - "version": "1.3.0", - "resolved": "https://npm.pkg.github.com/download/@gooditworks/monitoring/1.3.0/13814524dc12e2a357e28398ca661553e00230bd02d2b8126a328f3f329dd8c9", - "integrity": "sha512-DuxAYUQ1iXuVVtTjtYBBFISyIarmFpC2+f7V5XWvRnVEBmVNmy6w7MCm/B7X4IltTU/+7R1u8lrGhsjFrccn8Q==", - "license": "MIT", - "dependencies": { - "@logdna/logger": "^2.3.2", - "@sentry/browser": "^6.11.0", - "@sentry/node": "^6.11.0" - } + "resolved": "../shared/packages/monitoring", + "link": true }, "node_modules/@humanwhocodes/config-array": { "version": "0.9.2", @@ -1516,23 +1526,6 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "node_modules/@logdna/logger": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@logdna/logger/-/logger-2.4.1.tgz", - "integrity": "sha512-2CG0y4W6Isdg9kC5GfXHTdox9QYNVP8073gmRp6GTWIC+mdywRRC4K0KBUgd7gMU2tIbsvi2NjgBJUWX2HKofg==", - "dependencies": { - "@logdna/stdlib": "^1.1.5", - "agentkeepalive": "^4.1.3", - "axios": "^0.21.1", - "https-proxy-agent": "^5.0.0", - "json-stringify-safe": "^5.0.1" - } - }, - "node_modules/@logdna/stdlib": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@logdna/stdlib/-/stdlib-1.1.5.tgz", - "integrity": "sha512-SFSLi7TT260tDPRVKpSvbDrYwJSbD+b9zpuf2YdPOBqJjvt5LUbFCur/RJ+whaNArguZhgdi/Lv7aR12T7aCBQ==" - }, "node_modules/@next/env": { "version": "12.2.0", "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.0.tgz", @@ -1819,150 +1812,6 @@ "integrity": "sha512-WiBSI6JBIhC6LRIsB2Kwh8DsGTlbBU+mLRxJmAe3LjHTdkDpwIbEOZgoXBbZilk/vlfjK8i6nKRAvIRn1XaIMw==", "dev": true }, - "node_modules/@sentry/browser": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-6.13.3.tgz", - "integrity": "sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ==", - "dependencies": { - "@sentry/core": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.3", - "tslib": "^1.9.3" - }, - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/browser/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/core": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.13.3.tgz", - "integrity": "sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA==", - "dependencies": { - "@sentry/hub": "6.13.3", - "@sentry/minimal": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.13.3.tgz", - "integrity": "sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw==", - "dependencies": { - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.13.3.tgz", - "integrity": "sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw==", - "dependencies": { - "@sentry/hub": "6.13.3", - "@sentry/types": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.13.3.tgz", - "integrity": "sha512-ZeZSw+TcPcf4e0j7iEqNMtoVmz+WFW/TEoGokXIwysZqSgchKdAXDHqn+CqUqFan7d76JcJmzztAUK2JruQ2Kg==", - "dependencies": { - "@sentry/core": "6.13.3", - "@sentry/hub": "6.13.3", - "@sentry/tracing": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, - "node_modules/@sentry/tracing": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.13.3.tgz", - "integrity": "sha512-yyOFIhqlprPM0g4f35Icear3eZk2mwyYcGEzljJfY2iU6pJwj1lzia5PfSwiCW7jFGMmlBJNhOAIpfhlliZi8Q==", - "dependencies": { - "@sentry/hub": "6.13.3", - "@sentry/minimal": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.13.3.tgz", - "integrity": "sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A==", - "engines": { - "node": ">=6" - } - }, - "node_modules/@sentry/utils": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.13.3.tgz", - "integrity": "sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag==", - "dependencies": { - "@sentry/types": "6.13.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/@sinclair/typebox": { "version": "0.23.5", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz", @@ -2584,6 +2433,7 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, "dependencies": { "debug": "4" }, @@ -2591,19 +2441,6 @@ "node": ">= 6.0.0" } }, - "node_modules/agentkeepalive": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.1.4.tgz", - "integrity": "sha512-+V/rGa3EuU74H6wR04plBb7Ks10FbtUQgRj/FQOG7uUIEuaINI+AiqJR1k6t3SVNs7o7ZjIdus6706qqzVq8jQ==", - "dependencies": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - }, - "engines": { - "node": ">= 8.0.0" - } - }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -2825,14 +2662,6 @@ "node": ">=4" } }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, "node_modules/axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -3803,14 +3632,6 @@ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", "dev": true }, - "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/core-js-pure": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.19.3.tgz", @@ -4225,6 +4046,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "dependencies": { "ms": "2.1.2" }, @@ -4322,14 +4144,6 @@ "node": ">=0.4.0" } }, - "node_modules/depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", @@ -5764,25 +5578,6 @@ "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", "dev": true }, - "node_modules/follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -6338,6 +6133,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, "dependencies": { "agent-base": "6", "debug": "4" @@ -6355,14 +6151,6 @@ "node": ">=10.17.0" } }, - "node_modules/humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "dependencies": { - "ms": "^2.0.0" - } - }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -8107,7 +7895,8 @@ "node_modules/json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "node_modules/json5": { "version": "2.2.1", @@ -8358,11 +8147,6 @@ "loose-envify": "cli.js" } }, - "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", @@ -8736,7 +8520,8 @@ "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "node_modules/mute-stream": { "version": "0.0.7", @@ -12709,13 +12494,12 @@ } }, "@gooditworks/monitoring": { - "version": "1.3.0", - "resolved": "https://npm.pkg.github.com/download/@gooditworks/monitoring/1.3.0/13814524dc12e2a357e28398ca661553e00230bd02d2b8126a328f3f329dd8c9", - "integrity": "sha512-DuxAYUQ1iXuVVtTjtYBBFISyIarmFpC2+f7V5XWvRnVEBmVNmy6w7MCm/B7X4IltTU/+7R1u8lrGhsjFrccn8Q==", + "version": "file:../shared/packages/monitoring", "requires": { - "@logdna/logger": "^2.3.2", - "@sentry/browser": "^6.11.0", - "@sentry/node": "^6.11.0" + "@logdna/logger": "^2.6.6", + "@sentry/browser": "^7.5.1", + "@sentry/nextjs": "^7.5.1", + "@sentry/node": "^7.5.1" } }, "@humanwhocodes/config-array": { @@ -13083,23 +12867,6 @@ "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "@logdna/logger": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/@logdna/logger/-/logger-2.4.1.tgz", - "integrity": "sha512-2CG0y4W6Isdg9kC5GfXHTdox9QYNVP8073gmRp6GTWIC+mdywRRC4K0KBUgd7gMU2tIbsvi2NjgBJUWX2HKofg==", - "requires": { - "@logdna/stdlib": "^1.1.5", - "agentkeepalive": "^4.1.3", - "axios": "^0.21.1", - "https-proxy-agent": "^5.0.0", - "json-stringify-safe": "^5.0.1" - } - }, - "@logdna/stdlib": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@logdna/stdlib/-/stdlib-1.1.5.tgz", - "integrity": "sha512-SFSLi7TT260tDPRVKpSvbDrYwJSbD+b9zpuf2YdPOBqJjvt5LUbFCur/RJ+whaNArguZhgdi/Lv7aR12T7aCBQ==" - }, "@next/env": { "version": "12.2.0", "resolved": "https://registry.npmjs.org/@next/env/-/env-12.2.0.tgz", @@ -13250,140 +13017,6 @@ "integrity": "sha512-WiBSI6JBIhC6LRIsB2Kwh8DsGTlbBU+mLRxJmAe3LjHTdkDpwIbEOZgoXBbZilk/vlfjK8i6nKRAvIRn1XaIMw==", "dev": true }, - "@sentry/browser": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-6.13.3.tgz", - "integrity": "sha512-jwlpsk2/u1cofvfYsjmqcnx50JJtf/T6HTgdW+ih8+rqWC5ABEZf4IiB/H+KAyjJ3wVzCOugMq5irL83XDCfqQ==", - "requires": { - "@sentry/core": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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/core": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-6.13.3.tgz", - "integrity": "sha512-obm3SjgCk8A7nB37b2AU1eq1q7gMoJRrGMv9VRIyfcG0Wlz/5lJ9O3ohUk+YZaaVfZMxXn6hFtsBiOWmlv7IIA==", - "requires": { - "@sentry/hub": "6.13.3", - "@sentry/minimal": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/hub/-/hub-6.13.3.tgz", - "integrity": "sha512-eYppBVqvhs5cvm33snW2sxfcw6G20/74RbBn+E4WDo15hozis89kU7ZCJDOPkXuag3v1h9igns/kM6PNBb41dw==", - "requires": { - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/minimal/-/minimal-6.13.3.tgz", - "integrity": "sha512-63MlYYRni3fs5Bh8XBAfVZ+ctDdWg0fapSTP1ydIC37fKvbE+5zhyUqwrEKBIiclEApg1VKX7bkKxVdu/vsFdw==", - "requires": { - "@sentry/hub": "6.13.3", - "@sentry/types": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/node/-/node-6.13.3.tgz", - "integrity": "sha512-ZeZSw+TcPcf4e0j7iEqNMtoVmz+WFW/TEoGokXIwysZqSgchKdAXDHqn+CqUqFan7d76JcJmzztAUK2JruQ2Kg==", - "requires": { - "@sentry/core": "6.13.3", - "@sentry/hub": "6.13.3", - "@sentry/tracing": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.3", - "cookie": "^0.4.1", - "https-proxy-agent": "^5.0.0", - "lru_map": "^0.3.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/tracing": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/tracing/-/tracing-6.13.3.tgz", - "integrity": "sha512-yyOFIhqlprPM0g4f35Icear3eZk2mwyYcGEzljJfY2iU6pJwj1lzia5PfSwiCW7jFGMmlBJNhOAIpfhlliZi8Q==", - "requires": { - "@sentry/hub": "6.13.3", - "@sentry/minimal": "6.13.3", - "@sentry/types": "6.13.3", - "@sentry/utils": "6.13.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.13.3", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-6.13.3.tgz", - "integrity": "sha512-Vrz5CdhaTRSvCQjSyIFIaV9PodjAVFkzJkTRxyY7P77RcegMsRSsG1yzlvCtA99zG9+e6MfoJOgbOCwuZids5A==" - }, - "@sentry/utils": { - "version": "6.13.3", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-6.13.3.tgz", - "integrity": "sha512-zYFuFH3MaYtBZTeJ4Yajg7pDf0pM3MWs3+9k5my9Fd+eqNcl7dYQYJbT9gyC0HXK1QI4CAMNNlHNl4YXhF91ag==", - "requires": { - "@sentry/types": "6.13.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==" - } - } - }, "@sinclair/typebox": { "version": "0.23.5", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.23.5.tgz", @@ -13880,20 +13513,11 @@ "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, "requires": { "debug": "4" } }, - "agentkeepalive": { - "version": "4.1.4", - "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.1.4.tgz", - "integrity": "sha512-+V/rGa3EuU74H6wR04plBb7Ks10FbtUQgRj/FQOG7uUIEuaINI+AiqJR1k6t3SVNs7o7ZjIdus6706qqzVq8jQ==", - "requires": { - "debug": "^4.1.0", - "depd": "^1.1.2", - "humanize-ms": "^1.2.1" - } - }, "ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -14047,14 +13671,6 @@ "integrity": "sha512-WKTW1+xAzhMS5dJsxWkliixlO/PqC4VhmO9T4juNYcaTg9jzWiJsou6m5pxWYGfigWbwzJWeFY6z47a+4neRXA==", "dev": true }, - "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { - "follow-redirects": "^1.14.0" - } - }, "axobject-query": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz", @@ -14812,11 +14428,6 @@ } } }, - "cookie": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", - "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" - }, "core-js-pure": { "version": "3.19.3", "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.19.3.tgz", @@ -15128,6 +14739,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "dev": true, "requires": { "ms": "2.1.2" } @@ -15201,11 +14813,6 @@ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", "dev": true }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, "detect-file": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", @@ -16285,11 +15892,6 @@ "integrity": "sha512-JaTY/wtrcSyvXJl4IMFHPKyFur1sE9AUqc0QnhOaJ0CxHtAoIV8pYDzeEfAaNEtGkOfq4gr3LBFmdXW5mOQFnA==", "dev": true }, - "follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==" - }, "form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -16711,6 +16313,7 @@ "version": "5.0.0", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, "requires": { "agent-base": "6", "debug": "4" @@ -16722,14 +16325,6 @@ "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", "dev": true }, - "humanize-ms": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", - "requires": { - "ms": "^2.0.0" - } - }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -18047,7 +17642,8 @@ "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "dev": true }, "json5": { "version": "2.2.1", @@ -18241,11 +17837,6 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, - "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", @@ -18528,7 +18119,8 @@ "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true }, "mute-stream": { "version": "0.0.7", diff --git a/package.json b/package.json index 7a47f6a..6fba60d 100644 --- a/package.json +++ b/package.json @@ -64,7 +64,7 @@ "typescript": "4.7.4" }, "dependencies": { - "@gooditworks/monitoring": "^1.3.0", + "@gooditworks/monitoring": "file:../shared/packages/monitoring", "classnames": "2.3.1", "next": "12.2.0", "next-axiom": "0.10.0", diff --git a/src/monitoring.ts b/sentry.client.config.ts similarity index 76% rename from src/monitoring.ts rename to sentry.client.config.ts index 76ad714..b3b226e 100644 --- a/src/monitoring.ts +++ b/sentry.client.config.ts @@ -2,15 +2,15 @@ import initMonitoring from "@gooditworks/monitoring" import ConsoleTransport from "@gooditworks/monitoring/logger/transport/console" import ConsoleCapturer from "@gooditworks/monitoring/logger/capturer/console" -import SentryBrowserCapturer from "@gooditworks/monitoring/logger/capturer/sentryBrowser" +import SentryNextCapturer from "@gooditworks/monitoring/logger/capturer/sentryNext" -import env from "./env" +import env from "./src/env" const loggerTransports = [new ConsoleTransport()] const exceptionCapturers = [new ConsoleCapturer()] if (env.sentryDsn && typeof window !== "undefined") { - const sentryCapturer = new SentryBrowserCapturer({ + const sentryCapturer = new SentryNextCapturer({ dsn: env.sentryDsn, environment: env.sentryEnv }) diff --git a/sentry.server.config.ts b/sentry.server.config.ts new file mode 100644 index 0000000..42ca9f9 --- /dev/null +++ b/sentry.server.config.ts @@ -0,0 +1,33 @@ +import initMonitoring from "@gooditworks/monitoring" + +import ConsoleTransport from "@gooditworks/monitoring/logger/transport/console" +import ConsoleCapturer from "@gooditworks/monitoring/logger/capturer/console" +import SentryNextCapturer from "@gooditworks/monitoring/logger/capturer/sentryNext" +import LogdnaTransport from "@gooditworks/monitoring/logger/transport/logdnaNode" + +import env from "./src/env" + +const loggerTransports = [new ConsoleTransport()] +const exceptionCapturers = [new ConsoleCapturer()] + +if (env.sentryDsn && typeof window !== "undefined") { + const sentryCapturer = new SentryNextCapturer({ + dsn: env.sentryDsn, + environment: env.sentryEnv + }) + + exceptionCapturers.push(sentryCapturer) +} + +if (env.logdnaKey) { + const logdnaTransport = new LogdnaTransport(env.logdnaKey, {app: env.logdnaApp}) + + loggerTransports.push(logdnaTransport) +} + +initMonitoring({ + logger: { + loggerTransports, + exceptionCapturers + } +}) diff --git a/src/pages/_app.tsx b/src/pages/_app.tsx index 607a80b..37b2745 100644 --- a/src/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -1,6 +1,5 @@ import {AppProps} from "next/app" -import "../monitoring" import ErrorCapturer from "components/ErrorCapturer" import "styles/globals.css" diff --git a/src/pages/api/test.ts b/src/pages/api/test.ts new file mode 100644 index 0000000..49ad1d2 --- /dev/null +++ b/src/pages/api/test.ts @@ -0,0 +1,12 @@ +import {NextApiHandler} from "next" +import {withSentry} from "@gooditworks/monitoring/next" + +const testHandler: NextApiHandler = (request, response) => { + if (request.query.throw) { + throw new Error(`triggered test exception: ${request.query.throw}`) + } + + return response.status(200).json({success: true}) +} + +export default withSentry(testHandler) diff --git a/tsconfig.json b/tsconfig.json index de0ce33..caa9da1 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,5 +1,11 @@ { - "include": ["src/**/*", "next-env.d.ts", "playwright.config.ts", "./tests/**/*.ts"], + "include": [ + "src/**/*", + "next-env.d.ts", + "playwright.config.ts", + "./tests/**/*.ts", + "./sentry.*.config.ts" + ], "exclude": ["node_modules"], "compilerOptions": { "paths": {