@verii/error-aggregation 1.1.0-pre.1776306480 → 1.1.0-pre.1776374610
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/package.json +2 -5
- package/src/sentry.js +2 -43
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verii/error-aggregation",
|
|
3
|
-
"version": "1.1.0-pre.
|
|
3
|
+
"version": "1.1.0-pre.1776374610",
|
|
4
4
|
"description": "Aggregation of errors",
|
|
5
5
|
"repository": "https://github.com/LFDT-Verii/core",
|
|
6
6
|
"main": "index.js",
|
|
@@ -19,9 +19,6 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@sentry/node": "^8.0.0"
|
|
21
21
|
},
|
|
22
|
-
"optionalDependencies": {
|
|
23
|
-
"@sentry/profiling-node": "^8.0.0"
|
|
24
|
-
},
|
|
25
22
|
"devDependencies": {
|
|
26
23
|
"eslint": "9.39.4",
|
|
27
24
|
"eslint-config-airbnb-extended": "3.0.1",
|
|
@@ -41,5 +38,5 @@
|
|
|
41
38
|
"lib"
|
|
42
39
|
]
|
|
43
40
|
},
|
|
44
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "660d22eab5ea28cf9c744dff3d924e96f063f17d"
|
|
45
42
|
}
|
package/src/sentry.js
CHANGED
|
@@ -14,62 +14,25 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
if (process.env.NODE_ENV != null && enableProfiling) {
|
|
19
|
-
const { nodeProfilingIntegration } = require('@sentry/profiling-node');
|
|
20
|
-
return {
|
|
21
|
-
tracesSampleRate: 1.0,
|
|
22
|
-
profilesSampleRate: 1.0,
|
|
23
|
-
integrations: [nodeProfilingIntegration()],
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
return {
|
|
27
|
-
integrations: [],
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
const initSentry = async ({
|
|
31
|
-
dsn,
|
|
32
|
-
enableProfiling,
|
|
33
|
-
release,
|
|
34
|
-
environment,
|
|
35
|
-
debug,
|
|
36
|
-
}) => {
|
|
17
|
+
const initSentry = async ({ dsn, release, environment, debug }) => {
|
|
37
18
|
const Sentry = await import('@sentry/node');
|
|
38
19
|
|
|
39
20
|
Sentry.init({
|
|
40
21
|
dsn,
|
|
41
|
-
...buildProfilingOptions(enableProfiling),
|
|
42
22
|
release,
|
|
43
23
|
environment,
|
|
44
24
|
debug,
|
|
45
25
|
});
|
|
46
26
|
return Sentry;
|
|
47
27
|
};
|
|
48
|
-
|
|
49
|
-
const initStartProfiling = (sentry, enableProfiling) =>
|
|
50
|
-
enableProfiling ? sentry.startTransaction : () => undefined;
|
|
51
|
-
|
|
52
|
-
const finishProfiling = (transaction) => {
|
|
53
|
-
if (transaction) {
|
|
54
|
-
transaction.finish();
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
28
|
const initSendError = async ({
|
|
59
29
|
dsn,
|
|
60
|
-
enableProfiling,
|
|
61
30
|
release,
|
|
62
31
|
environment,
|
|
63
32
|
debug = false,
|
|
64
33
|
} = {}) => {
|
|
65
34
|
if (dsn) {
|
|
66
|
-
const sentry = await initSentry({
|
|
67
|
-
dsn,
|
|
68
|
-
enableProfiling,
|
|
69
|
-
release,
|
|
70
|
-
environment,
|
|
71
|
-
debug,
|
|
72
|
-
});
|
|
35
|
+
const sentry = await initSentry({ dsn, release, environment, debug });
|
|
73
36
|
return {
|
|
74
37
|
sendError: (error) => {
|
|
75
38
|
const code = error?.status || error?.statusCode;
|
|
@@ -78,14 +41,10 @@ const initSendError = async ({
|
|
|
78
41
|
}
|
|
79
42
|
sentry.captureException(error);
|
|
80
43
|
},
|
|
81
|
-
startProfiling: initStartProfiling(sentry, enableProfiling),
|
|
82
|
-
finishProfiling,
|
|
83
44
|
};
|
|
84
45
|
}
|
|
85
46
|
return {
|
|
86
47
|
sendError: () => {},
|
|
87
|
-
startProfiling: () => {},
|
|
88
|
-
finishProfiling: () => {},
|
|
89
48
|
};
|
|
90
49
|
};
|
|
91
50
|
|