@neat.is/core 0.4.4 → 0.4.6

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/neatd.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  startDaemon
4
- } from "./chunk-J4YBTD24.js";
4
+ } from "./chunk-NON5AXOR.js";
5
5
  import {
6
6
  listProjects,
7
7
  registryPath
8
- } from "./chunk-G3YGPWJL.js";
8
+ } from "./chunk-RBWL4HRB.js";
9
9
  import {
10
10
  BindAuthorityError,
11
11
  __require
12
- } from "./chunk-ZVNP3ZDH.js";
12
+ } from "./chunk-HVF4S7J3.js";
13
13
 
14
14
  // src/neatd.ts
15
15
  import { promises as fs } from "fs";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  reshapeGrpcRequest,
3
3
  startOtelGrpcReceiver
4
- } from "./chunk-YJOA7BBF.js";
5
- import "./chunk-ZVNP3ZDH.js";
4
+ } from "./chunk-3QCRUEQD.js";
5
+ import "./chunk-HVF4S7J3.js";
6
6
  export {
7
7
  reshapeGrpcRequest,
8
8
  startOtelGrpcReceiver
9
9
  };
10
- //# sourceMappingURL=otel-grpc-FIERFRGD.js.map
10
+ //# sourceMappingURL=otel-grpc-VSPMP3OS.js.map
package/dist/server.cjs CHANGED
@@ -336,12 +336,15 @@ function parseOtlpRequest(body) {
336
336
  const out = [];
337
337
  for (const rs of body.resourceSpans ?? []) {
338
338
  const resourceAttrs = attrsToRecord(rs.resource?.attributes);
339
- const service = typeof resourceAttrs["service.name"] === "string" ? resourceAttrs["service.name"] : "unknown";
339
+ const rawServiceName = resourceAttrs["service.name"];
340
+ const resourceServiceNamePresent = typeof rawServiceName === "string" && rawServiceName.length > 0;
341
+ const service = resourceServiceNamePresent ? rawServiceName : "unidentified";
340
342
  for (const ss of rs.scopeSpans ?? []) {
341
343
  for (const span of ss.spans ?? []) {
342
344
  const attrs = attrsToRecord(span.attributes);
343
345
  const parsed = {
344
346
  service,
347
+ resourceServiceNamePresent,
345
348
  traceId: span.traceId ?? "",
346
349
  spanId: span.spanId ?? "",
347
350
  parentSpanId: span.parentSpanId || void 0,
@@ -1828,6 +1831,14 @@ function thresholdForEdgeType(edgeType, overrides) {
1828
1831
  function nowIso(ctx) {
1829
1832
  return new Date(ctx.now ? ctx.now() : Date.now()).toISOString();
1830
1833
  }
1834
+ var unidentifiedWarnedProjects = /* @__PURE__ */ new Set();
1835
+ function warnUnidentifiedSpan(project) {
1836
+ if (unidentifiedWarnedProjects.has(project)) return;
1837
+ unidentifiedWarnedProjects.add(project);
1838
+ console.warn(
1839
+ `[neatd] span lacked service.name; routed to 'unidentified' in project ${project}; check your OTel SDK config.`
1840
+ );
1841
+ }
1831
1842
  function pickAttr(span, ...keys) {
1832
1843
  for (const k of keys) {
1833
1844
  const v = span.attributes[k];
@@ -2057,6 +2068,9 @@ async function handleSpan(ctx, span) {
2057
2068
  const ts = span.startTimeIso ?? nowIso(ctx);
2058
2069
  const nowMs = ctx.now ? ctx.now() : Date.now();
2059
2070
  const env = span.env ?? "unknown";
2071
+ if (span.resourceServiceNamePresent === false) {
2072
+ warnUnidentifiedSpan(ctx.project ?? DEFAULT_PROJECT);
2073
+ }
2060
2074
  const sourceId = ensureServiceNode(ctx.graph, span.service, env);
2061
2075
  const isError = span.statusCode === 2;
2062
2076
  cacheSpanService(span, nowMs);