autotel-terminal 45.0.1 → 47.0.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/dist/cli.cjs +4 -3
- package/dist/cli.js +4 -3
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-DxJ67W66.cjs → src-Bc8CXv51.cjs} +34 -29
- package/dist/{src-rYqHu0JC.js → src-DW1LpxYb.js} +33 -28
- package/package.json +3 -3
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-Bc8CXv51.cjs');
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
let node_http = require("node:http");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -105,7 +105,7 @@ function asString(value) {
|
|
|
105
105
|
|
|
106
106
|
//#endregion
|
|
107
107
|
//#region src/otlp-http-json.ts
|
|
108
|
-
const MAX_BODY_BYTES =
|
|
108
|
+
const MAX_BODY_BYTES = 10485760;
|
|
109
109
|
function anyValueToPrimitive(value) {
|
|
110
110
|
if (!value) return void 0;
|
|
111
111
|
if (value.stringValue !== void 0) return value.stringValue;
|
|
@@ -440,7 +440,8 @@ async function main() {
|
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
442
|
if (req.url === "/v1/metrics") {
|
|
443
|
-
|
|
443
|
+
const count = countOtlpMetrics(payload);
|
|
444
|
+
sendJson(res, 200, { acceptedMetrics: count });
|
|
444
445
|
return;
|
|
445
446
|
}
|
|
446
447
|
} catch (error) {
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as getTerminalLogStream, i as renderTerminal } from "./src-
|
|
2
|
+
import { a as getTerminalLogStream, i as renderTerminal } from "./src-DW1LpxYb.js";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import { createServer } from "node:http";
|
|
5
5
|
import path from "node:path";
|
|
@@ -104,7 +104,7 @@ function asString(value) {
|
|
|
104
104
|
|
|
105
105
|
//#endregion
|
|
106
106
|
//#region src/otlp-http-json.ts
|
|
107
|
-
const MAX_BODY_BYTES =
|
|
107
|
+
const MAX_BODY_BYTES = 10485760;
|
|
108
108
|
function anyValueToPrimitive(value) {
|
|
109
109
|
if (!value) return void 0;
|
|
110
110
|
if (value.stringValue !== void 0) return value.stringValue;
|
|
@@ -439,7 +439,8 @@ async function main() {
|
|
|
439
439
|
return;
|
|
440
440
|
}
|
|
441
441
|
if (req.url === "/v1/metrics") {
|
|
442
|
-
|
|
442
|
+
const count = countOtlpMetrics(payload);
|
|
443
|
+
sendJson(res, 200, { acceptedMetrics: count });
|
|
443
444
|
return;
|
|
444
445
|
}
|
|
445
446
|
} catch (error) {
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-Bc8CXv51.cjs');
|
|
3
3
|
let autotel_exporters = require("autotel/exporters");
|
|
4
4
|
let autotel = require("autotel");
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as getTerminalLogStream, i as renderTerminal, n as SpanKind, o as createTerminalSpanStream, r as SpanStatusCode, s as StreamingSpanProcessor, t as PrettyConsoleExporter } from "./src-
|
|
1
|
+
import { a as getTerminalLogStream, i as renderTerminal, n as SpanKind, o as createTerminalSpanStream, r as SpanStatusCode, s as StreamingSpanProcessor, t as PrettyConsoleExporter } from "./src-DW1LpxYb.js";
|
|
2
2
|
|
|
3
3
|
export { PrettyConsoleExporter, SpanKind, SpanStatusCode, StreamingSpanProcessor, createTerminalSpanStream, getTerminalLogStream, renderTerminal };
|
|
@@ -19,7 +19,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
19
19
|
}
|
|
20
20
|
return to;
|
|
21
21
|
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
23
23
|
value: mod,
|
|
24
24
|
enumerable: true
|
|
25
25
|
}) : target, mod));
|
|
@@ -557,7 +557,8 @@ function getTerminalLogStream() {
|
|
|
557
557
|
function computeServiceStats(spans) {
|
|
558
558
|
const byService = /* @__PURE__ */ new Map();
|
|
559
559
|
for (const span of spans) {
|
|
560
|
-
const
|
|
560
|
+
const attrs = span.attributes ?? {};
|
|
561
|
+
const serviceName = stringAttr(attrs, "service.name") ?? "unknown";
|
|
561
562
|
const entry = byService.get(serviceName) ?? {
|
|
562
563
|
durations: [],
|
|
563
564
|
total: 0,
|
|
@@ -588,7 +589,8 @@ function computeServiceStats(spans) {
|
|
|
588
589
|
function computeRouteStats(spans) {
|
|
589
590
|
const byRoute = /* @__PURE__ */ new Map();
|
|
590
591
|
for (const span of spans) {
|
|
591
|
-
const
|
|
592
|
+
const attrs = span.attributes ?? {};
|
|
593
|
+
const route = stringAttr(attrs, "http.route") ?? null;
|
|
592
594
|
if (!route) continue;
|
|
593
595
|
const entry = byRoute.get(route) ?? {
|
|
594
596
|
durations: [],
|
|
@@ -644,10 +646,12 @@ function findHotSpanNames(spans, topN) {
|
|
|
644
646
|
//#endregion
|
|
645
647
|
//#region src/lib/filters.ts
|
|
646
648
|
function getServiceName$1(span) {
|
|
647
|
-
|
|
649
|
+
const attrs = span.attributes ?? {};
|
|
650
|
+
return stringAttr(attrs, "service.name") ?? void 0;
|
|
648
651
|
}
|
|
649
652
|
function getRoute(span) {
|
|
650
|
-
|
|
653
|
+
const attrs = span.attributes ?? {};
|
|
654
|
+
return stringAttr(attrs, "http.route") ?? void 0;
|
|
651
655
|
}
|
|
652
656
|
function getStatusCode(span) {
|
|
653
657
|
const attrs = span.attributes ?? {};
|
|
@@ -1369,7 +1373,8 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1369
1373
|
const perSpanNameStats = (0, react.useMemo)(() => computePerSpanNameStats(spans), [spans]);
|
|
1370
1374
|
const logStats = (0, react.useMemo)(() => computeLogStats(logs), [logs]);
|
|
1371
1375
|
const filteredLogs = (0, react.useMemo)(() => {
|
|
1372
|
-
|
|
1376
|
+
const traceFilteredLogs = spanFilters.traceId ? logs.filter((l) => l.traceId === spanFilters.traceId) : logs;
|
|
1377
|
+
return filterLogsBySearch(traceFilteredLogs, searchQuery, null);
|
|
1373
1378
|
}, [
|
|
1374
1379
|
logs,
|
|
1375
1380
|
searchQuery,
|
|
@@ -1647,12 +1652,16 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1647
1652
|
else if (viewMode === "log" && filteredLogs[selected]?.traceId) {
|
|
1648
1653
|
targetTraceId = filteredLogs[selected].traceId;
|
|
1649
1654
|
const originLog = filteredLogs[selected];
|
|
1650
|
-
|
|
1655
|
+
const traceSpans = spans.filter((s) => s.traceId === targetTraceId);
|
|
1656
|
+
const traceLogs = logs.filter((l) => l.traceId === targetTraceId);
|
|
1657
|
+
preSelectIndex = buildTraceTimeline(traceSpans, traceLogs).findIndex((item) => item.type === "log" && item.log === originLog);
|
|
1651
1658
|
if (preSelectIndex < 0) preSelectIndex = 0;
|
|
1652
1659
|
} else if (viewMode === "span" && filteredSpans[selected]?.traceId) {
|
|
1653
1660
|
targetTraceId = filteredSpans[selected].traceId;
|
|
1654
1661
|
const originSpan = filteredSpans[selected];
|
|
1655
|
-
|
|
1662
|
+
const traceSpans = spans.filter((s) => s.traceId === targetTraceId);
|
|
1663
|
+
const traceLogs = logs.filter((l) => l.traceId === targetTraceId);
|
|
1664
|
+
preSelectIndex = buildTraceTimeline(traceSpans, traceLogs).findIndex((item) => item.type === "span" && item.span?.spanId === originSpan.spanId);
|
|
1656
1665
|
if (preSelectIndex < 0) preSelectIndex = 0;
|
|
1657
1666
|
}
|
|
1658
1667
|
if (targetTraceId) {
|
|
@@ -1700,10 +1709,8 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1700
1709
|
if (key.upArrow) setSelected((i) => Math.max(0, i - 1));
|
|
1701
1710
|
else if (key.downArrow) setSelected((i) => Math.min(serviceStats.length - 1, i + 1));
|
|
1702
1711
|
break;
|
|
1703
|
-
case "errors":
|
|
1704
|
-
|
|
1705
|
-
else if (key.downArrow) setSelected((i) => Math.min(filteredErrorSummaries.length - 1, i + 1));
|
|
1706
|
-
break;
|
|
1712
|
+
case "errors": if (key.upArrow) setSelected((i) => Math.max(0, i - 1));
|
|
1713
|
+
else if (key.downArrow) setSelected((i) => Math.min(filteredErrorSummaries.length - 1, i + 1));
|
|
1707
1714
|
}
|
|
1708
1715
|
}
|
|
1709
1716
|
if (input === "p") setPaused((p) => !p);
|
|
@@ -1828,9 +1835,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1828
1835
|
case "span":
|
|
1829
1836
|
traceId = filteredSpans[selected]?.traceId;
|
|
1830
1837
|
break;
|
|
1831
|
-
case "errors":
|
|
1832
|
-
traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1833
|
-
break;
|
|
1838
|
+
case "errors": traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1834
1839
|
}
|
|
1835
1840
|
if (traceId && viewMode !== "trace") {
|
|
1836
1841
|
setSpanFilters((prev) => ({
|
|
@@ -1856,9 +1861,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1856
1861
|
case "span":
|
|
1857
1862
|
traceId = filteredSpans[selected]?.traceId;
|
|
1858
1863
|
break;
|
|
1859
|
-
case "errors":
|
|
1860
|
-
traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1861
|
-
break;
|
|
1864
|
+
case "errors": traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1862
1865
|
}
|
|
1863
1866
|
if (traceId && viewMode !== "log") {
|
|
1864
1867
|
setSpanFilters((prev) => ({
|
|
@@ -2032,8 +2035,9 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2032
2035
|
flexDirection: "column",
|
|
2033
2036
|
marginTop: 1,
|
|
2034
2037
|
children: topologyLines.map((line, i) => {
|
|
2038
|
+
const hasErr = line.includes(" err");
|
|
2035
2039
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, {
|
|
2036
|
-
color:
|
|
2040
|
+
color: hasErr ? "red" : void 0,
|
|
2037
2041
|
children: line
|
|
2038
2042
|
}, `topo-${i}`);
|
|
2039
2043
|
})
|
|
@@ -2244,9 +2248,9 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2244
2248
|
const svcName = spanServiceName(s);
|
|
2245
2249
|
const svcColor = getServiceColor(svcName);
|
|
2246
2250
|
const kindStr = (s.kind ?? "").padEnd(KIND_COL);
|
|
2247
|
-
const svcStr = truncate(svcName,
|
|
2251
|
+
const svcStr = truncate(svcName, 10).padEnd(SERVICE_COL);
|
|
2248
2252
|
const errorMark = s.status === "ERROR" ? "✗" : " ";
|
|
2249
|
-
const namePart = `${indent}${truncate(s.name, nameWidth - 1)}`.padEnd(
|
|
2253
|
+
const namePart = `${indent}${truncate(s.name, nameWidth - 1)}`.padEnd(27);
|
|
2250
2254
|
const bar = buildWaterfallBar(s.startTime, s.durationMs, traceStartMs, traceDurMs, WATERFALL_WIDTH);
|
|
2251
2255
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
2252
2256
|
flexDirection: "row",
|
|
@@ -2285,9 +2289,9 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2285
2289
|
const l = item.log;
|
|
2286
2290
|
const levelColor = l.level === "error" ? "red" : l.level === "warn" ? "yellow" : "blue";
|
|
2287
2291
|
const relTime = drilldownSummary ? `+${formatDurationMs(l.time - traceStartMs)}` : "";
|
|
2288
|
-
const logName = ` ${l.level.toUpperCase()} ${truncate(l.message,
|
|
2292
|
+
const logName = ` ${l.level.toUpperCase()} ${truncate(l.message, 20)}`.padEnd(NAME_COL);
|
|
2289
2293
|
const logOffset = drilldownSummary ? Math.floor((l.time - traceStartMs) / traceDurMs * WATERFALL_WIDTH) : 0;
|
|
2290
|
-
const clampedOffset = Math.max(0, Math.min(logOffset,
|
|
2294
|
+
const clampedOffset = Math.max(0, Math.min(logOffset, 43));
|
|
2291
2295
|
const logBar = " ".repeat(clampedOffset) + "·" + " ".repeat(WATERFALL_WIDTH - clampedOffset - 1);
|
|
2292
2296
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
2293
2297
|
flexDirection: "row",
|
|
@@ -2588,7 +2592,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2588
2592
|
dimColor: true,
|
|
2589
2593
|
children: "Tip: trace() your handlers with autotel to get spans."
|
|
2590
2594
|
})]
|
|
2591
|
-
}), Array.from({ length: Math.max(0,
|
|
2595
|
+
}), Array.from({ length: Math.max(0, 18) }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [filteredSummaries.slice(0, 20).map((t, i) => {
|
|
2592
2596
|
const isSel = i === selected;
|
|
2593
2597
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
2594
2598
|
flexDirection: "row",
|
|
@@ -2641,7 +2645,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2641
2645
|
dimColor: true,
|
|
2642
2646
|
children: "Tip: trace() your handlers with autotel to get spans."
|
|
2643
2647
|
})]
|
|
2644
|
-
}), Array.from({ length: Math.max(0,
|
|
2648
|
+
}), Array.from({ length: Math.max(0, 18) }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [filteredSpans.slice(0, 20).map((s, i) => {
|
|
2645
2649
|
const isSel = i === selected;
|
|
2646
2650
|
const svcName = spanServiceName(s);
|
|
2647
2651
|
const svcColor = getServiceColor(svcName);
|
|
@@ -2677,7 +2681,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2677
2681
|
dimColor: true,
|
|
2678
2682
|
children: "No service stats yet. Add `service.name` attributes to spans."
|
|
2679
2683
|
})
|
|
2680
|
-
}), Array.from({ length: Math.max(0,
|
|
2684
|
+
}), Array.from({ length: Math.max(0, 19) }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [serviceStats.slice(0, 20).map((svc, i) => {
|
|
2681
2685
|
const isSel = i === selected;
|
|
2682
2686
|
const errorRate = svc.total ? svc.errors / svc.total * 100 : 0;
|
|
2683
2687
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
@@ -2721,7 +2725,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2721
2725
|
dimColor: true,
|
|
2722
2726
|
children: "No errors yet."
|
|
2723
2727
|
})
|
|
2724
|
-
}), Array.from({ length: Math.max(0,
|
|
2728
|
+
}), Array.from({ length: Math.max(0, 19) }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [filteredErrorSummaries.slice(0, 20).map((e, i) => {
|
|
2725
2729
|
const isSel = i === selected;
|
|
2726
2730
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
2727
2731
|
flexDirection: "row",
|
|
@@ -2765,7 +2769,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2765
2769
|
dimColor: true,
|
|
2766
2770
|
children: "Tip: hook getTerminalLogStream() into your canonical log line drain."
|
|
2767
2771
|
})]
|
|
2768
|
-
}), Array.from({ length: Math.max(0,
|
|
2772
|
+
}), Array.from({ length: Math.max(0, 18) }).map((_, i) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Box, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [filteredLogs.slice(0, 20).map((log, i) => {
|
|
2769
2773
|
const isSel = i === selected;
|
|
2770
2774
|
const levelColor = log.level === "error" ? "red" : log.level === "warn" ? "yellow" : log.level === "debug" ? "gray" : "green";
|
|
2771
2775
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
@@ -3054,12 +3058,13 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
3054
3058
|
}), waterfallSpans.slice(0, 10).map((w) => {
|
|
3055
3059
|
const barLen = Math.round(w.span.durationMs / waterfallMaxMs * barWidth) || 1;
|
|
3056
3060
|
const bar = "█".repeat(barLen);
|
|
3061
|
+
const indent = " ".repeat(w.depth);
|
|
3057
3062
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Box, {
|
|
3058
3063
|
flexDirection: "row",
|
|
3059
3064
|
children: [
|
|
3060
3065
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, {
|
|
3061
3066
|
dimColor: true,
|
|
3062
|
-
children:
|
|
3067
|
+
children: indent
|
|
3063
3068
|
}),
|
|
3064
3069
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ink.Text, { children: truncate(w.span.name, 12) }),
|
|
3065
3070
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(ink.Text, {
|
|
@@ -529,7 +529,8 @@ function getTerminalLogStream() {
|
|
|
529
529
|
function computeServiceStats(spans) {
|
|
530
530
|
const byService = /* @__PURE__ */ new Map();
|
|
531
531
|
for (const span of spans) {
|
|
532
|
-
const
|
|
532
|
+
const attrs = span.attributes ?? {};
|
|
533
|
+
const serviceName = stringAttr(attrs, "service.name") ?? "unknown";
|
|
533
534
|
const entry = byService.get(serviceName) ?? {
|
|
534
535
|
durations: [],
|
|
535
536
|
total: 0,
|
|
@@ -560,7 +561,8 @@ function computeServiceStats(spans) {
|
|
|
560
561
|
function computeRouteStats(spans) {
|
|
561
562
|
const byRoute = /* @__PURE__ */ new Map();
|
|
562
563
|
for (const span of spans) {
|
|
563
|
-
const
|
|
564
|
+
const attrs = span.attributes ?? {};
|
|
565
|
+
const route = stringAttr(attrs, "http.route") ?? null;
|
|
564
566
|
if (!route) continue;
|
|
565
567
|
const entry = byRoute.get(route) ?? {
|
|
566
568
|
durations: [],
|
|
@@ -616,10 +618,12 @@ function findHotSpanNames(spans, topN) {
|
|
|
616
618
|
//#endregion
|
|
617
619
|
//#region src/lib/filters.ts
|
|
618
620
|
function getServiceName$1(span) {
|
|
619
|
-
|
|
621
|
+
const attrs = span.attributes ?? {};
|
|
622
|
+
return stringAttr(attrs, "service.name") ?? void 0;
|
|
620
623
|
}
|
|
621
624
|
function getRoute(span) {
|
|
622
|
-
|
|
625
|
+
const attrs = span.attributes ?? {};
|
|
626
|
+
return stringAttr(attrs, "http.route") ?? void 0;
|
|
623
627
|
}
|
|
624
628
|
function getStatusCode(span) {
|
|
625
629
|
const attrs = span.attributes ?? {};
|
|
@@ -1341,7 +1345,8 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1341
1345
|
const perSpanNameStats = useMemo(() => computePerSpanNameStats(spans), [spans]);
|
|
1342
1346
|
const logStats = useMemo(() => computeLogStats(logs), [logs]);
|
|
1343
1347
|
const filteredLogs = useMemo(() => {
|
|
1344
|
-
|
|
1348
|
+
const traceFilteredLogs = spanFilters.traceId ? logs.filter((l) => l.traceId === spanFilters.traceId) : logs;
|
|
1349
|
+
return filterLogsBySearch(traceFilteredLogs, searchQuery, null);
|
|
1345
1350
|
}, [
|
|
1346
1351
|
logs,
|
|
1347
1352
|
searchQuery,
|
|
@@ -1619,12 +1624,16 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1619
1624
|
else if (viewMode === "log" && filteredLogs[selected]?.traceId) {
|
|
1620
1625
|
targetTraceId = filteredLogs[selected].traceId;
|
|
1621
1626
|
const originLog = filteredLogs[selected];
|
|
1622
|
-
|
|
1627
|
+
const traceSpans = spans.filter((s) => s.traceId === targetTraceId);
|
|
1628
|
+
const traceLogs = logs.filter((l) => l.traceId === targetTraceId);
|
|
1629
|
+
preSelectIndex = buildTraceTimeline(traceSpans, traceLogs).findIndex((item) => item.type === "log" && item.log === originLog);
|
|
1623
1630
|
if (preSelectIndex < 0) preSelectIndex = 0;
|
|
1624
1631
|
} else if (viewMode === "span" && filteredSpans[selected]?.traceId) {
|
|
1625
1632
|
targetTraceId = filteredSpans[selected].traceId;
|
|
1626
1633
|
const originSpan = filteredSpans[selected];
|
|
1627
|
-
|
|
1634
|
+
const traceSpans = spans.filter((s) => s.traceId === targetTraceId);
|
|
1635
|
+
const traceLogs = logs.filter((l) => l.traceId === targetTraceId);
|
|
1636
|
+
preSelectIndex = buildTraceTimeline(traceSpans, traceLogs).findIndex((item) => item.type === "span" && item.span?.spanId === originSpan.spanId);
|
|
1628
1637
|
if (preSelectIndex < 0) preSelectIndex = 0;
|
|
1629
1638
|
}
|
|
1630
1639
|
if (targetTraceId) {
|
|
@@ -1672,10 +1681,8 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1672
1681
|
if (key.upArrow) setSelected((i) => Math.max(0, i - 1));
|
|
1673
1682
|
else if (key.downArrow) setSelected((i) => Math.min(serviceStats.length - 1, i + 1));
|
|
1674
1683
|
break;
|
|
1675
|
-
case "errors":
|
|
1676
|
-
|
|
1677
|
-
else if (key.downArrow) setSelected((i) => Math.min(filteredErrorSummaries.length - 1, i + 1));
|
|
1678
|
-
break;
|
|
1684
|
+
case "errors": if (key.upArrow) setSelected((i) => Math.max(0, i - 1));
|
|
1685
|
+
else if (key.downArrow) setSelected((i) => Math.min(filteredErrorSummaries.length - 1, i + 1));
|
|
1679
1686
|
}
|
|
1680
1687
|
}
|
|
1681
1688
|
if (input === "p") setPaused((p) => !p);
|
|
@@ -1800,9 +1807,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1800
1807
|
case "span":
|
|
1801
1808
|
traceId = filteredSpans[selected]?.traceId;
|
|
1802
1809
|
break;
|
|
1803
|
-
case "errors":
|
|
1804
|
-
traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1805
|
-
break;
|
|
1810
|
+
case "errors": traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1806
1811
|
}
|
|
1807
1812
|
if (traceId && viewMode !== "trace") {
|
|
1808
1813
|
setSpanFilters((prev) => ({
|
|
@@ -1828,9 +1833,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
1828
1833
|
case "span":
|
|
1829
1834
|
traceId = filteredSpans[selected]?.traceId;
|
|
1830
1835
|
break;
|
|
1831
|
-
case "errors":
|
|
1832
|
-
traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1833
|
-
break;
|
|
1836
|
+
case "errors": traceId = filteredErrorSummaries[selected]?.traceId;
|
|
1834
1837
|
}
|
|
1835
1838
|
if (traceId && viewMode !== "log") {
|
|
1836
1839
|
setSpanFilters((prev) => ({
|
|
@@ -2004,8 +2007,9 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2004
2007
|
flexDirection: "column",
|
|
2005
2008
|
marginTop: 1,
|
|
2006
2009
|
children: topologyLines.map((line, i) => {
|
|
2010
|
+
const hasErr = line.includes(" err");
|
|
2007
2011
|
return /* @__PURE__ */ jsx(Text, {
|
|
2008
|
-
color:
|
|
2012
|
+
color: hasErr ? "red" : void 0,
|
|
2009
2013
|
children: line
|
|
2010
2014
|
}, `topo-${i}`);
|
|
2011
2015
|
})
|
|
@@ -2216,9 +2220,9 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2216
2220
|
const svcName = spanServiceName(s);
|
|
2217
2221
|
const svcColor = getServiceColor(svcName);
|
|
2218
2222
|
const kindStr = (s.kind ?? "").padEnd(KIND_COL);
|
|
2219
|
-
const svcStr = truncate(svcName,
|
|
2223
|
+
const svcStr = truncate(svcName, 10).padEnd(SERVICE_COL);
|
|
2220
2224
|
const errorMark = s.status === "ERROR" ? "✗" : " ";
|
|
2221
|
-
const namePart = `${indent}${truncate(s.name, nameWidth - 1)}`.padEnd(
|
|
2225
|
+
const namePart = `${indent}${truncate(s.name, nameWidth - 1)}`.padEnd(27);
|
|
2222
2226
|
const bar = buildWaterfallBar(s.startTime, s.durationMs, traceStartMs, traceDurMs, WATERFALL_WIDTH);
|
|
2223
2227
|
return /* @__PURE__ */ jsxs(Box, {
|
|
2224
2228
|
flexDirection: "row",
|
|
@@ -2257,9 +2261,9 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2257
2261
|
const l = item.log;
|
|
2258
2262
|
const levelColor = l.level === "error" ? "red" : l.level === "warn" ? "yellow" : "blue";
|
|
2259
2263
|
const relTime = drilldownSummary ? `+${formatDurationMs(l.time - traceStartMs)}` : "";
|
|
2260
|
-
const logName = ` ${l.level.toUpperCase()} ${truncate(l.message,
|
|
2264
|
+
const logName = ` ${l.level.toUpperCase()} ${truncate(l.message, 20)}`.padEnd(NAME_COL);
|
|
2261
2265
|
const logOffset = drilldownSummary ? Math.floor((l.time - traceStartMs) / traceDurMs * WATERFALL_WIDTH) : 0;
|
|
2262
|
-
const clampedOffset = Math.max(0, Math.min(logOffset,
|
|
2266
|
+
const clampedOffset = Math.max(0, Math.min(logOffset, 43));
|
|
2263
2267
|
const logBar = " ".repeat(clampedOffset) + "·" + " ".repeat(WATERFALL_WIDTH - clampedOffset - 1);
|
|
2264
2268
|
return /* @__PURE__ */ jsxs(Box, {
|
|
2265
2269
|
flexDirection: "row",
|
|
@@ -2560,7 +2564,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2560
2564
|
dimColor: true,
|
|
2561
2565
|
children: "Tip: trace() your handlers with autotel to get spans."
|
|
2562
2566
|
})]
|
|
2563
|
-
}), Array.from({ length: Math.max(0,
|
|
2567
|
+
}), Array.from({ length: Math.max(0, 18) }).map((_, i) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ jsxs(Fragment, { children: [filteredSummaries.slice(0, 20).map((t, i) => {
|
|
2564
2568
|
const isSel = i === selected;
|
|
2565
2569
|
return /* @__PURE__ */ jsxs(Box, {
|
|
2566
2570
|
flexDirection: "row",
|
|
@@ -2613,7 +2617,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2613
2617
|
dimColor: true,
|
|
2614
2618
|
children: "Tip: trace() your handlers with autotel to get spans."
|
|
2615
2619
|
})]
|
|
2616
|
-
}), Array.from({ length: Math.max(0,
|
|
2620
|
+
}), Array.from({ length: Math.max(0, 18) }).map((_, i) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ jsxs(Fragment, { children: [filteredSpans.slice(0, 20).map((s, i) => {
|
|
2617
2621
|
const isSel = i === selected;
|
|
2618
2622
|
const svcName = spanServiceName(s);
|
|
2619
2623
|
const svcColor = getServiceColor(svcName);
|
|
@@ -2649,7 +2653,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2649
2653
|
dimColor: true,
|
|
2650
2654
|
children: "No service stats yet. Add `service.name` attributes to spans."
|
|
2651
2655
|
})
|
|
2652
|
-
}), Array.from({ length: Math.max(0,
|
|
2656
|
+
}), Array.from({ length: Math.max(0, 19) }).map((_, i) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ jsxs(Fragment, { children: [serviceStats.slice(0, 20).map((svc, i) => {
|
|
2653
2657
|
const isSel = i === selected;
|
|
2654
2658
|
const errorRate = svc.total ? svc.errors / svc.total * 100 : 0;
|
|
2655
2659
|
return /* @__PURE__ */ jsxs(Box, {
|
|
@@ -2693,7 +2697,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2693
2697
|
dimColor: true,
|
|
2694
2698
|
children: "No errors yet."
|
|
2695
2699
|
})
|
|
2696
|
-
}), Array.from({ length: Math.max(0,
|
|
2700
|
+
}), Array.from({ length: Math.max(0, 19) }).map((_, i) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ jsxs(Fragment, { children: [filteredErrorSummaries.slice(0, 20).map((e, i) => {
|
|
2697
2701
|
const isSel = i === selected;
|
|
2698
2702
|
return /* @__PURE__ */ jsxs(Box, {
|
|
2699
2703
|
flexDirection: "row",
|
|
@@ -2737,7 +2741,7 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
2737
2741
|
dimColor: true,
|
|
2738
2742
|
children: "Tip: hook getTerminalLogStream() into your canonical log line drain."
|
|
2739
2743
|
})]
|
|
2740
|
-
}), Array.from({ length: Math.max(0,
|
|
2744
|
+
}), Array.from({ length: Math.max(0, 18) }).map((_, i) => /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Text, { children: " " }) }, `pad-${i}`))] }) : /* @__PURE__ */ jsxs(Fragment, { children: [filteredLogs.slice(0, 20).map((log, i) => {
|
|
2741
2745
|
const isSel = i === selected;
|
|
2742
2746
|
const levelColor = log.level === "error" ? "red" : log.level === "warn" ? "yellow" : log.level === "debug" ? "gray" : "green";
|
|
2743
2747
|
return /* @__PURE__ */ jsxs(Box, {
|
|
@@ -3026,12 +3030,13 @@ function Dashboard({ title, showStats, maxSpans, colors, stream, logStream, aiCo
|
|
|
3026
3030
|
}), waterfallSpans.slice(0, 10).map((w) => {
|
|
3027
3031
|
const barLen = Math.round(w.span.durationMs / waterfallMaxMs * barWidth) || 1;
|
|
3028
3032
|
const bar = "█".repeat(barLen);
|
|
3033
|
+
const indent = " ".repeat(w.depth);
|
|
3029
3034
|
return /* @__PURE__ */ jsxs(Box, {
|
|
3030
3035
|
flexDirection: "row",
|
|
3031
3036
|
children: [
|
|
3032
3037
|
/* @__PURE__ */ jsx(Text, {
|
|
3033
3038
|
dimColor: true,
|
|
3034
|
-
children:
|
|
3039
|
+
children: indent
|
|
3035
3040
|
}),
|
|
3036
3041
|
/* @__PURE__ */ jsx(Text, { children: truncate(w.span.name, 12) }),
|
|
3037
3042
|
/* @__PURE__ */ jsxs(Text, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autotel-terminal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "47.0.0",
|
|
4
4
|
"description": "Terminal dashboard for autotel traces using react-ink",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"@opentelemetry/api": "^1.9.1",
|
|
57
57
|
"@opentelemetry/sdk-trace-base": "^2.11.0",
|
|
58
|
-
"autotel": "7.
|
|
58
|
+
"autotel": "7.9.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@types/react": "^19.2.17",
|
|
65
65
|
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
|
66
66
|
"@typescript-eslint/parser": "^8.65.0",
|
|
67
|
-
"autotel": "7.
|
|
67
|
+
"autotel": "7.9.0",
|
|
68
68
|
"eslint-config-prettier": "^10.1.8",
|
|
69
69
|
"eslint-plugin-unicorn": "^64.0.0",
|
|
70
70
|
"prettier": "^3.9.6",
|