Skip to content

Comments

feat: add System Status page with Celery queue monitoring and purge#14349

Open
valentijnscholten wants to merge 2 commits intoDefectDojo:devfrom
valentijnscholten:feature/celery-queue-status-ui
Open

feat: add System Status page with Celery queue monitoring and purge#14349
valentijnscholten wants to merge 2 commits intoDefectDojo:devfrom
valentijnscholten:feature/celery-queue-status-ui

Conversation

@valentijnscholten
Copy link
Member

@valentijnscholten valentijnscholten commented Feb 19, 2026

Summary

  • New System Status page (/system_status) accessible to superusers from the navigation menu, alongside System Settings. Displays Celery worker liveness, pending queue length, and active task timeout/expiry settings.
  • Purge queue button to remove all pending tasks (with a warning about re-running deduplication via python manage.py dedupe). Reloads the page after a successful purge.
  • Two new superuser-only REST API endpoints (same permission guards as SystemSettingsViewSet):
    • GET /api/v2/celery/status/ — worker status, queue length, and task config
    • POST /api/v2/celery/queue/purge/ — purge all pending tasks from the broker queue
  • Fix get_celery_worker_status() to use app.control.ping() via Celery's pidbox control channel instead of dispatching a task. The old approach would hang indefinitely when the task queue was clogged.
  • New environment variables in settings.dist.py:
    • DD_CELERY_TASK_TIME_LIMIT (default: 43200 = 12 h) — hard kill via SIGKILL after this many seconds
    • DD_CELERY_TASK_SOFT_TIME_LIMIT (default: disabled) — raises SoftTimeLimitExceeded for graceful cleanup
    • DD_CELERY_TASK_DEFAULT_EXPIRES (default: 43200 = 12 h) — silently discard tasks that have been waiting in the queue longer than this before any worker picks them up
  • Client-side AJAX rendering of the status panel so that dojo-pro can consume the same API endpoints without duplicating the view logic.
  • Refresh button
Screenshot 2026-02-19 204310 Screenshot 2026-02-19 204317 Screenshot 2026-02-19 204329

- Add dedicated System Status page (/system_status) with superuser-only
  access, accessible from the navigation menu alongside System Settings
- Display Celery worker liveness, pending queue length with human-readable
  duration formatting, and active task timeout/expiry configuration
- Add Purge queue button that POSTs to the new API endpoint and reloads
  the page on success
- Fix get_celery_worker_status() to use app.control.ping() via the
  pidbox control channel, which works correctly even when the task queue
  is clogged (previously dispatched a task that would never be picked up)
- Add purge_celery_queue() utility using a direct broker connection
- Add two new superuser-only REST API endpoints:
    GET  /api/v2/celery/status/       - worker status, queue length, config
    POST /api/v2/celery/queue/purge/  - purge all pending tasks
  Both use the same permission guards as SystemSettingsViewSet
  (IsSuperUser + DjangoModelPermissions against System_Settings)
- Add DD_CELERY_TASK_TIME_LIMIT (default 12h), DD_CELERY_TASK_SOFT_TIME_LIMIT
  (default disabled), and DD_CELERY_TASK_DEFAULT_EXPIRES (default 12h)
  environment variables to settings.dist.py with explanatory comments
- Move celery status rendering from server-side Django view to client-side
  AJAX so dojo-pro can consume the same API endpoints
@github-actions github-actions bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR apiv2 ui labels Feb 19, 2026
@valentijnscholten valentijnscholten added this to the 2.56.0 milestone Feb 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

apiv2 settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant