Traces tell us which request was slow. CPU profiles tell us which functions consumed CPU time.

Can we start from a slow span and open only the CPU profile samples captured while that span was running?

This article explores that question by converting Go's built-in pprof data into OTLP Profiles, then linking individual Profile Samples to OpenTelemetry Trace and Span IDs. The final result is a Grafana workflow that starts from a GET /cpu-heavy span and opens a Pyroscope flame graph containing main.countPrimes.

The complete lab is available in the go-pprof-otlp-profile-link repository.

Go application -- OTLP Traces --> Collector --> Tempo