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/index.cjs
CHANGED
|
@@ -447,6 +447,7 @@ var DevtoolsServer = class {
|
|
|
447
447
|
}
|
|
448
448
|
addTrace(trace) {
|
|
449
449
|
const existing = this.traces.find((t) => t.traceId === trace.traceId);
|
|
450
|
+
const merged = existing ?? trace;
|
|
450
451
|
if (existing) {
|
|
451
452
|
const existingSpanIds = new Set(existing.spans.map((s) => s.spanId));
|
|
452
453
|
for (const span of trace.spans) {
|
|
@@ -458,6 +459,14 @@ var DevtoolsServer = class {
|
|
|
458
459
|
existing.endTime = Math.max(existing.endTime, trace.endTime);
|
|
459
460
|
existing.duration = existing.endTime - existing.startTime;
|
|
460
461
|
if (trace.status === "ERROR") existing.status = "ERROR";
|
|
462
|
+
const root = existing.spans.find((s) => !s.parentSpanId);
|
|
463
|
+
if (root) {
|
|
464
|
+
existing.rootSpan = root;
|
|
465
|
+
const rootService = root.attributes?.["service.name"];
|
|
466
|
+
if (typeof rootService === "string" && rootService.length > 0) {
|
|
467
|
+
existing.service = rootService;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
461
470
|
} else {
|
|
462
471
|
this.traces = appendWithLimit(
|
|
463
472
|
this.traces,
|
|
@@ -466,7 +475,7 @@ var DevtoolsServer = class {
|
|
|
466
475
|
);
|
|
467
476
|
}
|
|
468
477
|
this.errorAggregator.addErrorsFromTrace(trace);
|
|
469
|
-
this.broadcast({ traces: [
|
|
478
|
+
this.broadcast({ traces: [merged], metrics: [], logs: [], errors: this.errorAggregator.getErrorGroups() });
|
|
470
479
|
}
|
|
471
480
|
addTraces(traces) {
|
|
472
481
|
for (const trace of traces) this.addTrace(trace);
|
|
@@ -997,7 +1006,8 @@ function findPackageRoot() {
|
|
|
997
1006
|
}
|
|
998
1007
|
return dir;
|
|
999
1008
|
}
|
|
1000
|
-
var
|
|
1009
|
+
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>';
|
|
1010
|
+
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>`;
|
|
1001
1011
|
var cachedVersion = null;
|
|
1002
1012
|
function getVersion() {
|
|
1003
1013
|
if (cachedVersion !== null) return cachedVersion;
|
|
@@ -1034,6 +1044,7 @@ function getWidgetJs() {
|
|
|
1034
1044
|
function attachDevtoolsRoutes(httpServer, devtools, options = {}) {
|
|
1035
1045
|
const loopbackOnly = options.loopbackOnly ?? true;
|
|
1036
1046
|
httpServer.on("request", async (req, res) => {
|
|
1047
|
+
if (req.headers.upgrade?.toLowerCase() === "websocket") return;
|
|
1037
1048
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
1038
1049
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
1039
1050
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
@@ -1056,6 +1067,15 @@ function attachDevtoolsRoutes(httpServer, devtools, options = {}) {
|
|
|
1056
1067
|
res.end(js);
|
|
1057
1068
|
return;
|
|
1058
1069
|
}
|
|
1070
|
+
if (req.method === "GET" && (url === "/favicon.svg" || url === "/favicon.ico")) {
|
|
1071
|
+
res.writeHead(200, {
|
|
1072
|
+
"Content-Type": "image/svg+xml; charset=utf-8",
|
|
1073
|
+
"Cache-Control": "public, max-age=86400",
|
|
1074
|
+
"Content-Length": Buffer.byteLength(DEVTOOLS_FAVICON_SVG)
|
|
1075
|
+
});
|
|
1076
|
+
res.end(DEVTOOLS_FAVICON_SVG);
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1059
1079
|
if (req.method === "GET" && url === "/healthz") {
|
|
1060
1080
|
sendJson(res, 200, {
|
|
1061
1081
|
ok: true,
|