Files
go-otel/docs/PLAN.md
T
developerandClaude Sonnet 5 f77b89a779 Improve agent-facing history endpoints (Phase 1)
- Fix /api/history/{type} to search the full persistent store instead of
  only the bounded in-memory ring buffer, so filtered history isn't
  silently truncated.
- Add structured type/since/until filters to /api/history/search and
  /api/history/wait, alongside the existing free-text query.
- Add GET /api/traces/{traceId} to fetch all entries for a trace in one
  call instead of relying on substring search.
- Rate-limit /api/history/wait per client IP.
- Add docs/PLAN.md tracking the phased improvement plan; update README
  and agents_example.md for the new/changed endpoints.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-17 09:30:18 +00:00

2.2 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 at historySize, default 100) instead of the persistent store, so /api/history/traces|metrics|logs silently returned far less than /api/history/search could see. Now routed through SearchHistory.
  • Structured filters on /api/history/search and /api/history/wait: type=, since=, until= (unix nanoseconds), combinable with the existing free-text q=.
  • 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.json or an MCP server) replacing agents_example.md (deferred).

Phase 2 — Recent issues for the web UI

  • Fingerprint spans with status=ERROR/exception events and logs with severity >= ERROR into deduped Issues (count, firstSeen, lastSeen, sample entries, affected services), updated incrementally on ingest.
  • GET /api/issues, GET /api/issues/{id}.
  • UI "Issues" tab (lives in the separate frontend/dist project).

Phase 3 — Frontend error collector (Sentry-style)

  • static/otel-rum.js: captures window.onerror, unhandledrejection, resource load failures; translates them to OTLP log records client-side and POSTs to the existing /v1/logs endpoint (so Phase 2's issue derivation picks them up for free via a source: frontend attribute).
  • 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.