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

Capture job dispatch duration #106

Merged
merged 3 commits into from
Feb 18, 2025
Merged

Capture job dispatch duration #106

merged 3 commits into from
Feb 18, 2025

Conversation

avosalmon
Copy link
Contributor

@avosalmon avosalmon commented Feb 18, 2025

This PR captures the job dispatch duration by listening to the JobQueueing and JobQueued events and calculating the difference between their timestamps.

@avosalmon avosalmon marked this pull request as ready for review February 18, 2025 04:08
@@ -40,7 +40,6 @@ public function __invoke(MessageSending|MessageSent $event): void

if ($event instanceof MessageSending) {
$this->startTime = $now;
$this->duration = null;
Copy link
Member

@timacdonald timacdonald Feb 18, 2025

Choose a reason for hiding this comment

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

💡 With this change in place, $duration doesn't need to be a class level property now and can be inlined instead. Think that applies to all of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahhh, you are right! Now I remember why we have it for CacheEventSensor: We want to reuse the same duration when reading/writing multiple keys.

@avosalmon avosalmon merged commit fdbe72f into 1.x Feb 18, 2025
4 checks passed
@avosalmon avosalmon deleted the job-dispatch-duration branch February 18, 2025 04:47
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.

2 participants