Span-to-Profile Correlation: Link OpenTelemetry Spans to JFR Samples to Kill P99 Outliers
Aggregated flamegraphs are useless when an isolated P99 request stalls on a single thread due to allocation bursts or lock contention. Staring at 30-minute averaged profiles while your latency SLAs burn is a rookie mistake you need to stop making.
Why Most Developers Get This Wrong
Treating profiling as aggregate-only: Averaging millions of thread samples completely washes out the transient 400ms lock inflation hit by 0.01% of requests.
Timestamp alignment guessing: Grepping APM timestamps against JFR recordings fails due to clock drift, thread re-use, and non-deterministic OS thread scheduling.
Ignoring JVM-level context propagation: Emitting spans without linking the active TraceId and SpanId into the thread state makes thread-level JFR events impossible to query deterministically.
The Right Way
Bridge your OpenTelemetry tracing pipeline directly to JVM flight recordings using the OpenTelemetry Profiling Data…