@neat.is/core 0.4.20-dev.20260619 → 0.4.20-dev.20260621

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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  routeSpanToProject,
3
3
  startDaemon
4
- } from "./chunk-ZV7GHZ2D.js";
4
+ } from "./chunk-IWGDXLXA.js";
5
5
  import {
6
6
  ProjectNameCollisionError,
7
7
  addProject,
@@ -37,7 +37,7 @@ import {
37
37
  thresholdForEdgeType,
38
38
  touchLastSeen,
39
39
  writeAtomically
40
- } from "./chunk-Q5EDVWKZ.js";
40
+ } from "./chunk-RVOCG6UZ.js";
41
41
  import {
42
42
  startOtelGrpcReceiver
43
43
  } from "./chunk-MTXF77TN.js";
package/dist/neatd.cjs CHANGED
@@ -1888,13 +1888,14 @@ var parentSpanCache = /* @__PURE__ */ new Map();
1888
1888
  function parentSpanKey(traceId, spanId) {
1889
1889
  return `${traceId}:${spanId}`;
1890
1890
  }
1891
- function cacheSpanService(span, now) {
1891
+ function cacheSpanService(span, now, callSite) {
1892
1892
  if (!span.traceId || !span.spanId) return;
1893
1893
  const key = parentSpanKey(span.traceId, span.spanId);
1894
1894
  parentSpanCache.delete(key);
1895
1895
  parentSpanCache.set(key, {
1896
1896
  service: span.service,
1897
1897
  env: span.env ?? "unknown",
1898
+ ...callSite ? { callSite } : {},
1898
1899
  expiresAt: now + PARENT_SPAN_CACHE_TTL_MS
1899
1900
  });
1900
1901
  while (parentSpanCache.size > PARENT_SPAN_CACHE_SIZE) {
@@ -1910,7 +1911,11 @@ function lookupParentSpan(traceId, parentSpanId, now) {
1910
1911
  parentSpanCache.delete(parentSpanKey(traceId, parentSpanId));
1911
1912
  return null;
1912
1913
  }
1913
- return { service: entry2.service, env: entry2.env };
1914
+ return {
1915
+ service: entry2.service,
1916
+ env: entry2.env,
1917
+ ...entry2.callSite ? { callSite: entry2.callSite } : {}
1918
+ };
1914
1919
  }
1915
1920
  function resolveServiceId(graph, host, env) {
1916
1921
  const envTagged = (0, import_types3.serviceId)(host, env);
@@ -2183,9 +2188,9 @@ async function handleSpan(ctx, span) {
2183
2188
  }
2184
2189
  const sourceId = ensureServiceNode(ctx.graph, span.service, env);
2185
2190
  const isError = span.statusCode === 2;
2186
- cacheSpanService(span, nowMs);
2187
2191
  const sourceServiceNode = ctx.graph.getNodeAttributes(sourceId);
2188
2192
  const callSite = callSiteFromSpan(span, sourceServiceNode, ctx.scanPath);
2193
+ cacheSpanService(span, nowMs, callSite);
2189
2194
  const observedSource = () => callSite ? ensureObservedFileNode(ctx.graph, span.service, sourceId, callSite) : sourceId;
2190
2195
  const callSiteEvidence = callSite ? { file: callSite.relPath, ...callSite.line !== void 0 ? { line: callSite.line } : {} } : void 0;
2191
2196
  let affectedNode = sourceId;
@@ -2242,13 +2247,19 @@ async function handleSpan(ctx, span) {
2242
2247
  const parent = lookupParentSpan(span.traceId, span.parentSpanId, nowMs);
2243
2248
  if (parent && parent.service !== span.service) {
2244
2249
  const parentId = ensureServiceNode(ctx.graph, parent.service, parent.env);
2250
+ const fallbackSource = parent.callSite ? ensureObservedFileNode(ctx.graph, parent.service, parentId, parent.callSite) : parentId;
2251
+ const fallbackEvidence = parent.callSite ? {
2252
+ file: parent.callSite.relPath,
2253
+ ...parent.callSite.line !== void 0 ? { line: parent.callSite.line } : {}
2254
+ } : void 0;
2245
2255
  upsertObservedEdge(
2246
2256
  ctx.graph,
2247
2257
  import_types3.EdgeType.CALLS,
2248
- parentId,
2258
+ fallbackSource,
2249
2259
  sourceId,
2250
2260
  ts,
2251
- isError
2261
+ isError,
2262
+ fallbackEvidence
2252
2263
  );
2253
2264
  }
2254
2265
  }