@localstack/appinspector-ui 1.0.146 → 1.0.147

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.js CHANGED
@@ -32082,10 +32082,17 @@ var TraceGraph = ({
32082
32082
  });
32083
32083
  }
32084
32084
  }
32085
+ allNodes.sort((a3, b3) => {
32086
+ const tsA = a3.data.event.start_time_unix_nano;
32087
+ const tsB = b3.data.event.start_time_unix_nano;
32088
+ return tsA < tsB ? -1 : tsA > tsB ? 1 : 0;
32089
+ });
32085
32090
  const knownSpanIds = new Set(allNodes.map((node) => node.id));
32086
- const validEdges = allEdges.filter(
32087
- (edge) => knownSpanIds.has(edge.source) && knownSpanIds.has(edge.target)
32088
- );
32091
+ const validEdges = allEdges.filter((edge) => knownSpanIds.has(edge.source) && knownSpanIds.has(edge.target)).toSorted((edgeA, edgeB) => {
32092
+ const tsA = allNodes.find((n) => n.id === edgeA.target)?.data.event.start_time_unix_nano ?? "";
32093
+ const tsB = allNodes.find((n) => n.id === edgeB.target)?.data.event.start_time_unix_nano ?? "";
32094
+ return tsA < tsB ? -1 : tsA > tsB ? 1 : 0;
32095
+ });
32089
32096
  const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, validEdges);
32090
32097
  for (const node of layoutedNodes) {
32091
32098
  if (node.id === initialFocusEventId) {
@@ -32248,7 +32255,14 @@ var TraceGraphView = ({
32248
32255
  ]
32249
32256
  }
32250
32257
  );
32251
- async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32258
+ async function fetchConnectedTraces(api, traceId) {
32259
+ const response = await api.getSpans({ trace_id: traceId, with_span_links: true });
32260
+ if (response.with_span_links) {
32261
+ return response.spans;
32262
+ }
32263
+ return fetchConnectedTracesWaterfall(api, [traceId]);
32264
+ }
32265
+ async function fetchConnectedTracesWaterfall(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32252
32266
  const newTraceIds = traceIds.filter((id2) => !processedTraceIds.has(id2));
32253
32267
  if (newTraceIds.length === 0) {
32254
32268
  return [...allSpans.values()];
@@ -32273,7 +32287,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
32273
32287
  }
32274
32288
  }
32275
32289
  if (discoveredTraceIds.size > 0) {
32276
- return fetchConnectedTraces(
32290
+ return fetchConnectedTracesWaterfall(
32277
32291
  api,
32278
32292
  [...discoveredTraceIds],
32279
32293
  allSpans,
@@ -32291,7 +32305,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
32291
32305
  const fetchSpans = useCallback10(async () => {
32292
32306
  setLoading(true);
32293
32307
  try {
32294
- const spans2 = await fetchConnectedTraces(api, [traceId]);
32308
+ const spans2 = await fetchConnectedTraces(api, traceId);
32295
32309
  setSpans(spans2);
32296
32310
  setFetchError(void 0);
32297
32311
  } catch (error) {