Use a flame graph when something is slow or burning CPU and you do not yet know where. It answers the question where is the time going faster than reading code or guessing. It is the standard view in production continuous profilers because a single picture summarizes thousands of stacks.
Pick the right variant for the question. A CPU flame graph (on-CPU) shows where the processor is busy. An off-CPU flame graph shows where threads are blocked waiting on locks, disk, or network, which is invisible in a pure CPU profile. A differential flame graph paints one capture against another in red and blue so you can see what got worse after a deploy.
Be aware of the limits. A flame graph hides time order, so it will not show that a slow function only fires on the first request. Sampling can miss very short or very rare functions. Without symbols, frames show up as raw addresses and the graph is useless, so you need debug symbols and, on the JVM, frame pointers or a profiler that unwinds correctly. It also measures aggregate cost, not a single slow request, so pair it with tracing when you need per-request latency.