Add queue job lifecycle events for monitoring integration #449
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds events at key lifecycle points in queue job processing to enable integration with monitoring tools like Sentry:
Queue.Job.created: Fired when a job is added to the queue (producer side)Queue.Job.started: Fired when a worker begins processing a job (consumer side)Queue.Job.completed: Fired when a job finishes successfullyQueue.Job.failed: Fired on every job failure (not just when retries exhausted)These events enable integration with Sentry's Insights - Queues feature and similar monitoring tools. The job entity included in each event provides all necessary data for tracing:
$job->id- Message identifier$job->job_task- Queue/topic name$job->data- Payload for calculating message size$job->attempts- Retry count$job->created,$job->notbefore,$job->fetched- For calculating receive latencyRelated Issues
Test plan
Queue.Job.createdevent in QueuedJobsTableTestQueue.Job.startedevent in ProcessorTestQueue.Job.completedevent in ProcessorTestQueue.Job.failedevent in ProcessorTest🤖 Generated with Claude Code