@localstack/appinspector-ui 1.0.71 → 1.0.72
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/index.cjs +69 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +48 -90
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -386,7 +386,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
386
386
|
|
|
387
387
|
// src/pages/spans-list-page.tsx
|
|
388
388
|
var import_material21 = require("@mui/material");
|
|
389
|
-
var
|
|
389
|
+
var import_react62 = require("react");
|
|
390
390
|
|
|
391
391
|
// src/components/spans-list/spans-list.tsx
|
|
392
392
|
var import_material5 = require("@mui/material");
|
|
@@ -13847,8 +13847,8 @@ var useSpans = () => {
|
|
|
13847
13847
|
var import_icons_material11 = require("@mui/icons-material");
|
|
13848
13848
|
var import_material20 = require("@mui/material");
|
|
13849
13849
|
var import_styles = require("@mui/material/styles");
|
|
13850
|
-
var
|
|
13851
|
-
var
|
|
13850
|
+
var import_react60 = require("@xyflow/react");
|
|
13851
|
+
var import_react61 = require("react");
|
|
13852
13852
|
|
|
13853
13853
|
// src/components/event-details/event-details.tsx
|
|
13854
13854
|
var import_material15 = require("@mui/material");
|
|
@@ -24501,8 +24501,8 @@ function renderKeyValue(key, value) {
|
|
|
24501
24501
|
// src/components/trace-graph/trace-graph.tsx
|
|
24502
24502
|
var import_base = require("@xyflow/react/dist/base.css");
|
|
24503
24503
|
var import_material19 = require("@mui/material");
|
|
24504
|
-
var
|
|
24505
|
-
var
|
|
24504
|
+
var import_react58 = require("@xyflow/react");
|
|
24505
|
+
var import_react59 = require("react");
|
|
24506
24506
|
|
|
24507
24507
|
// src/components/trace-graph/service-node.tsx
|
|
24508
24508
|
var import_material17 = require("@mui/material");
|
|
@@ -24653,56 +24653,6 @@ var ServiceNode = (0, import_react55.memo)(({ data, selected }) => {
|
|
|
24653
24653
|
|
|
24654
24654
|
// src/components/trace-graph/utils.ts
|
|
24655
24655
|
var import_dagre = __toESM(require("@dagrejs/dagre"), 1);
|
|
24656
|
-
var import_react56 = require("@xyflow/react");
|
|
24657
|
-
var generateNodesAndEdges = (event, parentId) => {
|
|
24658
|
-
const nodes = [];
|
|
24659
|
-
const edges = [];
|
|
24660
|
-
nodes.push({
|
|
24661
|
-
data: {
|
|
24662
|
-
data: { [event.span_id]: event },
|
|
24663
|
-
event,
|
|
24664
|
-
height: 28,
|
|
24665
|
-
id: event.span_id,
|
|
24666
|
-
position: { x: 0, y: 0 },
|
|
24667
|
-
width: 28
|
|
24668
|
-
},
|
|
24669
|
-
id: event.span_id,
|
|
24670
|
-
position: { x: 0, y: 0 },
|
|
24671
|
-
// Will be set by layout
|
|
24672
|
-
sourcePosition: import_react56.Position.Right,
|
|
24673
|
-
targetPosition: import_react56.Position.Left,
|
|
24674
|
-
type: "service"
|
|
24675
|
-
});
|
|
24676
|
-
if (parentId) {
|
|
24677
|
-
edges.push({
|
|
24678
|
-
animated: false,
|
|
24679
|
-
id: `e-${parentId}-${event.span_id}`,
|
|
24680
|
-
markerEnd: {
|
|
24681
|
-
color: "lightgray",
|
|
24682
|
-
height: 16,
|
|
24683
|
-
type: import_react56.MarkerType.Arrow,
|
|
24684
|
-
width: 16
|
|
24685
|
-
},
|
|
24686
|
-
source: parentId,
|
|
24687
|
-
style: {
|
|
24688
|
-
stroke: "lightgray",
|
|
24689
|
-
strokeWidth: 1
|
|
24690
|
-
},
|
|
24691
|
-
target: event.span_id
|
|
24692
|
-
});
|
|
24693
|
-
}
|
|
24694
|
-
if (event.children && event.children.length > 0) {
|
|
24695
|
-
for (const child of event.children) {
|
|
24696
|
-
const { edges: childEdges, nodes: childNodes } = generateNodesAndEdges(
|
|
24697
|
-
child,
|
|
24698
|
-
event.span_id
|
|
24699
|
-
);
|
|
24700
|
-
nodes.push(...childNodes);
|
|
24701
|
-
edges.push(...childEdges);
|
|
24702
|
-
}
|
|
24703
|
-
}
|
|
24704
|
-
return { edges, nodes };
|
|
24705
|
-
};
|
|
24706
24656
|
var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
|
|
24707
24657
|
const dagreGraph = new import_dagre.default.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
|
|
24708
24658
|
const direction = "LR";
|
|
@@ -24733,8 +24683,8 @@ var getLayoutedNodesAndEdges = (inputNodes, inputEdges) => {
|
|
|
24733
24683
|
// src/components/trace-graph/xyflow/controls.tsx
|
|
24734
24684
|
var import_icons_material10 = require("@mui/icons-material");
|
|
24735
24685
|
var import_material18 = require("@mui/material");
|
|
24736
|
-
var
|
|
24737
|
-
var
|
|
24686
|
+
var import_react56 = require("@xyflow/react");
|
|
24687
|
+
var import_react57 = require("react");
|
|
24738
24688
|
|
|
24739
24689
|
// node_modules/zustand/esm/shallow.mjs
|
|
24740
24690
|
function shallow$1(objA, objB) {
|
|
@@ -24781,9 +24731,9 @@ var selector = (s2) => ({
|
|
|
24781
24731
|
maxZoomReached: s2.transform[2] >= s2.maxZoom,
|
|
24782
24732
|
minZoomReached: s2.transform[2] <= s2.minZoom
|
|
24783
24733
|
});
|
|
24784
|
-
var Controls = (0,
|
|
24785
|
-
const { maxZoomReached, minZoomReached } = (0,
|
|
24786
|
-
const { fitView, zoomIn, zoomOut } = (0,
|
|
24734
|
+
var Controls = (0, import_react57.memo)(() => {
|
|
24735
|
+
const { maxZoomReached, minZoomReached } = (0, import_react56.useStore)(selector, shallow$1);
|
|
24736
|
+
const { fitView, zoomIn, zoomOut } = (0, import_react56.useReactFlow)();
|
|
24787
24737
|
const onZoomInHandler = () => {
|
|
24788
24738
|
void zoomIn();
|
|
24789
24739
|
};
|
|
@@ -24852,41 +24802,49 @@ var TraceGraph = ({
|
|
|
24852
24802
|
onRefresh,
|
|
24853
24803
|
spans
|
|
24854
24804
|
}) => {
|
|
24855
|
-
const [nodes, setNodes, onNodesChange] = (0,
|
|
24856
|
-
const [edges, setEdges] = (0,
|
|
24857
|
-
(0,
|
|
24858
|
-
const
|
|
24859
|
-
const
|
|
24860
|
-
for (const span of spans.data ?? []) {
|
|
24861
|
-
spansMap.set(span.span_id, { ...span, children: [] });
|
|
24862
|
-
}
|
|
24805
|
+
const [nodes, setNodes, onNodesChange] = (0, import_react58.useNodesState)([]);
|
|
24806
|
+
const [edges, setEdges] = (0, import_react58.useEdgesState)([]);
|
|
24807
|
+
(0, import_react59.useEffect)(() => {
|
|
24808
|
+
const allNodes = [];
|
|
24809
|
+
const allEdges = [];
|
|
24863
24810
|
for (const span of spans.data ?? []) {
|
|
24864
|
-
|
|
24865
|
-
|
|
24866
|
-
|
|
24867
|
-
|
|
24868
|
-
|
|
24869
|
-
|
|
24870
|
-
|
|
24871
|
-
|
|
24872
|
-
|
|
24873
|
-
|
|
24811
|
+
allNodes.push({
|
|
24812
|
+
data: {
|
|
24813
|
+
data: { [span.span_id]: span },
|
|
24814
|
+
event: span,
|
|
24815
|
+
height: 28,
|
|
24816
|
+
id: span.span_id,
|
|
24817
|
+
position: { x: 0, y: 0 },
|
|
24818
|
+
width: 28
|
|
24819
|
+
},
|
|
24820
|
+
id: span.span_id,
|
|
24821
|
+
position: { x: 0, y: 0 },
|
|
24822
|
+
sourcePosition: import_react58.Position.Right,
|
|
24823
|
+
targetPosition: import_react58.Position.Left,
|
|
24824
|
+
type: "service"
|
|
24825
|
+
});
|
|
24826
|
+
if (span.parent_span_id !== null) {
|
|
24827
|
+
allEdges.push({
|
|
24828
|
+
animated: false,
|
|
24829
|
+
id: `e-${span.parent_span_id}-${span.span_id}`,
|
|
24830
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react58.MarkerType.Arrow, width: 16 },
|
|
24831
|
+
source: span.parent_span_id,
|
|
24832
|
+
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
24833
|
+
target: span.span_id
|
|
24834
|
+
});
|
|
24874
24835
|
}
|
|
24875
24836
|
for (const linkedSpanId of span.linked_span_ids ?? []) {
|
|
24876
|
-
|
|
24877
|
-
|
|
24878
|
-
|
|
24879
|
-
|
|
24880
|
-
|
|
24837
|
+
allEdges.push({
|
|
24838
|
+
id: `e-link-${linkedSpanId}-${span.span_id}`,
|
|
24839
|
+
markerEnd: { color: "lightgray", height: 16, type: import_react58.MarkerType.Arrow, width: 16 },
|
|
24840
|
+
source: linkedSpanId,
|
|
24841
|
+
style: { stroke: "lightgray", strokeWidth: 1 },
|
|
24842
|
+
// animated: true,
|
|
24843
|
+
// style: { stroke: 'lightgray', strokeDasharray: '4 2', strokeWidth: 1 },
|
|
24844
|
+
target: span.span_id
|
|
24845
|
+
});
|
|
24881
24846
|
}
|
|
24882
24847
|
}
|
|
24883
|
-
let allNodes = [];
|
|
24884
|
-
let allEdges = [];
|
|
24885
|
-
for (const rootSpan of rootSpans) {
|
|
24886
|
-
const { edges: newEdges, nodes: newNodes } = generateNodesAndEdges(rootSpan);
|
|
24887
|
-
allNodes = [...allNodes, ...newNodes];
|
|
24888
|
-
allEdges = [...allEdges, ...newEdges];
|
|
24889
|
-
}
|
|
24890
24848
|
const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, allEdges);
|
|
24891
24849
|
for (const node of layoutedNodes) {
|
|
24892
24850
|
if (node.id === initialFocusEventId) {
|
|
@@ -24895,7 +24853,7 @@ var TraceGraph = ({
|
|
|
24895
24853
|
}
|
|
24896
24854
|
setNodes(layoutedNodes);
|
|
24897
24855
|
setEdges(layoutedEdges);
|
|
24898
|
-
}, [spans.data, initialFocusEventId, setNodes]);
|
|
24856
|
+
}, [spans.data, initialFocusEventId, setNodes, setEdges]);
|
|
24899
24857
|
const theme = (0, import_material19.useTheme)();
|
|
24900
24858
|
return /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(import_jsx_runtime141.Fragment, { children: [
|
|
24901
24859
|
spans.error && /* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
|
|
@@ -24913,7 +24871,7 @@ var TraceGraph = ({
|
|
|
24913
24871
|
}
|
|
24914
24872
|
),
|
|
24915
24873
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsxs)(
|
|
24916
|
-
|
|
24874
|
+
import_react58.ReactFlow,
|
|
24917
24875
|
{
|
|
24918
24876
|
"data-testid": "trace-graph",
|
|
24919
24877
|
edges,
|
|
@@ -24932,7 +24890,7 @@ var TraceGraph = ({
|
|
|
24932
24890
|
children: [
|
|
24933
24891
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(Controls, {}),
|
|
24934
24892
|
/* @__PURE__ */ (0, import_jsx_runtime141.jsx)(
|
|
24935
|
-
|
|
24893
|
+
import_react58.Background,
|
|
24936
24894
|
{
|
|
24937
24895
|
bgColor: theme.palette.background.paper,
|
|
24938
24896
|
color: theme.palette.text.disabled
|
|
@@ -25037,7 +24995,7 @@ var TraceGraphView = ({
|
|
|
25037
24995
|
height: "100%",
|
|
25038
24996
|
overflow: "auto"
|
|
25039
24997
|
},
|
|
25040
|
-
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
24998
|
+
children: traceId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(import_react60.ReactFlowProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
25041
24999
|
TraceGraph,
|
|
25042
25000
|
{
|
|
25043
25001
|
initialFocusEventId: spanId,
|
|
@@ -25098,10 +25056,10 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
|
|
|
25098
25056
|
}
|
|
25099
25057
|
var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
25100
25058
|
const api = useAppInspectorApi();
|
|
25101
|
-
const [spans, setSpans] = (0,
|
|
25102
|
-
const [loading, setLoading] = (0,
|
|
25103
|
-
const [fetchError, setFetchError] = (0,
|
|
25104
|
-
const fetchSpans = (0,
|
|
25059
|
+
const [spans, setSpans] = (0, import_react61.useState)();
|
|
25060
|
+
const [loading, setLoading] = (0, import_react61.useState)(false);
|
|
25061
|
+
const [fetchError, setFetchError] = (0, import_react61.useState)();
|
|
25062
|
+
const fetchSpans = (0, import_react61.useCallback)(async () => {
|
|
25105
25063
|
setLoading(true);
|
|
25106
25064
|
try {
|
|
25107
25065
|
const spans2 = await fetchConnectedTraces(api, [traceId]);
|
|
@@ -25114,28 +25072,28 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
|
|
|
25114
25072
|
setLoading(false);
|
|
25115
25073
|
}
|
|
25116
25074
|
}, [api, traceId]);
|
|
25117
|
-
(0,
|
|
25075
|
+
(0, import_react61.useEffect)(() => {
|
|
25118
25076
|
void fetchSpans();
|
|
25119
25077
|
}, [fetchSpans]);
|
|
25120
|
-
const [open, setOpen] = (0,
|
|
25121
|
-
const [selectedEvent, setSelectedEvent] = (0,
|
|
25122
|
-
const spansReference = (0,
|
|
25123
|
-
(0,
|
|
25078
|
+
const [open, setOpen] = (0, import_react61.useState)(true);
|
|
25079
|
+
const [selectedEvent, setSelectedEvent] = (0, import_react61.useState)(() => spans?.find((span) => span.span_id === spanId));
|
|
25080
|
+
const spansReference = (0, import_react61.useRef)();
|
|
25081
|
+
(0, import_react61.useEffect)(() => {
|
|
25124
25082
|
if (!spansReference.current && spans) {
|
|
25125
25083
|
setSelectedEvent(spans.find((span) => span.span_id === spanId));
|
|
25126
25084
|
spansReference.current = spans;
|
|
25127
25085
|
}
|
|
25128
25086
|
}, [spans, setSelectedEvent, spanId]);
|
|
25129
25087
|
const { checkStatus, error: statusError, status } = useStatus();
|
|
25130
|
-
const handleEventSelect = (0,
|
|
25088
|
+
const handleEventSelect = (0, import_react61.useCallback)((spanId2) => {
|
|
25131
25089
|
const span = spans?.find((s2) => s2.span_id === spanId2);
|
|
25132
25090
|
setSelectedEvent(span);
|
|
25133
25091
|
setOpen(true);
|
|
25134
25092
|
}, [spans]);
|
|
25135
|
-
const handleRetry = (0,
|
|
25093
|
+
const handleRetry = (0, import_react61.useCallback)(() => {
|
|
25136
25094
|
void checkStatus();
|
|
25137
25095
|
}, [checkStatus]);
|
|
25138
|
-
const navigateToSpansList = (0,
|
|
25096
|
+
const navigateToSpansList = (0, import_react61.useCallback)(() => {
|
|
25139
25097
|
onClose?.();
|
|
25140
25098
|
}, [onClose]);
|
|
25141
25099
|
return /* @__PURE__ */ (0, import_jsx_runtime142.jsx)(
|
|
@@ -25181,17 +25139,17 @@ var SpansListPage = () => {
|
|
|
25181
25139
|
streamPaused,
|
|
25182
25140
|
toggleStream
|
|
25183
25141
|
} = useSpans();
|
|
25184
|
-
const clearSpansSync = (0,
|
|
25142
|
+
const clearSpansSync = (0, import_react62.useCallback)(() => {
|
|
25185
25143
|
void clearSpans();
|
|
25186
25144
|
}, [clearSpans]);
|
|
25187
25145
|
const [order2, setOrder] = useLocalStorage("spans-order", "oldest_first");
|
|
25188
|
-
const [selectedTraceId, setSelectedTraceId] = (0,
|
|
25189
|
-
const [selectedSpanId, setSelectedSpanId] = (0,
|
|
25190
|
-
const navigateToSpan = (0,
|
|
25146
|
+
const [selectedTraceId, setSelectedTraceId] = (0, import_react62.useState)();
|
|
25147
|
+
const [selectedSpanId, setSelectedSpanId] = (0, import_react62.useState)();
|
|
25148
|
+
const navigateToSpan = (0, import_react62.useCallback)((span) => {
|
|
25191
25149
|
setSelectedTraceId(span.trace_id);
|
|
25192
25150
|
setSelectedSpanId(span.span_id);
|
|
25193
25151
|
}, []);
|
|
25194
|
-
const handleRetry = (0,
|
|
25152
|
+
const handleRetry = (0, import_react62.useCallback)(() => {
|
|
25195
25153
|
void checkStatus();
|
|
25196
25154
|
}, [checkStatus]);
|
|
25197
25155
|
const shouldShowStatusMessage = Boolean(statusError) || status?.status === "DISABLED";
|