SpanID is incorrect

Hi, i am actually collecting logs and traces from Jenkins builds and want to correlate them.
Build logs are sent to Opentelemetry Collector container that send them to Loki.
Build traces are sent t OpenTelemetry Collector container that send them to Tempo.
Traces in tempo are shown correctly with a unique SpanID for each stage/step.
But in Loki all the logs lines contain the same SpanId which is the root spanId of the build
i printed the environment variables to check the value of SPAN_ID and indeed its value change during the build to take the spanID of the current stage/step and spanId’s are good in Tempo so looks like the bug is only in sending the info in the log attributes.
This is the jenkins pipeline
In the Loki log all lines have the same SpanID
Notice the SPAN_ID variable has a different value

This value is the span of the step as we can see in the trace in Tempo

But the SpanID in the atrribute is of the root span of the trace