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/server/index.js
CHANGED
|
@@ -448,6 +448,7 @@ var DevtoolsServer = class {
|
|
|
448
448
|
}
|
|
449
449
|
addTrace(trace) {
|
|
450
450
|
const existing = this.traces.find((t) => t.traceId === trace.traceId);
|
|
451
|
+
const merged = existing ?? trace;
|
|
451
452
|
if (existing) {
|
|
452
453
|
const existingSpanIds = new Set(existing.spans.map((s) => s.spanId));
|
|
453
454
|
for (const span of trace.spans) {
|
|
@@ -459,6 +460,14 @@ var DevtoolsServer = class {
|
|
|
459
460
|
existing.endTime = Math.max(existing.endTime, trace.endTime);
|
|
460
461
|
existing.duration = existing.endTime - existing.startTime;
|
|
461
462
|
if (trace.status === "ERROR") existing.status = "ERROR";
|
|
463
|
+
const root = existing.spans.find((s) => !s.parentSpanId);
|
|
464
|
+
if (root) {
|
|
465
|
+
existing.rootSpan = root;
|
|
466
|
+
const rootService = root.attributes?.["service.name"];
|
|
467
|
+
if (typeof rootService === "string" && rootService.length > 0) {
|
|
468
|
+
existing.service = rootService;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
462
471
|
} else {
|
|
463
472
|
this.traces = appendWithLimit(
|
|
464
473
|
this.traces,
|
|
@@ -467,7 +476,7 @@ var DevtoolsServer = class {
|
|
|
467
476
|
);
|
|
468
477
|
}
|
|
469
478
|
this.errorAggregator.addErrorsFromTrace(trace);
|
|
470
|
-
this.broadcast({ traces: [
|
|
479
|
+
this.broadcast({ traces: [merged], metrics: [], logs: [], errors: this.errorAggregator.getErrorGroups() });
|
|
471
480
|
}
|
|
472
481
|
addTraces(traces) {
|
|
473
482
|
for (const trace of traces) this.addTrace(trace);
|
|
@@ -1479,7 +1488,8 @@ function findPackageRoot() {
|
|
|
1479
1488
|
}
|
|
1480
1489
|
return dir;
|
|
1481
1490
|
}
|
|
1482
|
-
var
|
|
1491
|
+
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>';
|
|
1492
|
+
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>`;
|
|
1483
1493
|
var cachedVersion = null;
|
|
1484
1494
|
function getVersion() {
|
|
1485
1495
|
if (cachedVersion !== null) return cachedVersion;
|
|
@@ -1516,6 +1526,7 @@ function getWidgetJs() {
|
|
|
1516
1526
|
function attachDevtoolsRoutes(httpServer, devtools, options = {}) {
|
|
1517
1527
|
const loopbackOnly = options.loopbackOnly ?? true;
|
|
1518
1528
|
httpServer.on("request", async (req, res) => {
|
|
1529
|
+
if (req.headers.upgrade?.toLowerCase() === "websocket") return;
|
|
1519
1530
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
1520
1531
|
res.setHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
|
1521
1532
|
res.setHeader("Access-Control-Allow-Headers", "Content-Type");
|
|
@@ -1538,6 +1549,15 @@ function attachDevtoolsRoutes(httpServer, devtools, options = {}) {
|
|
|
1538
1549
|
res.end(js);
|
|
1539
1550
|
return;
|
|
1540
1551
|
}
|
|
1552
|
+
if (req.method === "GET" && (url === "/favicon.svg" || url === "/favicon.ico")) {
|
|
1553
|
+
res.writeHead(200, {
|
|
1554
|
+
"Content-Type": "image/svg+xml; charset=utf-8",
|
|
1555
|
+
"Cache-Control": "public, max-age=86400",
|
|
1556
|
+
"Content-Length": Buffer.byteLength(DEVTOOLS_FAVICON_SVG)
|
|
1557
|
+
});
|
|
1558
|
+
res.end(DEVTOOLS_FAVICON_SVG);
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1541
1561
|
if (req.method === "GET" && url === "/healthz") {
|
|
1542
1562
|
sendJson(res, 200, {
|
|
1543
1563
|
ok: true,
|