@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.cjs CHANGED
@@ -32066,10 +32066,17 @@ var TraceGraph = ({
32066
32066
  });
32067
32067
  }
32068
32068
  }
32069
+ allNodes.sort((a3, b3) => {
32070
+ const tsA = a3.data.event.start_time_unix_nano;
32071
+ const tsB = b3.data.event.start_time_unix_nano;
32072
+ return tsA < tsB ? -1 : tsA > tsB ? 1 : 0;
32073
+ });
32069
32074
  const knownSpanIds = new Set(allNodes.map((node) => node.id));
32070
- const validEdges = allEdges.filter(
32071
- (edge) => knownSpanIds.has(edge.source) && knownSpanIds.has(edge.target)
32072
- );
32075
+ const validEdges = allEdges.filter((edge) => knownSpanIds.has(edge.source) && knownSpanIds.has(edge.target)).toSorted((edgeA, edgeB) => {
32076
+ const tsA = allNodes.find((n) => n.id === edgeA.target)?.data.event.start_time_unix_nano ?? "";
32077
+ const tsB = allNodes.find((n) => n.id === edgeB.target)?.data.event.start_time_unix_nano ?? "";
32078
+ return tsA < tsB ? -1 : tsA > tsB ? 1 : 0;
32079
+ });
32073
32080
  const { edges: layoutedEdges, nodes: layoutedNodes } = getLayoutedNodesAndEdges(allNodes, validEdges);
32074
32081
  for (const node of layoutedNodes) {
32075
32082
  if (node.id === initialFocusEventId) {
@@ -32232,7 +32239,14 @@ var TraceGraphView = ({
32232
32239
  ]
32233
32240
  }
32234
32241
  );
32235
- async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32242
+ async function fetchConnectedTraces(api, traceId) {
32243
+ const response = await api.getSpans({ trace_id: traceId, with_span_links: true });
32244
+ if (response.with_span_links) {
32245
+ return response.spans;
32246
+ }
32247
+ return fetchConnectedTracesWaterfall(api, [traceId]);
32248
+ }
32249
+ async function fetchConnectedTracesWaterfall(api, traceIds, allSpans = /* @__PURE__ */ new Map(), processedTraceIds = /* @__PURE__ */ new Set()) {
32236
32250
  const newTraceIds = traceIds.filter((id2) => !processedTraceIds.has(id2));
32237
32251
  if (newTraceIds.length === 0) {
32238
32252
  return [...allSpans.values()];
@@ -32257,7 +32271,7 @@ async function fetchConnectedTraces(api, traceIds, allSpans = /* @__PURE__ */ ne
32257
32271
  }
32258
32272
  }
32259
32273
  if (discoveredTraceIds.size > 0) {
32260
- return fetchConnectedTraces(
32274
+ return fetchConnectedTracesWaterfall(
32261
32275
  api,
32262
32276
  [...discoveredTraceIds],
32263
32277
  allSpans,
@@ -32275,7 +32289,7 @@ var TraceGraphPage = ({ onClose, spanId, traceId }) => {
32275
32289
  const fetchSpans = (0, import_react62.useCallback)(async () => {
32276
32290
  setLoading(true);
32277
32291
  try {
32278
- const spans2 = await fetchConnectedTraces(api, [traceId]);
32292
+ const spans2 = await fetchConnectedTraces(api, traceId);
32279
32293
  setSpans(spans2);
32280
32294
  setFetchError(void 0);
32281
32295
  } catch (error) {