title: How to create Context using traceId in Open Telemetry
body: <p>I try to get all spans created in the following chain associated to the same trace context/traceId by context propagation:</p>
  <p>service1 -&gt; aws sqs queue -&gt; service2</p>
  <p>Auto. context propagation is not working with aws sqs and aws sdk v2 atm (<a href="https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/3684" rel="noreferrer">https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/3684</a>), even though the AwsTraceHeader is actually set in the sqs message, I have to take care for it explicitly by</p>
  <ul>
  <li>service1: Writing traceId in sqs message user attribute
  <code>traceId=Span.current().getSpanContext().getTraceId()</code></li>
  <li>service2: Reading traceId from sqs message user attribute <code>traceId</code> and overwriting current span.traceId / essentially creating Context of service1</li>
  </ul>
  <p>However, it is now unclear how to actually overwrite span.traceId in the span that service2 created which is confusing because for example with Golang it seems to be straightforward: <a href="https://stackoverflow.com/questions/70378025/how-to-create-opentelemetry-span-from-a-string-traceid">How to create opentelemetry span from a string traceid</a></p>
  <p>I see only getters e.g. <code>Span.current().getSpanContext().getTraceId()</code>
  but no setters or builder methods.</p>
  <p>Update:</p>
  <p>Even by creating a new span and making it current (not sure if this goes in the right direction)  the <code>tracer.spanBuilder</code> does no offer setters for traceId AFAIU)</p>
  <pre><code>@Inject
  io.opentelemetry.api.trace.Tracer tracer;
  
  Span consumeMessageSpan = tracer.spanBuilder(&quot;consumeMessage&quot;).startSpan();
  
  consumeMessage.makeCurrent();
  </code></pre>
  <p>Update 2</p>
  <p>This snippet from otel official docs looks promising</p>
  <blockquote>
  <p>To link spans from remote processes, it is sufficient to set
  the Remote Context as parent.</p>
  </blockquote>
  <pre><code>Span childRemoteParent = tracer.spanBuilder(&quot;Child&quot;).setParent(remoteContext).startSpan(); 
  </code></pre>
  <p>However, also no examples or ideas how to create remoteContext and setting traceId to the one extracted from the sqs message</p>
  <p>Any hints how to do that?</p>