@voltro/plugin-sentry 0.85.0 → 0.86.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/CHANGELOG.md +666 -0
- package/THIRD-PARTY-NOTICES.md +5 -33
- package/dist/breadcrumbs.js +47 -0
- package/dist/{capture-DcovIn-Z.js → capture.js} +1 -1
- package/dist/dsn.js +17 -0
- package/dist/index.js +40 -81
- package/dist/server.js +45 -2
- package/dist/web.js +25 -47
- package/dist/webTrace.js +27 -0
- package/package.json +5 -5
- package/dist/server-DQn_uTTk.js +0 -57
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Third-Party Notices — @voltro/plugin-sentry
|
|
2
2
|
|
|
3
|
-
This package
|
|
3
|
+
This package uses the open-source software listed below. Each is the
|
|
4
4
|
property of its respective copyright holders and is used under the terms of
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/plugin-sentry itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (70 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -4804,34 +4804,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
4804
4804
|
SOFTWARE.
|
|
4805
4805
|
```
|
|
4806
4806
|
|
|
4807
|
-
## layerr@3.0.0
|
|
4808
|
-
|
|
4809
|
-
License: MIT
|
|
4810
|
-
|
|
4811
|
-
```
|
|
4812
|
-
MIT License
|
|
4813
|
-
|
|
4814
|
-
Copyright (c) 2020 Perry Mitchell
|
|
4815
|
-
|
|
4816
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4817
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
4818
|
-
in the Software without restriction, including without limitation the rights
|
|
4819
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
4820
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
4821
|
-
furnished to do so, subject to the following conditions:
|
|
4822
|
-
|
|
4823
|
-
The above copyright notice and this permission notice shall be included in all
|
|
4824
|
-
copies or substantial portions of the Software.
|
|
4825
|
-
|
|
4826
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
4827
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
4828
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
4829
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
4830
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
4831
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
4832
|
-
SOFTWARE.
|
|
4833
|
-
```
|
|
4834
|
-
|
|
4835
4807
|
## lib0@0.2.117
|
|
4836
4808
|
|
|
4837
4809
|
License: MIT
|
|
@@ -5289,14 +5261,14 @@ Apache License
|
|
|
5289
5261
|
limitations under the License.
|
|
5290
5262
|
```
|
|
5291
5263
|
|
|
5292
|
-
##
|
|
5264
|
+
## ulid@3.0.2
|
|
5293
5265
|
|
|
5294
5266
|
License: MIT
|
|
5295
5267
|
|
|
5296
5268
|
```
|
|
5297
|
-
MIT License
|
|
5269
|
+
The MIT License (MIT)
|
|
5298
5270
|
|
|
5299
|
-
Copyright (c)
|
|
5271
|
+
Copyright (c) 2017 Alizain Feerasta
|
|
5300
5272
|
|
|
5301
5273
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5302
5274
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//#region src/breadcrumbs.ts
|
|
2
|
+
var e = {
|
|
3
|
+
trace: "debug",
|
|
4
|
+
debug: "debug",
|
|
5
|
+
info: "info",
|
|
6
|
+
warn: "warning",
|
|
7
|
+
error: "error",
|
|
8
|
+
fatal: "fatal"
|
|
9
|
+
}, t = (t) => ({
|
|
10
|
+
timestamp: t.ts.getTime() / 1e3,
|
|
11
|
+
level: e[t.level] ?? "info",
|
|
12
|
+
...t.scope ? { category: t.scope } : {},
|
|
13
|
+
message: t.message,
|
|
14
|
+
...Object.keys(t.fields).length > 0 ? { data: { ...t.fields } } : {}
|
|
15
|
+
}), n = (e = {}, n = () => Date.now()) => {
|
|
16
|
+
let r = e.maxPerTrace ?? 50, i = e.maxTraces ?? 1e3, a = e.ttlMs ?? 3e5, o = /* @__PURE__ */ new Map(), s = () => {
|
|
17
|
+
let e = n() - a;
|
|
18
|
+
for (let [t, n] of o) if (n.at < e) o.delete(t);
|
|
19
|
+
else break;
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
add(e, a) {
|
|
23
|
+
s();
|
|
24
|
+
let c = o.get(e), l = c ?? {
|
|
25
|
+
at: n(),
|
|
26
|
+
crumbs: []
|
|
27
|
+
};
|
|
28
|
+
for (c && o.delete(e), l.at = n(), l.crumbs.push(t(a)), l.crumbs.length > r && l.crumbs.shift(), o.set(e, l); o.size > i;) {
|
|
29
|
+
let e = o.keys().next().value;
|
|
30
|
+
if (e === void 0) break;
|
|
31
|
+
o.delete(e);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
take(e) {
|
|
35
|
+
let t = o.get(e);
|
|
36
|
+
return o.delete(e), t ? t.crumbs : [];
|
|
37
|
+
},
|
|
38
|
+
drop(e) {
|
|
39
|
+
o.delete(e);
|
|
40
|
+
},
|
|
41
|
+
size() {
|
|
42
|
+
return o.size;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
//#endregion
|
|
47
|
+
export { n as makeBreadcrumbRing, t as toBreadcrumb };
|
|
@@ -40,4 +40,4 @@ var n = (t) => e.squash(t), r = (e, n, r = []) => {
|
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
//#endregion
|
|
43
|
-
export {
|
|
43
|
+
export { i as INFRASTRUCTURE_FAILURE_TAGS, r as captureServerError, c as captureToSentry, n as causeToError, a as isInfrastructureFailure, o as resolveCaptureFailures, s as shouldCapture };
|
package/dist/dsn.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/dsn.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
if (!e) return null;
|
|
4
|
+
try {
|
|
5
|
+
let t = new URL(e), n = t.username, r = t.pathname.split("/").filter(Boolean), i = r[r.length - 1];
|
|
6
|
+
return !n || !i ? null : {
|
|
7
|
+
protocol: t.protocol.replace(/:$/, ""),
|
|
8
|
+
publicKey: n,
|
|
9
|
+
host: t.host,
|
|
10
|
+
projectId: i
|
|
11
|
+
};
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { e as parseDsn };
|
package/dist/index.js
CHANGED
|
@@ -1,54 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
info: "info",
|
|
12
|
-
warn: "warning",
|
|
13
|
-
error: "error",
|
|
14
|
-
fatal: "fatal"
|
|
15
|
-
}, p = (e) => ({
|
|
16
|
-
timestamp: e.ts.getTime() / 1e3,
|
|
17
|
-
level: f[e.level] ?? "info",
|
|
18
|
-
...e.scope ? { category: e.scope } : {},
|
|
19
|
-
message: e.message,
|
|
20
|
-
...Object.keys(e.fields).length > 0 ? { data: { ...e.fields } } : {}
|
|
21
|
-
}), m = (e = {}, t = () => Date.now()) => {
|
|
22
|
-
let n = e.maxPerTrace ?? 50, r = e.maxTraces ?? 1e3, i = e.ttlMs ?? 3e5, a = /* @__PURE__ */ new Map(), o = () => {
|
|
23
|
-
let e = t() - i;
|
|
24
|
-
for (let [t, n] of a) if (n.at < e) a.delete(t);
|
|
25
|
-
else break;
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
add(e, i) {
|
|
29
|
-
o();
|
|
30
|
-
let s = a.get(e), c = s ?? {
|
|
31
|
-
at: t(),
|
|
32
|
-
crumbs: []
|
|
33
|
-
};
|
|
34
|
-
for (s && a.delete(e), c.at = t(), c.crumbs.push(p(i)), c.crumbs.length > n && c.crumbs.shift(), a.set(e, c); a.size > r;) {
|
|
35
|
-
let e = a.keys().next().value;
|
|
36
|
-
if (e === void 0) break;
|
|
37
|
-
a.delete(e);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
take(e) {
|
|
41
|
-
let t = a.get(e);
|
|
42
|
-
return a.delete(e), t ? t.crumbs : [];
|
|
43
|
-
},
|
|
44
|
-
drop(e) {
|
|
45
|
-
a.delete(e);
|
|
46
|
-
},
|
|
47
|
-
size() {
|
|
48
|
-
return a.size;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}, h = c([
|
|
1
|
+
import { parseDsn as e } from "./dsn.js";
|
|
2
|
+
import { makeBreadcrumbRing as t, toBreadcrumb as n } from "./breadcrumbs.js";
|
|
3
|
+
import { captureServerError as r, captureToSentry as i, causeToError as a, resolveCaptureFailures as o } from "./capture.js";
|
|
4
|
+
import { initSentryServer as s, sentryActiveFields as c } from "./server.js";
|
|
5
|
+
import { Effect as l } from "effect";
|
|
6
|
+
import { pluginEnv as u } from "@voltro/env";
|
|
7
|
+
import { addSink as d } from "@voltro/logger";
|
|
8
|
+
import { definePlugin as f, subscribeServerErrors as p } from "@voltro/protocol";
|
|
9
|
+
//#region src/index.ts
|
|
10
|
+
var m = u([
|
|
52
11
|
{
|
|
53
12
|
name: "SENTRY_DSN",
|
|
54
13
|
required: !1,
|
|
@@ -67,19 +26,19 @@ var f = {
|
|
|
67
26
|
secret: !1,
|
|
68
27
|
description: "Release identifier for Sentry release health + source maps."
|
|
69
28
|
}
|
|
70
|
-
]),
|
|
71
|
-
let
|
|
72
|
-
if (!
|
|
73
|
-
name:
|
|
29
|
+
]), h = (n = {}) => {
|
|
30
|
+
let a = m.read("SENTRY_DSN", n.dsn), u = e(a), h = n.name ? `@voltro/plugin-sentry#${n.name}` : "@voltro/plugin-sentry";
|
|
31
|
+
if (!u) return f({
|
|
32
|
+
name: h,
|
|
74
33
|
description: "Sentry error tracking (inactive — no valid SENTRY_DSN).",
|
|
75
|
-
onActivate: (e) =>
|
|
76
|
-
onDeactivate: () =>
|
|
34
|
+
onActivate: (e) => l.sync(() => e.logger.warn("sentry inactive — no valid DSN (set `dsn` or SENTRY_DSN)")),
|
|
35
|
+
onDeactivate: () => l.void
|
|
77
36
|
});
|
|
78
|
-
let g =
|
|
37
|
+
let g = m.read("SENTRY_ENVIRONMENT", n.environment), _ = m.read("SENTRY_RELEASE", n.release), v = n.tracesSampleRate ?? 1, y = n.traces ?? !0, b = n.captureFailures ?? !1, x = o(b), S = t({ maxPerTrace: n.maxBreadcrumbs ?? 50 }), C, w = (e, t) => {
|
|
79
38
|
if (C) try {
|
|
80
39
|
i(C, e, t, S.take(t.traceId), x);
|
|
81
40
|
} catch {}
|
|
82
|
-
}, T = (e, t) => e.pipe(
|
|
41
|
+
}, T = (e, t) => e.pipe(l.tapCause((e) => l.sync(() => w(e, {
|
|
83
42
|
tag: t.tag,
|
|
84
43
|
kind: t.kind,
|
|
85
44
|
subject: t.subject,
|
|
@@ -90,32 +49,32 @@ var f = {
|
|
|
90
49
|
"rpc:intercept:query",
|
|
91
50
|
"rpc:intercept:action",
|
|
92
51
|
"rpc:intercept:workflow",
|
|
93
|
-
`network:outbound:${
|
|
52
|
+
`network:outbound:${u.host}`
|
|
94
53
|
], D, O;
|
|
95
|
-
return
|
|
96
|
-
name:
|
|
54
|
+
return f({
|
|
55
|
+
name: h,
|
|
97
56
|
description: "Deep Sentry integration — trace-correlated errors, breadcrumbs, and controlled performance traces.",
|
|
98
57
|
permissions: E,
|
|
99
|
-
declaredEnv:
|
|
58
|
+
declaredEnv: m.declared,
|
|
100
59
|
interceptMutation: T,
|
|
101
60
|
interceptQuery: T,
|
|
102
61
|
interceptAction: T,
|
|
103
62
|
interceptWorkflow: T,
|
|
104
|
-
contributeObservability: async (
|
|
105
|
-
let
|
|
106
|
-
dsn:
|
|
63
|
+
contributeObservability: async (e) => {
|
|
64
|
+
let t = {
|
|
65
|
+
dsn: a,
|
|
107
66
|
environment: g,
|
|
108
67
|
release: _,
|
|
109
68
|
tracesSampleRate: v,
|
|
110
69
|
traces: y,
|
|
111
|
-
profiling:
|
|
112
|
-
profilesSampleRate:
|
|
113
|
-
init:
|
|
114
|
-
},
|
|
115
|
-
if (
|
|
116
|
-
let
|
|
117
|
-
if (
|
|
118
|
-
...
|
|
70
|
+
profiling: n.profiling,
|
|
71
|
+
profilesSampleRate: n.profilesSampleRate,
|
|
72
|
+
init: n.init
|
|
73
|
+
}, r = await s(t, e.logger);
|
|
74
|
+
if (r === void 0) return;
|
|
75
|
+
let i = r.sdk;
|
|
76
|
+
if (r.client, C = i, e.logger.info("sentry active", {
|
|
77
|
+
...c(r, t),
|
|
119
78
|
captureFailures: typeof b == "function" ? "predicate" : b
|
|
120
79
|
}), y) try {
|
|
121
80
|
let { SentrySpanProcessor: e } = await import("@sentry/opentelemetry");
|
|
@@ -127,21 +86,21 @@ var f = {
|
|
|
127
86
|
}
|
|
128
87
|
};
|
|
129
88
|
} catch {
|
|
130
|
-
|
|
89
|
+
e.logger.warn("sentry traces are on but @sentry/opentelemetry is not installed — no span export. Set `traces: false` to silence this, or install it (it is an optional dependency of @voltro/plugin-sentry).");
|
|
131
90
|
return;
|
|
132
91
|
}
|
|
133
92
|
},
|
|
134
|
-
onActivate: () =>
|
|
135
|
-
D =
|
|
93
|
+
onActivate: () => l.sync(() => {
|
|
94
|
+
D = d((e) => {
|
|
136
95
|
let t = e.fields.traceId;
|
|
137
96
|
typeof t == "string" && t.length > 0 && S.add(t, e);
|
|
138
|
-
}), O =
|
|
97
|
+
}), O = p((e) => {
|
|
139
98
|
if (C) try {
|
|
140
|
-
|
|
99
|
+
r(C, e, e.traceId ? S.take(e.traceId) : []);
|
|
141
100
|
} catch {}
|
|
142
101
|
});
|
|
143
102
|
}),
|
|
144
|
-
onDeactivate: () =>
|
|
103
|
+
onDeactivate: () => l.promise(async () => {
|
|
145
104
|
D?.(), D = void 0, O?.(), O = void 0;
|
|
146
105
|
try {
|
|
147
106
|
await (await import("@sentry/node")).close(2e3);
|
|
@@ -150,4 +109,4 @@ var f = {
|
|
|
150
109
|
});
|
|
151
110
|
};
|
|
152
111
|
//#endregion
|
|
153
|
-
export { i as captureToSentry, a as causeToError,
|
|
112
|
+
export { i as captureToSentry, a as causeToError, t as makeBreadcrumbRing, e as parseDsn, h as sentryPlugin, n as toBreadcrumb };
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { parseDsn as e } from "./dsn.js";
|
|
2
|
+
//#region src/server.ts
|
|
3
|
+
var t = async (t, n) => {
|
|
4
|
+
if (!e(t.dsn)) return;
|
|
5
|
+
let r;
|
|
6
|
+
try {
|
|
7
|
+
r = await import("@sentry/node");
|
|
8
|
+
} catch {
|
|
9
|
+
n.warn("sentry requested but @sentry/node is not installed — inactive");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let i = [];
|
|
13
|
+
if (t.profiling) try {
|
|
14
|
+
let { nodeProfilingIntegration: e } = await import("@sentry/profiling-node");
|
|
15
|
+
i.push(e());
|
|
16
|
+
} catch {
|
|
17
|
+
n.warn("sentry profiling requested but @sentry/profiling-node is not installed");
|
|
18
|
+
}
|
|
19
|
+
let { integrations: a, ...o } = t.init ?? {};
|
|
20
|
+
Array.isArray(a) && i.push(...a);
|
|
21
|
+
let s = t.tracesSampleRate ?? 1, c = t.traces ?? !0, l = r.init({
|
|
22
|
+
...o,
|
|
23
|
+
dsn: t.dsn,
|
|
24
|
+
skipOpenTelemetrySetup: !0,
|
|
25
|
+
tracesSampleRate: s,
|
|
26
|
+
...t.environment ? { environment: t.environment } : {},
|
|
27
|
+
...t.release ? { release: t.release } : {},
|
|
28
|
+
...t.profiling ? { profilesSampleRate: t.profilesSampleRate ?? 1 } : {},
|
|
29
|
+
...i.length > 0 ? { integrations: i } : {}
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
sdk: r,
|
|
33
|
+
client: l,
|
|
34
|
+
tracesEnabled: c,
|
|
35
|
+
tracesSampleRate: s
|
|
36
|
+
};
|
|
37
|
+
}, n = (e, t) => ({
|
|
38
|
+
environment: t.environment,
|
|
39
|
+
release: t.release,
|
|
40
|
+
traces: e.tracesEnabled,
|
|
41
|
+
profiling: !!t.profiling,
|
|
42
|
+
...e.tracesEnabled ? { tracesSampleRate: e.tracesSampleRate } : {}
|
|
43
|
+
});
|
|
44
|
+
//#endregion
|
|
45
|
+
export { t as initSentryServer, n as sentryActiveFields };
|
package/dist/web.js
CHANGED
|
@@ -1,56 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { reportClientError as
|
|
4
|
-
import { publicEnvSnapshot as
|
|
5
|
-
//#region src/
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
r.setTag("voltro.errorSource", n.source), n.pathname && r.setTag("route.pathname", n.pathname), n.componentStack && r.setContext("react", { componentStack: n.componentStack }), n.context && r.setContext("voltro", n.context), e.captureException(t(n.error));
|
|
9
|
-
});
|
|
10
|
-
}, s = (e, t) => {
|
|
11
|
-
e.startInactiveSpan({
|
|
12
|
-
name: `${t.source}.${t.tag}`,
|
|
13
|
-
op: `rpc.client.${t.source}`,
|
|
14
|
-
onlyIfParent: !0,
|
|
15
|
-
attributes: {
|
|
16
|
-
"rpc.tag": t.tag,
|
|
17
|
-
"voltro.source": t.source
|
|
18
|
-
},
|
|
19
|
-
links: [{
|
|
20
|
-
context: {
|
|
21
|
-
traceId: t.traceId,
|
|
22
|
-
spanId: t.spanId,
|
|
23
|
-
traceFlags: 1
|
|
24
|
-
},
|
|
25
|
-
attributes: { "voltro.link.type": "rpc.server-trace" }
|
|
26
|
-
}]
|
|
27
|
-
}).end();
|
|
28
|
-
}, c = (e) => e.source.startsWith("rpc.") && typeof e.error?._tag == "string", l = (e) => {
|
|
29
|
-
let t = a()[e];
|
|
1
|
+
import { resolveCaptureFailures as e } from "./capture.js";
|
|
2
|
+
import { captureClientError as t, recordClientTraceSpan as n } from "./webTrace.js";
|
|
3
|
+
import { reportClientError as r, subscribeClientErrors as i, subscribeClientTraces as a } from "@voltro/client";
|
|
4
|
+
import { publicEnvSnapshot as o } from "@voltro/env/public";
|
|
5
|
+
//#region src/web.ts
|
|
6
|
+
var s = (e) => e.source.startsWith("rpc.") && typeof e.error?._tag == "string", c = (e) => {
|
|
7
|
+
let t = o()[e];
|
|
30
8
|
return typeof t == "string" && t !== "" ? t : void 0;
|
|
31
|
-
}, u, d
|
|
9
|
+
}, l, u, d = async (r = {}) => {
|
|
32
10
|
if (typeof window > "u") return;
|
|
33
|
-
let
|
|
34
|
-
if (!
|
|
35
|
-
let
|
|
11
|
+
let o = r.dsn ?? c("VOLTRO_PUBLIC_SENTRY_DSN");
|
|
12
|
+
if (!o) return;
|
|
13
|
+
let d = r.environment ?? c("VOLTRO_PUBLIC_SENTRY_ENVIRONMENT"), p = r.release ?? c("VOLTRO_PUBLIC_SENTRY_RELEASE"), m = r.tracesSampleRate ?? 1, h = r.browserTracing !== !1, g = r.rpcSpans ?? h, _ = await import("@sentry/react");
|
|
36
14
|
_.init({
|
|
37
|
-
dsn:
|
|
15
|
+
dsn: o,
|
|
38
16
|
tracesSampleRate: m,
|
|
39
|
-
...
|
|
40
|
-
...
|
|
17
|
+
...d ? { environment: d } : {},
|
|
18
|
+
...p ? { release: p } : {},
|
|
41
19
|
integrations: h ? [_.browserTracingIntegration()] : []
|
|
42
20
|
});
|
|
43
21
|
let v = _;
|
|
44
|
-
|
|
22
|
+
l?.(), l = void 0, g && (l = a((e) => {
|
|
45
23
|
try {
|
|
46
|
-
|
|
24
|
+
n(v, e);
|
|
47
25
|
} catch {}
|
|
48
|
-
})),
|
|
49
|
-
let y = e(
|
|
50
|
-
|
|
26
|
+
})), u?.();
|
|
27
|
+
let y = e(r.captureFailures ?? !1);
|
|
28
|
+
u = i((e) => {
|
|
51
29
|
try {
|
|
52
|
-
if (
|
|
53
|
-
|
|
30
|
+
if (s(e) && !f(e.error, y)) return;
|
|
31
|
+
t(v, e);
|
|
54
32
|
} catch {}
|
|
55
33
|
}), console.info("[@voltro/plugin-sentry] browser active", {
|
|
56
34
|
tracesSampleRate: m,
|
|
@@ -58,15 +36,15 @@ var o = (e, n) => {
|
|
|
58
36
|
rpcSpans: g,
|
|
59
37
|
rpcSpanMode: g ? "page-child-with-server-link" : "off"
|
|
60
38
|
});
|
|
61
|
-
},
|
|
39
|
+
}, f = (e, t) => {
|
|
62
40
|
if (typeof t != "function") return t;
|
|
63
41
|
try {
|
|
64
42
|
return t(e);
|
|
65
43
|
} catch {
|
|
66
44
|
return !0;
|
|
67
45
|
}
|
|
68
|
-
},
|
|
69
|
-
|
|
46
|
+
}, p = () => {
|
|
47
|
+
l?.(), l = void 0, u?.(), u = void 0;
|
|
70
48
|
};
|
|
71
49
|
//#endregion
|
|
72
|
-
export {
|
|
50
|
+
export { t as captureClientError, p as closeSentryBrowser, d as initSentryBrowser, s as isDeclaredRpcFailure, n as recordClientTraceSpan, r as reportClientError };
|
package/dist/webTrace.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { reportableError as e } from "@voltro/protocol";
|
|
2
|
+
//#region src/webTrace.ts
|
|
3
|
+
var t = (t, n) => {
|
|
4
|
+
t.withScope((r) => {
|
|
5
|
+
r.setTag("voltro.errorSource", n.source), n.pathname && r.setTag("route.pathname", n.pathname), n.componentStack && r.setContext("react", { componentStack: n.componentStack }), n.context && r.setContext("voltro", n.context), t.captureException(e(n.error));
|
|
6
|
+
});
|
|
7
|
+
}, n = (e, t) => {
|
|
8
|
+
e.startInactiveSpan({
|
|
9
|
+
name: `${t.source}.${t.tag}`,
|
|
10
|
+
op: `rpc.client.${t.source}`,
|
|
11
|
+
onlyIfParent: !0,
|
|
12
|
+
attributes: {
|
|
13
|
+
"rpc.tag": t.tag,
|
|
14
|
+
"voltro.source": t.source
|
|
15
|
+
},
|
|
16
|
+
links: [{
|
|
17
|
+
context: {
|
|
18
|
+
traceId: t.traceId,
|
|
19
|
+
spanId: t.spanId,
|
|
20
|
+
traceFlags: 1
|
|
21
|
+
},
|
|
22
|
+
attributes: { "voltro.link.type": "rpc.server-trace" }
|
|
23
|
+
}]
|
|
24
|
+
}).end();
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { t as captureClientError, n as recordClientTraceSpan };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-sentry",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"description": "Deep Sentry integration — error tracking correlated to distributed traces, breadcrumbs from the framework log sink, controlled browser performance spans, and server traces routed from the framework's OTel tracer via @sentry/node in OTel-consumer mode.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"node": ">=24.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@voltro/client": "0.
|
|
47
|
-
"@voltro/env": "0.
|
|
48
|
-
"@voltro/logger": "0.
|
|
49
|
-
"@voltro/protocol": "0.
|
|
46
|
+
"@voltro/client": "0.86.0",
|
|
47
|
+
"@voltro/env": "0.86.0",
|
|
48
|
+
"@voltro/logger": "0.86.0",
|
|
49
|
+
"@voltro/protocol": "0.86.0"
|
|
50
50
|
},
|
|
51
51
|
"optionalDependencies": {
|
|
52
52
|
"@sentry/node": "^10.75.0",
|
package/dist/server-DQn_uTTk.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
//#region src/dsn.ts
|
|
2
|
-
var e = (e) => {
|
|
3
|
-
if (!e) return null;
|
|
4
|
-
try {
|
|
5
|
-
let t = new URL(e), n = t.username, r = t.pathname.split("/").filter(Boolean), i = r[r.length - 1];
|
|
6
|
-
return !n || !i ? null : {
|
|
7
|
-
protocol: t.protocol.replace(/:$/, ""),
|
|
8
|
-
publicKey: n,
|
|
9
|
-
host: t.host,
|
|
10
|
-
projectId: i
|
|
11
|
-
};
|
|
12
|
-
} catch {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
}, t = async (t, n) => {
|
|
16
|
-
if (!e(t.dsn)) return;
|
|
17
|
-
let r;
|
|
18
|
-
try {
|
|
19
|
-
r = await import("@sentry/node");
|
|
20
|
-
} catch {
|
|
21
|
-
n.warn("sentry requested but @sentry/node is not installed — inactive");
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
let i = [];
|
|
25
|
-
if (t.profiling) try {
|
|
26
|
-
let { nodeProfilingIntegration: e } = await import("@sentry/profiling-node");
|
|
27
|
-
i.push(e());
|
|
28
|
-
} catch {
|
|
29
|
-
n.warn("sentry profiling requested but @sentry/profiling-node is not installed");
|
|
30
|
-
}
|
|
31
|
-
let { integrations: a, ...o } = t.init ?? {};
|
|
32
|
-
Array.isArray(a) && i.push(...a);
|
|
33
|
-
let s = t.tracesSampleRate ?? 1, c = t.traces ?? !0, l = r.init({
|
|
34
|
-
...o,
|
|
35
|
-
dsn: t.dsn,
|
|
36
|
-
skipOpenTelemetrySetup: !0,
|
|
37
|
-
tracesSampleRate: s,
|
|
38
|
-
...t.environment ? { environment: t.environment } : {},
|
|
39
|
-
...t.release ? { release: t.release } : {},
|
|
40
|
-
...t.profiling ? { profilesSampleRate: t.profilesSampleRate ?? 1 } : {},
|
|
41
|
-
...i.length > 0 ? { integrations: i } : {}
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
sdk: r,
|
|
45
|
-
client: l,
|
|
46
|
-
tracesEnabled: c,
|
|
47
|
-
tracesSampleRate: s
|
|
48
|
-
};
|
|
49
|
-
}, n = (e, t) => ({
|
|
50
|
-
environment: t.environment,
|
|
51
|
-
release: t.release,
|
|
52
|
-
traces: e.tracesEnabled,
|
|
53
|
-
profiling: !!t.profiling,
|
|
54
|
-
...e.tracesEnabled ? { tracesSampleRate: e.tracesSampleRate } : {}
|
|
55
|
-
});
|
|
56
|
-
//#endregion
|
|
57
|
-
export { n, e as r, t };
|