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>
This commit is contained in:
developerandClaude Sonnet 5 committed 2026-09-17 09:30:18 +00:00
1 parent 0ed1cb4355
commit f77b89a779
13 files changed
+473 -88

No files matched your search

+10
View File
@@ -95,6 +95,16 @@ gRPC services for traces, metrics, and logs using standard OTLP protobuf definit
- `GET /api/history/traces` - Retrieve only trace history
- `GET /api/history/metrics` - Retrieve only metrics history
- `GET /api/history/logs` - Retrieve only logs history
- `GET /api/history/search` - Search history. Supports `q` (free-text
substring), `type`, `since`/`until` (unix nanoseconds), and `limit`.
- `GET /api/history/wait` - Block until a matching entry arrives. Same
filters as `search`, plus `timeout` (seconds, default 30). Rate-limited
per client IP.
- `GET /api/traces/{traceId}` - Retrieve all stored entries (spans and
correlated logs) referencing a given trace id.
All endpoints above search the full persistent store (when `OTELLOG_PATH`
storage is enabled), not just the in-memory ring buffer.
### Web Interface