- Add internal/issues.Tracker: fingerprints (kind, service, title) into
deduplicated Issues with count/firstSeen/lastSeen/affected services and
bounded sample occurrences, evicting the least-recently-seen issue once
a cap is reached.
- Add internal/collector/issue_extract.go to pull issues out of ingested
OTLP data: spans with an error status (preferring exception.type/message
from an "exception" event, falling back to the span status message), and
logs at ERROR/FATAL severity (by severity number or text).
- Wire extraction into Collector.ConsumeTraces/ConsumeLogs and expose
GET /api/issues and GET /api/issues/{id}.
- Fix a pre-existing data race in the collector test's mockStore (unsynced
access to entries while addToHistory appends asynchronously), found via
`go test -race` while adding the new issue-tracking tests.
- Update docs/PLAN.md, README.md and agents_example.md for the new API.
The UI "Issues" tab itself lives in the separate frontend project that
builds this server's dist/ bundle; this commit only covers the backend.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
Improvement plan
Priority order: (1) agent endpoints, (2) recent issues for the web UI, (3) a Sentry-like frontend error collector.
Phase 1 — Agent endpoints (highest priority)
- Fix
HandleHistoryByType: it only filtered the in-memory ring buffer (capped athistorySize, default 100) instead of the persistent store, so/api/history/traces|metrics|logssilently returned far less than/api/history/searchcould see. Now routed throughSearchHistory. - Structured filters on
/api/history/searchand/api/history/wait:type=,since=,until=(unix nanoseconds), combinable with the existing free-textq=. GET /api/traces/{traceId}— assemble all entries referencing one trace id in a single call, instead of relying on substring search matching the id inside raw JSON.- Basic per-IP rate limiting on
/api/history/wait(a blocking long-poll, cheap to abuse). - Cursor-based pagination for
/api/history/search(deferred). - Machine-readable tool manifest (
/.well-known/agent-tools.jsonor an MCP server) replacingagents_example.md(deferred).
Phase 2 — Recent issues for the web UI
- Fingerprint spans with
status=ERROR/exception events and logs withseverity >= ERRORinto deduped Issues (count, firstSeen, lastSeen, sample entries, affected services), updated incrementally on ingest.internal/issues(fingerprinting/dedup) +internal/collector/issue_extract.go(OTLP field extraction). GET /api/issues,GET /api/issues/{id}.- UI "Issues" tab (lives in the separate frontend/
distproject — this repo's API is ready for it).
Phase 3 — Frontend error collector (Sentry-style)
static/otel-rum.js: captureswindow.onerror,unhandledrejection, resource load failures; translates them to OTLP log records client-side and POSTs to the existing/v1/logsendpoint (so Phase 2's issue derivation picks them up for free via asource: frontendattribute).- CORS support on the OTLP HTTP endpoints (currently absent — required for any browser-origin POST).
- Lightweight ingest key for scoping/rate-limiting noisy pages (not real auth).
- Explicitly out of scope for v1: source map resolution, session replay, PII scrubbing.