refactor: DLQ metrics come from spans, and DLQMetrics is gone

Merged
HA
19h ago
+394-251

Summary

Part of #389, the DLQ area. The seven DLQ metrics now come from spans instead of DLQMetrics, exported the way #394 set up. A retry whose publish failed was never recorded, so dlq_processing_errors_total stayed empty, and a drained topic kept its last dlq_queue_size until the worker restarted.

Changes

DLQManager opens dlq.handle, dlq.retry and dlq.discard spans with topic, event type, outcome, retry result, error type and discard reason, and the 10 s job puts each topic's size on a dlq.queue_size span. The collector's signaltometrics connector turns these into the same seven series. Labels take the span attribute names (dlq_original_topic, dlq_retry_result, ...), so the DLQ dashboard queries and table columns move with them. DLQManager takes trace.Tracer, and DLQMetrics is gone.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring (no functional changes)
  • CI/CD or tooling changes

Test Plan

  • Backend unit tests pass (cd backend && uv run pytest tests/unit)
  • Frontend unit tests pass (cd frontend && npm run test)
  • Backend E2E tests pass (docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')
  • Frontend E2E tests pass (cd frontend && npm run test:e2e)
  • API spec and client regenerated if routes or schemas changed (./deploy.sh openapi, then ./deploy.sh types), never edited by hand
  • Manual testing performed

Validation: unit 567 passed (6 new span tests), contract 3 passed, e2e 488 passed and 1 skipped. Driving the real DLQManager on a local stack (4 handled, 1 discarded, 1 retried) gave exactly those counts in VictoriaMetrics, and every DLQ dashboard query ran.

Checklist

  • My code follows the project's style guidelines
  • I have run pre-commit run --all-files and all checks pass
  • I have added tests that prove my fix/feature works
  • I have updated documentation if needed
  • My changes don't introduce new warnings