It is not possible to have correct span ids since the functions `dd_trace_push_span_id` and `dd_trace_pop_span_id` are deprecated in 0.74.0
The seed for span_id is generated only on the dd-trace-php extension start and there is no possibility to re-seed it in a forked process. The processes get the same trace id and we have a mess in the datadog tracing.
Previously we used a workaround calling dd_trace_push_span_id certain amount of times in each of forked processes before creating a new span.
So currently we are not able to use datadog in the jobs which do pcntl_fork().
Could you fix this by adding a function that allows to reseed the random number generator.
Or restore dd_trace_push_span_id and dd_trace_pop_span_id.
But reseed is a better solution.
Hey @Pyrexx, that's truly an edge case I didn't have on my radar :-)
Technically, as a temporary measure, to achieve the same result, you could do DDTrace\start_span() and DDTrace\close_span() repeatedly, then call dd_trace_serialize_closed_spans() (with autoflush off - use ini_set to change it at run-time if necessray) to discard these spans.
As a more persistent solution we are instead proposing #1633, resetting the seed generator automatically upon pcntl_fork. Would that work as well, or is there a different use case you have?
Hi @bwoebi, thanks fro the response,
yes, #1633 should do the job, it would be nice to have it soon.
Since #1633 is merged, I'm closing this now.