autotel-devtools 8.1.0 → 8.1.1
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/cli.cjs +22 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +22 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -2
- package/dist/index.js.map +1 -1
- package/dist/server/index.cjs +22 -2
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +22 -2
- package/dist/server/index.js.map +1 -1
- package/dist/widget.global.js +10 -10
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -445,6 +445,7 @@ var DevtoolsServer = class {
|
|
|
445
445
|
}
|
|
446
446
|
addTrace(trace) {
|
|
447
447
|
const existing = this.traces.find((t) => t.traceId === trace.traceId);
|
|
448
|
+
const merged = existing ?? trace;
|
|
448
449
|
if (existing) {
|
|
449
450
|
const existingSpanIds = new Set(existing.spans.map((s) => s.spanId));
|
|
450
451
|
for (const span of trace.spans) {
|
|
@@ -456,6 +457,14 @@ var DevtoolsServer = class {
|
|
|
456
457
|
existing.endTime = Math.max(existing.endTime, trace.endTime);
|
|
457
458
|
existing.duration = existing.endTime - existing.startTime;
|
|
458
459
|
if (trace.status === "ERROR") existing.status = "ERROR";
|
|
460
|
+
const root = existing.spans.find((s) => !s.parentSpanId);
|
|
461
|
+
if (root) {
|
|
462
|
+
existing.rootSpan = root;
|
|
463
|
+
const rootService = root.attributes?.["service.name"];
|
|
464
|
+
if (typeof rootService === "string" && rootService.length > 0) {
|
|
465
|
+
existing.service = rootService;
|
|
466
|
+
}
|
|
467
|
+
}
|
|
459
468
|
} else {
|
|
460
469
|
this.traces = appendWithLimit(
|
|
461
470
|
this.traces,
|
|
@@ -464,7 +473,7 @@ var DevtoolsServer = class {
|
|
|
464
473
|
);
|
|
465
474
|
}
|
|
466
475
|
this.errorAggregator.addErrorsFromTrace(trace);
|
|
467
|
-
this.broadcast({ traces: [
|
|
476
|
+
this.broadcast({ traces: [merged], metrics: [], logs: [], errors: this.errorAggregator.getErrorGroups() });
|
|
468
477
|
}
|
|
469
478
|
addTraces(traces) {
|
|
470
479
|
for (const trace of traces) this.addTrace(trace);
|
|
@@ -1016,7 +1025,8 @@ function findPackageRoot() {
|
|
|
1016
1025
|
}
|
|
1017
1026
|
return dir;
|
|
1018
1027
|
}
|
|
1019
|
-
var
|
|
1028
|
+
var DEVTOOLS_FAVICON_SVG = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect width="64" height="64" rx="14" fill="#0f172a"/><text x="32" y="41" text-anchor="middle" font-size="32">\u{1F6F0}\uFE0F</text></svg>';
|
|
1029
|
+
var FULLPAGE_HTML = `<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>autotel-devtools</title><link rel="icon" href="/favicon.svg" type="image/svg+xml"><style>*{margin:0;padding:0;box-sizing:border-box}html,body{height:100%;width:100%;overflow:hidden}</style></head><body><script src="/widget.js?mode=fullpage"></script></body></html>`;
|
|
1020
1030
|
var cachedVersion = null;
|
|
1021
1031
|
function getVersion() {
|
|
1022
1032
|
if (cachedVersion !== null) return cachedVersion;
|
|
@@ -1053,6 +1063,7 @@ function getWidgetJs() {
|
|
|
1053
1063
|
function attachDevtoolsRoutes(httpServer, devtools, options = {}) {
|
|
1054
1064
|
const loopbackOnly = options.loopbackOnly ?? true;
|
|
1055
1065
|
httpServer.on("request", async (req, res) => {
|
|
1066
|
+
if (req.headers.upgrade?.toLowerCase() === "websocket") return;
|
|
1056
1067
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
1057
1068
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
1058
1069
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
@@ -1075,6 +1086,15 @@ function attachDevtoolsRoutes(httpServer, devtools, options = {}) {
|
|
|
1075
1086
|
res.end(js);
|
|
1076
1087
|
return;
|
|
1077
1088
|
}
|
|
1089
|
+
if (req.method === "GET" && (url === "/favicon.svg" || url === "/favicon.ico")) {
|
|
1090
|
+
res.writeHead(200, {
|
|
1091
|
+
"Content-Type": "image/svg+xml; charset=utf-8",
|
|
1092
|
+
"Cache-Control": "public, max-age=86400",
|
|
1093
|
+
"Content-Length": Buffer.byteLength(DEVTOOLS_FAVICON_SVG)
|
|
1094
|
+
});
|
|
1095
|
+
res.end(DEVTOOLS_FAVICON_SVG);
|
|
1096
|
+
return;
|
|
1097
|
+
}
|
|
1078
1098
|
if (req.method === "GET" && url === "/healthz") {
|
|
1079
1099
|
sendJson(res, 200, {
|
|
1080
1100
|
ok: true,
|