@monoscopetech/browser 0.2.1 → 0.2.2
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/dist/replay.js
CHANGED
|
@@ -7,6 +7,7 @@ export class MonoscopeReplay {
|
|
|
7
7
|
this.save = this.save.bind(this);
|
|
8
8
|
this.events = [];
|
|
9
9
|
this.configure = this.configure.bind(this);
|
|
10
|
+
window.addEventListener("unload", () => this.save());
|
|
10
11
|
}
|
|
11
12
|
configure() {
|
|
12
13
|
rrweb.record({
|
|
@@ -21,15 +22,16 @@ export class MonoscopeReplay {
|
|
|
21
22
|
return;
|
|
22
23
|
let { replayEventsBaseUrl, projectId } = this.config;
|
|
23
24
|
if (!replayEventsBaseUrl) {
|
|
24
|
-
replayEventsBaseUrl = `https://app.apitoolkit.io/
|
|
25
|
+
replayEventsBaseUrl = `https://app.apitoolkit.io/rrweb/${projectId}`;
|
|
25
26
|
}
|
|
26
27
|
else {
|
|
27
|
-
replayEventsBaseUrl = `${replayEventsBaseUrl}/
|
|
28
|
+
replayEventsBaseUrl = `${replayEventsBaseUrl}/rrweb/${projectId}`;
|
|
28
29
|
}
|
|
29
30
|
const events = this.events;
|
|
30
31
|
this.events = [];
|
|
31
32
|
const body = JSON.stringify({ events, sessionId: this.sessionId });
|
|
32
33
|
fetch(replayEventsBaseUrl, {
|
|
34
|
+
mode: "no-cors",
|
|
33
35
|
method: "POST",
|
|
34
36
|
headers: {
|
|
35
37
|
"Content-Type": "application/json",
|
package/dist/tracing.js
CHANGED
|
@@ -18,7 +18,7 @@ export const configureOpenTelemetry = (config, sessionId) => {
|
|
|
18
18
|
...(resourceAttributes || {}),
|
|
19
19
|
});
|
|
20
20
|
const otlpExporter = new OTLPTraceExporter({
|
|
21
|
-
url: config.exporterEndpoint || "http://otelcol.apitoolkit.io:4318",
|
|
21
|
+
url: config.exporterEndpoint || "http://otelcol.apitoolkit.io:4318/v1/traces",
|
|
22
22
|
headers: {},
|
|
23
23
|
});
|
|
24
24
|
const provider = new WebTracerProvider({
|
|
@@ -30,6 +30,10 @@ export const configureOpenTelemetry = (config, sessionId) => {
|
|
|
30
30
|
propagator: new W3CTraceContextPropagator(),
|
|
31
31
|
});
|
|
32
32
|
const headerUrls = propagateTraceHeaderCorsUrls || [/^https?:\/\/.*/];
|
|
33
|
+
const ignoreUrls = [
|
|
34
|
+
/^https?:\/\/(?:[^\/]+\.)?apitoolkit\.io\//,
|
|
35
|
+
/^https?:\/\/(?:[^\/]+\.)?monoscope\.tech\//,
|
|
36
|
+
];
|
|
33
37
|
registerInstrumentations({
|
|
34
38
|
tracerProvider: provider,
|
|
35
39
|
instrumentations: [
|
|
@@ -49,12 +53,14 @@ export const configureOpenTelemetry = (config, sessionId) => {
|
|
|
49
53
|
}),
|
|
50
54
|
new XMLHttpRequestInstrumentation({
|
|
51
55
|
propagateTraceHeaderCorsUrls: headerUrls,
|
|
56
|
+
ignoreUrls,
|
|
52
57
|
applyCustomAttributesOnSpan: (span, xhr) => {
|
|
53
58
|
span.setAttribute("session.id", SESSION_ID);
|
|
54
59
|
},
|
|
55
60
|
}),
|
|
56
61
|
new FetchInstrumentation({
|
|
57
62
|
propagateTraceHeaderCorsUrls: headerUrls,
|
|
63
|
+
ignoreUrls,
|
|
58
64
|
applyCustomAttributesOnSpan: (span, request) => {
|
|
59
65
|
span.setAttribute("session.id", SESSION_ID);
|
|
60
66
|
},
|
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoscopetech/browser",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"unpkg": "dis/monoscopetech-browser.umd.js",
|
|
8
|
+
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "rollup -c",
|
|
11
|
+
"lint": "eslint src --ext .ts"
|
|
12
|
+
},
|
|
7
13
|
"dependencies": {
|
|
8
14
|
"@opentelemetry/context-zone": "^2.0.1",
|
|
9
15
|
"@opentelemetry/core": "^2.0.1",
|
|
@@ -41,9 +47,5 @@
|
|
|
41
47
|
"rollup": "^4.0.0",
|
|
42
48
|
"tslib": "^2.8.1",
|
|
43
49
|
"typescript": "^5.0.0"
|
|
44
|
-
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "rollup -c",
|
|
47
|
-
"lint": "eslint src --ext .ts"
|
|
48
50
|
}
|
|
49
|
-
}
|
|
51
|
+
}
|