OpenTelemetry -- How to start new spans under same trace in Workflows & Activities?

I’m working with a Golang application that passes an API request through multiple services, some using Temporal, some not. I’d like to trace the entire life of the request using OpenTelemetry.

I’m sending traces to a collector which then forwards to my backend, from which I can visualize traces using a dashboard. However, I’ve noticed that the traces only contain child spans up until the point at which the first Temporal Workflow is reached; only that first Workflow span shows up in the dashboard. I’ve also noticed in my logs that all of the Workflows and Activities contain the same span ID, so new spans aren’t actually being created in them.

I wanted to ask, in general, what the steps are to create new OTel spans under the same trace in Temporal Workflows & Activities.

So far, I am setting up an OTel TracingInterceptor in the Temporal Client options with a SpanContextKey. Additionally, this is my current idea for how to create spans in Workflows, based on this discussion:

import (
"go.opentelemetry.io/otel/trace"
"go.temporal.io/sdk/workflow"
)

func Workflow(ctx workflow.Context, ...)
...

if span, _ := ctx.Value("SpanContextKey").(trace.Span); span != nil {
	// Use span
}

and this is my idea for how to create spans in Activities:

import "go.opentelemetry.io/otel"

func Activity(ctx context.Context, ...)
...

tracer := otel.Tracer(serviceName)
ctx, span := tracer.Start(ctx, operationName)
defer span.End()

However, I’m not sure this is the right way to do so. I suspect that I’m missing a step somewhere / misunderstanding something.

Any help would be greatly appreciated!