[💡 FEATURE REQUEST]: Allow overriding traceparent in Jobs plugin to continue existing trace from HTTP request
Plugin
Jobs
I have an idea!
Description
Currently, when using RoadRunner with the Laravel Bridge package, the Jobs plugin always starts a new span when a job is pushed via RPC, even if a valid traceparent header is already available from the initial HTTP request.
In the following scenario, this leads to disconnected traces:
- API request arrives → handled by RR HTTP worker.
- Laravel handles request and pushes a job to RR via RPC (Kafka backend).
- RR Jobs plugin picks up the job and sends it to a PHP worker.
- Tracing shows separate spans for HTTP request and Job execution — they are not connected in a single trace.
Current Behavior
- RR creates a new span when the job is pushed, regardless of whether a
traceparentwas already provided. - There is no way to pass the current
traceparentto the Jobs plugin for it to be used instead of generating a new one.
Expected Behavior / Feature Request
- Add support in the Jobs plugin to accept and use an external
traceparentif provided in the job headers when pushing via RPC. - If the header is valid and present, the Jobs plugin should use it to continue the existing trace rather than creating a new root span.
- This would allow full end-to-end tracing across:
- RR HTTP → Laravel → Job push (RPC) → RR Jobs → Laravel worker.
Use Case
Ensures uninterrupted tracing across HTTP requests and queued jobs in systems where RR is both the HTTP and Job server, improving observability for distributed tracing with OpenTelemetry.
Hey @bohemima 👋🏻 Could you please create a test case (PHP) for that? For example, an HTTP worker that sends a message to the JOBS worker (with OTEL enabled), and let's say, the JOBS worker parses headers and checks for the traceparent key (or creates a parent span). So the test would consist of 3 files, HTTP worker, JOBS worker, + configuration (.rr.yaml). Laravel or any other third-party frameworks should not be included (even Spiral bridges, if that is possible). Only raw workers.
@bohemima You can pass trace context as part of the headers when you push a job into the queue, roadrunner-jobs will be able to correlate your job invocation with the original request.
I think that the problem is that RR itself does not propagate the span starting from the very beginning (like from the Push method) of the Message entering the RR.
@rustatian true, but this applies to pretty much all plugins.
Yeah, I think that we need to update all plugins with RPC support to support span propagation.
Hey @bohemima 👋🏻 Could you please create a test case (PHP) for that? For example, an HTTP worker that sends a message to the JOBS worker (with OTEL enabled), and let's say, the JOBS worker parses headers and checks for the traceparent key (or creates a parent span). So the test would consist of 3 files, HTTP worker, JOBS worker, + configuration (.rr.yaml). Laravel or any other third-party frameworks should not be included (even Spiral bridges, if that is possible). Only raw workers.
Hi, sorry for late answer, I'll see what I can do, I've only used the laravel-bridge so far