Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Queue job profiling #13796

Open
wants to merge 1 commit into
base: 4.8
Choose a base branch
from
Open

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Oct 7, 2023

Adds basic profiling for queue jobs using the built-in queue.

Job durations are tracked based on their class, and possibly some common attributes.

Jobs can now implement ProfilableJobInterface + getProfileAttributes() to provide its common attributes that other jobs should be compared against. BaseBatchedJob does this, returning its properties for attributes, sans any properties that definitely won’t impact job duration (batchIndex, itemOffset, priority, and ttr).

craft\queue\Queue also now has a getAverageDuration() method, which takes a job ID, and returns the average of the last (up to) 5 runs of similar jobs.

@linear
Copy link

linear bot commented Oct 7, 2023

DEV-1196 Queue job profiling

Craft’s queue should start tracking job run durations in a DB table.

Jobs with common classes/attributes could then be averaged out to give the Cloud extension a sense of how long a new job might take.

@brandonkelly brandonkelly changed the base branch from 4.6 to 4.7 January 12, 2024 18:06
@brandonkelly brandonkelly changed the base branch from 4.7 to 4.8 January 23, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant