-
Notifications
You must be signed in to change notification settings - Fork 17
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
Job tracking #11
Job tracking #11
Conversation
…a job events. This splits framework init into its own collector so that it doesn't log duplicates between HTTP and Job.
|
||
protected function registerEventListeners(): void | ||
{ | ||
$this->app->events->listen(JobProcessing::class, function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually thinking that this should be opposite. The order of execution is JobProcessing, Middleware, JobProcessed. So as it is now the Job processing span extends a few milliseconds beyond the end of the transaction.
I did it this way to intentionally be similar to the HTTP Request, but since it's not fully accurate, I'm wondering if you'd prefer it switched--the transaction would be handled by the events and the middleware would just provide an additional span. This would also have the benefit of automatic transactions for pre-L6 installs.
@arkaitzgarro Any thoughts on this one so far? |
FWIW I'm about done with a re-implementation doing the opposite as described above; if it works out I could do a PR for that and then you can give feedback on whichever is your preferred approach. |
…laravel into job_tracking # Conflicts: # src/Agent.php # src/Collectors/HttpRequestCollector.php
…laravel into job_tracking # Conflicts: # src/Agent.php
Do you have an example of how both implementations visually look like in ELastic APM? |
Building your own demo like the above is trivial. Sharing an artisan command below, but you can do the same thing in a controller to see the job-within-a-request.
|
Closing in favour of #18 |
Add job tracking via middleware available in Laravel 6+ as well as via job events.
This splits framework init into its own collector so that it doesn't log duplicates between HTTP and Job.