@verii/error-aggregation 1.0.0-pre.1756100765 → 1.0.0-pre.1756238035
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +0 -1
- package/package.json +8 -5
- package/src/sentry.js +14 -8
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/error-aggregation",
|
|
3
|
-
"version": "1.0.0-pre.
|
|
3
|
+
"version": "1.0.0-pre.1756238035",
|
|
4
4
|
"description": "Aggregation of errors",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "index.js",
|
|
7
|
+
"type": "commonjs",
|
|
7
8
|
"license": "Apache-2.0",
|
|
8
9
|
"publishConfig": {
|
|
9
10
|
"access": "public"
|
|
10
11
|
},
|
|
11
12
|
"scripts": {
|
|
12
|
-
"test": "
|
|
13
|
-
"
|
|
13
|
+
"test": "cross-env NODE_ENV=test node --test --test-concurrency=1 --experimental-test-module-mocks --experimental-test-coverage --test-reporter=spec --test-reporter-destination=stdout 'test/**/*.test.js'",
|
|
14
|
+
"test:ci": "NODE_ENV=test node --test --test-concurrency=1 --experimental-test-module-mocks --experimental-test-coverage --test-coverage-include='src/**' --test-reporter=spec --test-reporter=junit --test-reporter-destination=stdout --test-reporter-destination=test-results.junit.xml --test-reporter=lcov --test-reporter-destination=lcov.info 'test/**/*.test.js'",
|
|
15
|
+
"lint": "eslint --ext .js .",
|
|
16
|
+
"lint:ci": "eslint . --format json >> eslint-results.json",
|
|
14
17
|
"lint:fix": "eslint --fix --ext .js ."
|
|
15
18
|
},
|
|
16
19
|
"dependencies": {
|
|
@@ -29,7 +32,7 @@
|
|
|
29
32
|
"eslint-plugin-prefer-arrow-functions": "3.6.2",
|
|
30
33
|
"eslint-plugin-prettier": "4.2.5",
|
|
31
34
|
"eslint-watch": "7.0.0",
|
|
32
|
-
"
|
|
35
|
+
"expect": "29.7.0",
|
|
33
36
|
"prettier": "2.8.8"
|
|
34
37
|
},
|
|
35
38
|
"nx": {
|
|
@@ -37,5 +40,5 @@
|
|
|
37
40
|
"lib"
|
|
38
41
|
]
|
|
39
42
|
},
|
|
40
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "db672969d99d255588914ede4c14c894931b507e"
|
|
41
44
|
}
|
package/src/sentry.js
CHANGED
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const Sentry = require('@sentry/node');
|
|
18
|
-
|
|
19
17
|
const buildProfilingOptions = (enableProfiling) => {
|
|
20
18
|
if (process.env.NODE_ENV != null && enableProfiling) {
|
|
21
19
|
const { nodeProfilingIntegration } = require('@sentry/profiling-node');
|
|
@@ -29,7 +27,15 @@ const buildProfilingOptions = (enableProfiling) => {
|
|
|
29
27
|
integrations: [],
|
|
30
28
|
};
|
|
31
29
|
};
|
|
32
|
-
const initSentry = ({
|
|
30
|
+
const initSentry = async ({
|
|
31
|
+
dsn,
|
|
32
|
+
enableProfiling,
|
|
33
|
+
release,
|
|
34
|
+
environment,
|
|
35
|
+
debug,
|
|
36
|
+
}) => {
|
|
37
|
+
const Sentry = await import('@sentry/node');
|
|
38
|
+
|
|
33
39
|
Sentry.init({
|
|
34
40
|
dsn,
|
|
35
41
|
...buildProfilingOptions(enableProfiling),
|
|
@@ -40,8 +46,8 @@ const initSentry = ({ dsn, enableProfiling, release, environment, debug }) => {
|
|
|
40
46
|
return Sentry;
|
|
41
47
|
};
|
|
42
48
|
|
|
43
|
-
const initStartProfiling = (enableProfiling) =>
|
|
44
|
-
enableProfiling ?
|
|
49
|
+
const initStartProfiling = (sentry, enableProfiling) =>
|
|
50
|
+
enableProfiling ? sentry.startTransaction : () => undefined;
|
|
45
51
|
|
|
46
52
|
const finishProfiling = (transaction) => {
|
|
47
53
|
if (transaction) {
|
|
@@ -49,7 +55,7 @@ const finishProfiling = (transaction) => {
|
|
|
49
55
|
}
|
|
50
56
|
};
|
|
51
57
|
|
|
52
|
-
const initSendError = ({
|
|
58
|
+
const initSendError = async ({
|
|
53
59
|
dsn,
|
|
54
60
|
enableProfiling,
|
|
55
61
|
release,
|
|
@@ -57,7 +63,7 @@ const initSendError = ({
|
|
|
57
63
|
debug = false,
|
|
58
64
|
} = {}) => {
|
|
59
65
|
if (dsn) {
|
|
60
|
-
const sentry = initSentry({
|
|
66
|
+
const sentry = await initSentry({
|
|
61
67
|
dsn,
|
|
62
68
|
enableProfiling,
|
|
63
69
|
release,
|
|
@@ -72,7 +78,7 @@ const initSendError = ({
|
|
|
72
78
|
}
|
|
73
79
|
sentry.captureException(error);
|
|
74
80
|
},
|
|
75
|
-
startProfiling: initStartProfiling(enableProfiling),
|
|
81
|
+
startProfiling: initStartProfiling(sentry, enableProfiling),
|
|
76
82
|
finishProfiling,
|
|
77
83
|
};
|
|
78
84
|
}
|