Files
music_library/backlog/tasks/ml-162 - Expose-production-errors-via-JSON-API-endpoint.md
T
2026-05-04 09:17:16 +01:00

1.9 KiB

id, title, status, assignee, created_date, updated_date, labels, dependencies, parent_task_id, priority, ordinal
id title status assignee created_date updated_date labels dependencies parent_task_id priority ordinal
ML-162 Expose production errors via JSON API endpoint To Do
2026-05-04 08:08 2026-05-04 08:10
api
elixir
backend
DRAFT-1 medium 7000

Description

Add an API controller and routes under /api/v1/errors to expose ErrorTracker data as JSON, behind the existing Bearer token auth.

This subtask covers the server-side work only: controller, JSON serialization, context queries, and routes. The pi tooling and extensions are covered by separate subtasks.

API design

GET /api/v1/errors — List errors

  • Query params: status (resolved/unresolved), muted (true/false), search (substring match on reason), limit (default 50), offset (default 0)
  • Returns: { errors: [...], total: n, limit: n, offset: n }
  • Each error includes: id, kind, reason, source_line, source_function, status, fingerprint, last_occurrence_at, muted, inserted_at, updated_at, occurrence_count, first_occurrence_at

GET /api/v1/errors/:id — Single error detail

  • Returns the error with all its occurrences (with stacktraces), sorted by inserted_at desc
  • Each occurrence includes: id, reason, context, breadcrumbs, stacktrace (lines), inserted_at

Data attributes (canonical — shared with all subtasks)

Error fields: id, kind, reason, source_line, source_function, status, fingerprint, last_occurrence_at, muted, inserted_at, updated_at Occurrence fields: id, reason, context, breadcrumbs, stacktrace (with lines), error_id, inserted_at Computed: occurrence_count, first_occurrence_at

Dependencies

  • Uses MusicLibrary.TelemetryRepo (already exists)
  • Uses the error_tracker_errors and error_tracker_occurrences tables (already exist)
  • Auth via existing require_api_token plug (already in use by /api/v1 pipeline)