Commit graph

3 commits

Author SHA1 Message Date
jedarden
af1560fba1 feat(bd-zci): add instrument alias resolution and source-priority upserts
- Add INSTRUMENT_ALIASES map resolving NEEDLE's plural naming
  (needle.worker.beads.*) to canonical singular (needle.bead.*)
- Source-priority SQL in upsertSessionWorkerSummary: otlp-metric rows
  survive lower-priority log-derived overwrites via CASE expressions
- Prefer OTLP metric snapshots over log-derived estimates in task
  recording (flushMetricSamples + persistSession)
- Document accepted aliases in docs/schema.md
- Add tests for alias resolution, coaccumulation, and priority protection

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 18:16:39 -04:00
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
jeda
eedff8acc2 feat(bd-msa): Implement worker analytics aggregation
Comprehensive worker performance metrics tracking system:

Features:
- Beads per hour calculation
- Average completion time tracking
- Error rate monitoring
- Cost per bead calculation (USD)
- Idle percentage tracking
- Time-series data storage and retrieval
- Performance trend analysis
- Aggregated analytics across all workers

Implementation:
- Added WorkerAnalytics types to types.ts
- Created workerAnalytics.ts module with full aggregation logic
- Integrated with EventStore for automatic event processing
- 25 comprehensive unit tests (all passing)
- Exported from index.ts for public API access

Technical highlights:
- Automatic activity period detection with 5-minute gap threshold
- Time-series snapshots at configurable intervals (default 1 hour)
- Flexible time window filtering (hour/day/week/all)
- Worker ranking by performance, error rate, and cost efficiency
- Performance trend detection (improving/declining/stable)

Co-Authored-By: Claude Worker <noreply@anthropic.com>
2026-03-04 03:46:28 +00:00