Skip to content

feat(taskprocessing): Add queue_stats API endpoint for external autoscalers#58376

Open
oleksandr-nc wants to merge 1 commit intomasterfrom
feat/taskprocessing/keda-autoscaler
Open

feat(taskprocessing): Add queue_stats API endpoint for external autoscalers#58376
oleksandr-nc wants to merge 1 commit intomasterfrom
feat/taskprocessing/keda-autoscaler

Conversation

@oleksandr-nc
Copy link
Contributor

@oleksandr-nc oleksandr-nc commented Feb 17, 2026

Summary

This is a new admin-only OCS endpoint (GET /taskprocessing/queue_stats) that returns the count of scheduled and running tasks, designed for KEDA and similar external scalers to poll for queue depth.

TODO

  • Finish design
  • Test with LLM2 and ContextChat
  • Fix bugs
  • Add tests

Checklist

try {
$taskTypeIds = [];
if ($taskTypeId !== null) {
$taskTypeIds = array_map('trim', explode(',', $taskTypeId));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we simply demand an array here instead of a comma-separated list?

@oleksandr-nc oleksandr-nc added the 2. developing Work in progress label Feb 23, 2026
@oleksandr-nc oleksandr-nc force-pushed the feat/taskprocessing/keda-autoscaler branch from eed2cdd to e099331 Compare February 23, 2026 16:38
#[NoCSRFRequired]
#[ApiRoute(verb: 'GET', url: '/queue_stats', root: '/taskprocessing')]
public function queueStats(array $taskTypeIds = []): DataResponse {
# TODO: bruteforce protection?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mh, shouldn't be necessary I think 🤔 It's an admin only endpoint and it doesn't do much

@marcelklehr
Copy link
Member

Not sure how useful unit tests are in this case 🤔 We can keep them, but if we want proper test coverage, I'd argue we should test against a real db as well.

@oleksandr-nc oleksandr-nc force-pushed the feat/taskprocessing/keda-autoscaler branch from e099331 to 08e97d5 Compare March 23, 2026 10:14
…calers

Signed-off-by: Oleksander Piskun <oleksandr2088@icloud.com>
@oleksandr-nc oleksandr-nc force-pushed the feat/taskprocessing/keda-autoscaler branch from 08e97d5 to 6d42d50 Compare March 23, 2026 10:19
@oleksandr-nc oleksandr-nc marked this pull request as ready for review March 23, 2026 10:47
@oleksandr-nc oleksandr-nc requested review from a team and provokateurin as code owners March 23, 2026 10:47
@oleksandr-nc oleksandr-nc requested review from Altahrim, ArtificialOwl and icewind1991 and removed request for a team March 23, 2026 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants