grafana / pyroscope

Continuous Profiling Platform. Debug performance issues down to a single line of code
https://grafana.com/oss/pyroscope/
GNU Affero General Public License v3.0
9.88k stars 585 forks source link

Add locations to the flamegraph #2727

Open kolesnikovae opened 9 months ago

kolesnikovae commented 9 months ago

We should add information such as file names/path and line numbers into the flamegraph. Ideally, we should also add information about the application version.


Grafana Pyroscope allows users to visualize a profile in various forms, with the most common one being a so-called Flamegraph (Icicle plot, to be precise). In a nutshell, a Flamegraph is a directed acyclic graph, where each node refers to a specific spot in the profiled code. The graph itself (the hierarchy of the nodes) is formed by stack traces. Other representations, such as sandwich view and call graph visualize relationships of the nodes.

Pyroscope backend exposes two API endpoints for profiling data retrieval:

Flamegraph returned by backend does not include information about the exact locations of nodes in code, therefore It is not possible to identify the exact line in the function body where the stack trace samples have been collected. For example, it is not possible to get information about where exactly CPU time has been spent functions deconstructMemoryProfile and parquet-go.Value.Level from this flamegraph:

image

The only way to get this information is to use profilecli tool and visualize pprof file with 3rd party tools.

knylander-grafana commented 5 months ago

Is this work to a point where someone can add line numbers to flame graphs in Pyroscope?