-
Notifications
You must be signed in to change notification settings - Fork 199
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
[opentelemetry-php-contrib]: OpenTelemetry Laravel Auto-Instrumentation is not detecting jobs #1475
Comments
@ChrisLightfootWild Hi Chris, Thanks for your work on the laravel auto instrumentation package, I am sure I am just misconfiguring something so please if you could point me in the right direction. I would appreaciate🙏. |
Hey @Nelwhix 👋 Thanks for raising the issue. Based on your example repo, it looks like the I will try to find some time to test this. |
@Nelwhix running queue with if you use Redis or database drive, the workers are handling the Job. This behavior is also similar to other proprietary APMs like new Relic, Elastic & others. |
Hi @alexandrecruz. So what if I want the job to display traces, how do I configure that? |
@Nelwhix I don't think that's possible for an async job since it's not running within the request cycle. There might be a way to associate them, but again, since the job is running outside of the request cycle I don't believe the trace will be displaying it or affecting its metrics (CPU, RAM, time, etc) |
I did not particularly test this solution, but Spatie has a TraceAware job that seems to send the same trace ID when running the job to combine results. You can check the approach and source code at: https://spatie.be/docs/laravel-open-telemetry/v1/basic-usage/measuring-queued-jobs IMO: if the job is not part of the request cycle itself, it should be measured separately. |
I actually want them separately, I tried the spatie package first..it wasn't working |
My understanding may have been off then, but it should currently serialize the job payload when writing to the jobs table in the database. I was planning on checking into that, but have not had any free time to pick it up recently (apologies for anybody waiting on me here!). |
@Nelwhix Instead of I get one trace when I use queue:work and it looks like this When I switch to queue:listen, I get a trace within one of those 'Artisan handler' trace. I am using supervisor to run queue:listen. Maybe something in there could help? https://codeberg.org/gmhafiz/observability/src/commit/8a31169f3011d934e64d8581bd3db4f50811a3b4/laravel/server/supervisord.conf#L19 |
Thanks @gmhafiz let me try |
The difference between There's a couple of issues around this, I've just not quite had the time to crack it yet! |
Describe your environment Hi there, I set up laravel auto-instrumentation. and it is correctly detecting the http request, the calls to DB, but not the jobs.
Steps to reproduce
The entire code is in a docker container here
What is the expected behavior?
I expected to see some spans for the job
What is the actual behavior?

More Context: I have a separate container for the api and the queue worker. The jobs are detected when I set
QUEUE_CONNECTION
to sync but not when it is set to databaseThe text was updated successfully, but these errors were encountered: