@verii/error-aggregation 1.3.0-pre.1793010110.0 → 1.3.0-pre.1793083518.0
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 +1 -1
- package/src/sentry.js +21 -2
package/package.json
CHANGED
package/src/sentry.js
CHANGED
|
@@ -32,7 +32,18 @@ const dataCollection = {
|
|
|
32
32
|
graphQL: { document: false, variables: false },
|
|
33
33
|
};
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
// Tag every event with the server that sent it,
|
|
36
|
+
// so servers that share a Sentry project can be told apart.
|
|
37
|
+
const buildInitialScope = (serviceName) =>
|
|
38
|
+
serviceName ? { initialScope: { tags: { service: serviceName } } } : {};
|
|
39
|
+
|
|
40
|
+
const initSentry = async ({
|
|
41
|
+
dsn,
|
|
42
|
+
release,
|
|
43
|
+
environment,
|
|
44
|
+
debug,
|
|
45
|
+
serviceName,
|
|
46
|
+
}) => {
|
|
36
47
|
const Sentry = await import('@sentry/node');
|
|
37
48
|
|
|
38
49
|
Sentry.init({
|
|
@@ -41,6 +52,7 @@ const initSentry = async ({ dsn, release, environment, debug }) => {
|
|
|
41
52
|
environment,
|
|
42
53
|
debug,
|
|
43
54
|
dataCollection,
|
|
55
|
+
...buildInitialScope(serviceName),
|
|
44
56
|
});
|
|
45
57
|
return Sentry;
|
|
46
58
|
};
|
|
@@ -49,9 +61,16 @@ const initSendError = async ({
|
|
|
49
61
|
release,
|
|
50
62
|
environment,
|
|
51
63
|
debug = false,
|
|
64
|
+
serviceName,
|
|
52
65
|
} = {}) => {
|
|
53
66
|
if (dsn) {
|
|
54
|
-
const sentry = await initSentry({
|
|
67
|
+
const sentry = await initSentry({
|
|
68
|
+
dsn,
|
|
69
|
+
release,
|
|
70
|
+
environment,
|
|
71
|
+
debug,
|
|
72
|
+
serviceName,
|
|
73
|
+
});
|
|
55
74
|
return {
|
|
56
75
|
sendError: (error) => {
|
|
57
76
|
const code = error?.status || error?.statusCode;
|