Commit graph

4 commits

Author SHA1 Message Date
jedarden
e74149f167 feat(bd-zci): map OTLP metrics → analytics DB instruments
Fix histogram data point value extraction in normalizer — OTLP histogram
points carry sum/count instead of asDouble/asInt, so needle.bead.duration
was silently dropped. Add MetricAccumulator tests and end-to-end tests
validating OTLP metrics flow through to session_worker_summaries in
fabric.db with otlp-metric source preference.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 17:06:45 -04:00
jedarden
0f7aced61b feat(bd-9jm): add LRU event dedup keyed on (session_id, worker_id, sequence)
When FABRIC ingests events from both JSONL and OTLP sources, the same
logical event can arrive twice. EventDeduplicator keeps the first
arrival and silently drops duplicates with a counter for observability.
Events with sequence < 0 (legacy formats) always pass through.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 14:45:31 -04:00
jedarden
6805bff904 feat(bd-qtg): map OTLP spans → paired started/finished events for DAG
- normalizeOtlpSpanStart: emit {name}.started with span_id/parent_span_id/trace_id
- normalizeOtlpSpanEnd: emit {name}.finished with duration_ms and span attributes
- needleEventToLogEvent: promote span_id, parent_span_id, trace_id, span_name
- dagUtils: add buildSpanDag() using parent_span_id for parent-child linkage
- dagUtils: add findSpansForBead() for bead-to-span lookup
- Add integration test confirming bead lifecycle renders as DAG node with children
- Add namespaced OTLP attribute resolution (needle.worker.id etc.)
- Add OTLP body (AnyValue) extraction for logs

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 14:34:28 -04:00
jedarden
f67868bea5 feat(bd-h40): extract Normalizer component — decouple parse from ingest
- Create src/normalizer.ts with normalize(raw, source): NeedleEvent supporting
  all 5 sources: jsonl, otlp-log, otlp-span-start, otlp-span-end, otlp-metric
- Move JSONL parsing logic (canonical, legacy NEEDLE, flat legacy) from
  parser.ts into normalizer.ts
- Refactor parser.ts to thin facade delegating to normalizer
- Tailer now imports directly from normalizer (pure source, no parse coupling)
- Add 63 unit tests covering all source paths, edge cases, and cross-source
  parity between JSONL and OTLP-log

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 12:34:30 -04:00