Problem/Motivation

It's difficult for contrib or custom modules to instrument the queue system for performance monitoring purposes (or, to otherwise respond to jobs being queued or processed).

Steps to reproduce

Attempt to respond or "hook into" to queue operations, e.g. install modules/libraries that enable performance tracing and attempt to create performance tracing spans for queue operations.

Proposed resolution

Dispatch events for queue operations, e.g. ItemQueuing, ItemQueued, ItemProcessing, ItemExceptionOccurred, ItemProcessed.

Note, however, that queue processing may be re-implemented by Drush, contrib modules (e.g. ultimate_cron), etc. In the current architecture, each implementation would be responsible for correctly dispatching the events.

Remaining tasks

Review feature request and develop a merge request.

User interface changes

None.

Introduced terminology

None.

API changes

New events would be added to the queue API.

Data model changes

None.

Release notes snippet

Comments

mfb created an issue. See original summary.

voleger’s picture

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

chi’s picture

Dispatch events for queue operations, e.g. ItemQueuing, ItemQueued, ItemProcessing, ItemExceptionOccurred, ItemProcessed.

There might be performance issue when you enqueue hundreds items.

mfb’s picture

Performance issues is exactly what this feature would allow us to analyze.. :)

Firing an event should be far lighter weight than a database insert query.

If performance was affected though, then we could always disable queue events by default and provide a means to enable them.