@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.cjs CHANGED
@@ -1953,13 +1953,14 @@ var parentSpanCache = /* @__PURE__ */ new Map();
1953
1953
  function parentSpanKey(traceId, spanId) {
1954
1954
  return `${traceId}:${spanId}`;
1955
1955
  }
1956
- function cacheSpanService(span, now) {
1956
+ function cacheSpanService(span, now, callSite) {
1957
1957
  if (!span.traceId || !span.spanId) return;
1958
1958
  const key = parentSpanKey(span.traceId, span.spanId);
1959
1959
  parentSpanCache.delete(key);
1960
1960
  parentSpanCache.set(key, {
1961
1961
  service: span.service,
1962
1962
  env: span.env ?? "unknown",
1963
+ ...callSite ? { callSite } : {},
1963
1964
  expiresAt: now + PARENT_SPAN_CACHE_TTL_MS
1964
1965
  });
1965
1966
  while (parentSpanCache.size > PARENT_SPAN_CACHE_SIZE) {
@@ -1975,7 +1976,11 @@ function lookupParentSpan(traceId, parentSpanId, now) {
1975
1976
  parentSpanCache.delete(parentSpanKey(traceId, parentSpanId));
1976
1977
  return null;
1977
1978
  }
1978
- return { service: entry.service, env: entry.env };
1979
+ return {
1980
+ service: entry.service,
1981
+ env: entry.env,
1982
+ ...entry.callSite ? { callSite: entry.callSite } : {}
1983
+ };
1979
1984
  }
1980
1985
  function resolveServiceId(graph, host, env) {
1981
1986
  const envTagged = (0, import_types3.serviceId)(host, env);
@@ -2248,9 +2253,9 @@ async function handleSpan(ctx, span) {
2248
2253
  }
2249
2254
  const sourceId = ensureServiceNode(ctx.graph, span.service, env);
2250
2255
  const isError = span.statusCode === 2;
2251
- cacheSpanService(span, nowMs);
2252
2256
  const sourceServiceNode = ctx.graph.getNodeAttributes(sourceId);
2253
2257
  const callSite = callSiteFromSpan(span, sourceServiceNode, ctx.scanPath);
2258
+ cacheSpanService(span, nowMs, callSite);
2254
2259
  const observedSource = () => callSite ? ensureObservedFileNode(ctx.graph, span.service, sourceId, callSite) : sourceId;
2255
2260
  const callSiteEvidence = callSite ? { file: callSite.relPath, ...callSite.line !== void 0 ? { line: callSite.line } : {} } : void 0;
2256
2261
  let affectedNode = sourceId;
@@ -2307,13 +2312,19 @@ async function handleSpan(ctx, span) {
2307
2312
  const parent = lookupParentSpan(span.traceId, span.parentSpanId, nowMs);
2308
2313
  if (parent && parent.service !== span.service) {
2309
2314
  const parentId = ensureServiceNode(ctx.graph, parent.service, parent.env);
2315
+ const fallbackSource = parent.callSite ? ensureObservedFileNode(ctx.graph, parent.service, parentId, parent.callSite) : parentId;
2316
+ const fallbackEvidence = parent.callSite ? {
2317
+ file: parent.callSite.relPath,
2318
+ ...parent.callSite.line !== void 0 ? { line: parent.callSite.line } : {}
2319
+ } : void 0;
2310
2320
  upsertObservedEdge(
2311
2321
  ctx.graph,
2312
2322
  import_types3.EdgeType.CALLS,
2313
- parentId,
2323
+ fallbackSource,
2314
2324
  sourceId,
2315
2325
  ts,
2316
- isError
2326
+ isError,
2327
+ fallbackEvidence
2317
2328
  );
2318
2329
  }
2319
2330
  }