<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>View and analyze profile data on Grafana Labs</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/</link><description>Recent content in View and analyze profile data on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/index.xml" rel="self" type="application/rss+xml"/><item><title>Use Profiles Drilldown to investigate issues</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/explore-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/explore-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;use-profiles-drilldown-to-investigate-issues&#34;&gt;Use Profiles Drilldown to investigate issues&lt;/h1&gt;


&lt;div data-shared=&#34;use-explore-profiles.md&#34;&gt;
            &lt;!-- Use Profiles Drilldown to investigate issues --&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Profiles Drilldown is currently in &lt;a href=&#34;/docs/release-life-cycle/&#34;&gt;public preview&lt;/a&gt;. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;


&lt;p&gt;&lt;a href=&#34;/docs/grafana-cloud/visualizations/simplified-exploration/profiles/&#34;&gt;Grafana Profiles Drilldown&lt;/a&gt; is designed to make it easy to visualize and analyze profiling data.
There are several different modes for viewing, analyzing, and comparing profiling data.&lt;/p&gt;
&lt;p&gt;The main use cases are the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Proactive: Cutting costs, addressing latency issues, or optimizing memory usage for applications&lt;/li&gt;
&lt;li&gt;Reactive: Resolving incidents with line-level accuracy or debugging active latency/memory issues&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Profiles Drilldown provides an intuitive interface to specifically support these use cases.
You get a holistic view of all of your services and how they&amp;rsquo;re functioning, but also the ability to drill down for more targeted root cause analysis.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/explore-profiles/explore-profiles-homescreen-v1.png&#34;
  alt=&#34;Profiles Drilldown home screen&#34; width=&#34;1174&#34;
     height=&#34;735&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Profiles Drilldown offers a convenient platform to analyze profiles and get insights that are impossible to get from using other traditional signals like logs, metrics, or tracing.&lt;/p&gt;
&lt;iframe width=&#34;560&#34; height=&#34;315&#34; src=&#39;https://www.youtube.com/embed/x9aPw_CbIQc&#39; title=&#34;YouTube video player&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&#34; referrerpolicy=&#34;strict-origin-when-cross-origin&#34; allowfullscreen&gt;&lt;/iframe&gt;

&lt;Box backgroundColor=&#34;primary&#34; borderColor=&#34;strong&#34; borderStyle=&#34;solid&#34; padding=&#34;2&#34;&gt;
  &lt;Grid columns=&#34;2&#34; gap=&#34;2&#34;&gt;
    &lt;div&gt;
      &lt;h4&gt;Give it a try using Grafana Play&lt;/h4&gt;
      &lt;p&gt;With Grafana Play, you can explore and see how it works, learning from practical examples to accelerate your development.
This feature can be seen on &lt;a href=&#34;https://play.grafana.org/a/grafana-pyroscope-app/profiles-explorer&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;the Grafana Play site&lt;/a&gt;.&lt;/p&gt;
      &lt;div&gt;
        &lt;a class=&#34;btn btn--primary arrow&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34; href=&#34;https://play.grafana.org/a/grafana-pyroscope-app/profiles-explorer&#34;&gt;Try it&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div&gt;
      &lt;img src=&#34;/media/docs/icons/docs-play.svg&#34; width=&#34;228&#34; height=&#34;182&#34; alt=&#34;Give it a try using Grafana Play&#34;&gt;
    &lt;/div&gt;
  &lt;/Grid&gt;
&lt;/Box&gt;

&lt;h2 id=&#34;continuous-profiling&#34;&gt;Continuous profiling&lt;/h2&gt;
&lt;p&gt;While code profiling has been a long-standing practice, continuous profiling represents a modern and more advanced approach to performance monitoring.&lt;/p&gt;
&lt;p&gt;This technique adds two critical dimensions to traditional profiles:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;Time&lt;/dt&gt;
&lt;dd&gt;Profiling data is collected &lt;em&gt;continuously&lt;/em&gt;, providing a time-centric view that allows querying performance data from any point in the past.&lt;/dd&gt;
&lt;dt&gt;Metadata&lt;/dt&gt;
&lt;dd&gt;Metadata enriches profiling data, adding contextual depth to the performance data.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;These dimensions, coupled with the detailed nature of performance profiles, make continuous profiling a uniquely valuable tool.&lt;/p&gt;
&lt;h2 id=&#34;flame-graphs&#34;&gt;Flame graphs&lt;/h2&gt;
&lt;!-- vale Grafana.We = NO --&gt;
&lt;p&gt;Flame graphs help you visualize resource allocation and performance bottlenecks, and you even get suggested recommendations and performance fixes via AI-driven flame graph analysis, as well as line-level insights from our GitHub integration.&lt;/p&gt;
&lt;!-- vale Grafana.We = YES --&gt;
&lt;p&gt;On views with a flame graph, you can use &lt;strong&gt;Explain flame graph&lt;/strong&gt; to provide an AI flame graph analysis that explains the performance bottleneck, root cause, and recommended fix.
For more information, refer to &lt;a href=&#34;/docs/grafana-cloud/monitor-applications/profiles/flamegraph-ai/&#34;&gt;Flame graph AI&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;

        
]]></content><description>&lt;h1 id="use-profiles-drilldown-to-investigate-issues">Use Profiles Drilldown to investigate issues&lt;/h1>
&lt;div data-shared="use-explore-profiles.md">
&lt;!-- Use Profiles Drilldown to investigate issues -->
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>Profiles Drilldown is currently in &lt;a href="/docs/release-life-cycle/">public preview&lt;/a>. Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.&lt;/p></description></item><item><title>Use the Pyroscope UI to explore profiling data</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/pyroscope-ui/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/pyroscope-ui/</guid><content><![CDATA[&lt;h1 id=&#34;use-the-pyroscope-ui-to-explore-profiling-data&#34;&gt;Use the Pyroscope UI to explore profiling data&lt;/h1&gt;
&lt;p&gt;Pyroscope&amp;rsquo;s UI is designed to make it easy to visualize and analyze profiling data.
There are several different modes for viewing, analyzing, uploading, and comparing profiling data.&lt;/p&gt;
&lt;p&gt;The Pyroscope UI is only available with Pyroscope open source.
In Grafana and Grafana Cloud, you can use 
    &lt;a href=&#34;/docs/grafana/latest/explore/simplified-exploration/profiles/&#34;&gt;Profiles Drilldown&lt;/a&gt; to inspect your profiling data.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/pyroscope/screenshot-pyroscope-comparison-view.png&#34;
  alt=&#34;Screenshot of Pyroscope UI&#34; width=&#34;1459&#34;
     height=&#34;911&#34;/&gt;&lt;/p&gt;
&lt;p&gt;While code profiling has been a long-standing practice, continuous profiling represents a modern and more advanced approach to performance monitoring. This technique adds two critical dimensions to traditional profiles:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;Time&lt;/dt&gt;
&lt;dd&gt;Profiling data is collected &lt;em&gt;continuously&lt;/em&gt;, providing a time-centric view that allows querying performance data from any point in the past.&lt;/dd&gt;
&lt;dt&gt;Metadata&lt;/dt&gt;
&lt;dd&gt;Profiles are enriched with metadata, adding contextual depth to the performance data.&lt;/dd&gt;
&lt;/dl&gt;
&lt;p&gt;These dimensions, coupled with the detailed nature of performance profiles, make continuous profiling a uniquely valuable tool.
Pyroscope&amp;rsquo;s UI enhances this further by offering a convenient platform to analyze profiles and get insights that are impossible to get from using other traditional signals like logs, metrics, or tracing.&lt;/p&gt;
&lt;p&gt;In this UI reference, you&amp;rsquo;ll learn how Pyroscope parallels these other modern observability tools by providing a Prometheus-like querying experience. More importantly, you&amp;rsquo;ll learn how to use Pyroscope&amp;rsquo;s extensive UI features for a deeper insight into your application&amp;rsquo;s performance.&lt;/p&gt;
&lt;h2 id=&#34;key-features-of-the-pyroscope-ui&#34;&gt;Key features of the Pyroscope UI&lt;/h2&gt;
&lt;p&gt;The following sections describe Pyroscope UI capabilities.&lt;/p&gt;
&lt;!-- Add a screenshot with numbered parts for each of the sections described below. --&gt;
&lt;h2 id=&#34;tag-explorer&#34;&gt;Tag Explorer&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Tag Explorer&lt;/strong&gt; page lets you navigate and analyze performance data through tags and labels.
This feature is crucial for identifying performance anomalies and understanding the behavior of different application segments under various conditions.
Pyroscope intentionally doesn&amp;rsquo;t include a query language on this page.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/pyroscope/screenshot-pyroscope-tag-explorer.png&#34;
  alt=&#34;Pyroscope Tag Explorer&#34; width=&#34;1425&#34;
     height=&#34;1102&#34;/&gt;&lt;/p&gt;
&lt;p&gt;To use the &lt;strong&gt;Tag Explorer&lt;/strong&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select a tag to view the corresponding profiling data.&lt;/li&gt;
&lt;li&gt;Analyze the pie chart and the table of descriptive statistics to determine which tags if any are behaving abnormally.&lt;/li&gt;
&lt;li&gt;Select a tag to view the corresponding profiling data.&lt;/li&gt;
&lt;li&gt;Make use of the shortcuts to the Single, Comparison, and Diff View pages to further identify the root cause of the performance issue.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;single-view&#34;&gt;Single view&lt;/h2&gt;
&lt;p&gt;The Single View page in Pyroscope&amp;rsquo;s UI is built for in-depth profile analysis. Here, you can explore a single flame graph with multiple viewing options and functionalities:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;strong&gt;Table view&lt;/strong&gt;&lt;/dt&gt;
&lt;dd&gt;Breaks down the profiling data into a sortable table format. Selecting &lt;strong&gt;Top Table&lt;/strong&gt; displays the table and hides the flame graph.&lt;/dd&gt;
&lt;dt&gt;&lt;strong&gt;Sandwich view&lt;/strong&gt;&lt;/dt&gt;
&lt;dd&gt;Displays both the callers and callees for a selected function, offering a comprehensive view of function interactions. Access by clicking in the flame graph and selecting &lt;strong&gt;Sandwhich view&lt;/strong&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;strong&gt;Flame Graph&lt;/strong&gt; view&lt;/dt&gt;
&lt;dd&gt;Visualizes profiling data in a flame graph format, allowing easy identification of resource-intensive functions. Selecting &lt;strong&gt;Flame Graph&lt;/strong&gt; displays the flame graph and hides the table.&lt;/dd&gt;
&lt;dt&gt;&lt;strong&gt;Both&lt;/strong&gt; view&lt;/dt&gt;
&lt;dd&gt;Displays both the table and the flame graph. This is the default view for &lt;strong&gt;Single View&lt;/strong&gt;.&lt;/dd&gt;
&lt;dt&gt;&lt;strong&gt;Export Data&lt;/strong&gt;&lt;/dt&gt;
&lt;dd&gt;Options to export the flame graph for offline analysis or share it via a flamegraph.com link for collaborative review.&lt;/dd&gt;
&lt;/dl&gt;
&lt;!-- Visual Placeholder:** *Screenshots demonstrating each view option in the Single View page.* --&gt;
&lt;p&gt;This screenshot shows a spike in CPU usage.
Without profiling, you would go from a spike CPU usage metric to digging through code or guessing the cause.
However, with profiling, you can use the flame graph and table to see exactly which function is most responsible for the spike.
Often, this shows up as a single node taking up a noticeably disproportionate width in the flame graph as seen below with the &lt;code&gt;checkDriverAvailability&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/pyroscope/pyroscope-ui-single-2023-11-30.png&#34;
  alt=&#34;example-flamegraph&#34; width=&#34;1599&#34;
     height=&#34;836&#34;/&gt;&lt;/p&gt;
&lt;p&gt;However, in some instances it may be a function that&amp;rsquo;s called many times and is taking up a large amount of space in the flame graph.
In this case, you can use the sandwich view to see that a logging function called throughout many functions in the codebase is the culprit.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/pyroscope/sandwich-view-2023-11-30.png&#34;
  alt=&#34;example-sandwich-view&#34; width=&#34;3170&#34;
     height=&#34;1122&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;comparison-view&#34;&gt;Comparison view&lt;/h2&gt;
&lt;p&gt;The Comparison view facilitates side-by-side comparison of profiles either based on different label sets, different time periods, or both.
This feature is valuable for understanding the impact of changes or differences between two distinct queries of your application.&lt;/p&gt;
&lt;p&gt;You can use Comparison view to compare different time ranges whether or not the labels are the same.
For example, in investigating the cause of a memory leak, the timeline might show a steadily increasing amount of memory allocations over time.
You can use the Comparison view to compare the memory allocations between two different time periods where allocations were low and where allocations were high.
This information helps you identify the function that&amp;rsquo;s causing the memory leak.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/pyroscope/screenshot-pyroscope-comparison-view.png&#34;
  alt=&#34;Pyroscope Comparison view&#34; width=&#34;1459&#34;
     height=&#34;911&#34;/&gt;&lt;/p&gt;
&lt;p&gt;To run a comparison:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Select two different sets of labels (for example, &lt;code&gt;env:production&lt;/code&gt; vs. &lt;code&gt;env:development&lt;/code&gt;) and or time periods, reflected by the sub-timelines above each flame graph.&lt;/li&gt;
&lt;li&gt;View the resulting flame graphs side by side to identify disparities in performance.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There are many practical use cases for comparison for companies using Pyroscope.
Some examples of labels below expressed as &lt;code&gt;label:value&lt;/code&gt; are:&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;Feature flags&lt;/dt&gt;
&lt;dd&gt;Compare application performance with &lt;code&gt;feature_flag:a&lt;/code&gt; vs. &lt;code&gt;feature_flag:b&lt;/code&gt;&lt;/dd&gt;
&lt;dt&gt;Deployment environments&lt;/dt&gt;
&lt;dd&gt;Contrast &lt;code&gt;env:production&lt;/code&gt; vs. &lt;code&gt;env:development&lt;/code&gt;&lt;/dd&gt;
&lt;dt&gt;Release analysis&lt;/dt&gt;
&lt;dd&gt;Examine &lt;code&gt;commit:release-1&lt;/code&gt; vs. &lt;code&gt;commit:release-2&lt;/code&gt;&lt;/dd&gt;
&lt;dt&gt;Region&lt;/dt&gt;
&lt;dd&gt;Compare &lt;code&gt;region:us-east-1&lt;/code&gt; vs. &lt;code&gt;region:us-west-1&lt;/code&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&#34;diff-page-identify-changes-with-differential-analysis&#34;&gt;Diff page: Identify changes with differential analysis&lt;/h2&gt;
&lt;p&gt;The &lt;strong&gt;Diff&lt;/strong&gt; page is an extension of the comparison page, crucial for more easily visually showing the differences between two profiling data sets.
It normalizes the data by comparing the percentage of total time spent in each function so that the resulting flame graph is comparing the &lt;strong&gt;share&lt;/strong&gt; of time spent in each function rather than the absolute amount of time spent in each function.
This is important because it allows you to compare two different queries that may have different total amounts of time spent in each function.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/pyroscope/screenshot-pyroscope-diff-view.png&#34;
  alt=&#34;Diff view in Pyroscope&#34; width=&#34;1441&#34;
     height=&#34;1095&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Similar to a &lt;code&gt;git diff&lt;/code&gt;, it takes the flame graphs from the comparison page and highlights the differences between the two flame graphs where red represents an increase in CPU usage from the baseline to the comparison and green represents a decrease.&lt;/p&gt;
&lt;!-- and a diff between two time periods during an introduction of a memory leak:
![memory leak](https://grafana.com/static/img/pyroscope/pyroscope-memory-leak-2023-11-30.png) --&gt;
]]></content><description>&lt;h1 id="use-the-pyroscope-ui-to-explore-profiling-data">Use the Pyroscope UI to explore profiling data&lt;/h1>
&lt;p>Pyroscope&amp;rsquo;s UI is designed to make it easy to visualize and analyze profiling data.
There are several different modes for viewing, analyzing, uploading, and comparing profiling data.&lt;/p></description></item><item><title>Understand 'self' vs. 'total' metrics in profiling with Pyroscope</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/self-vs-total/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/self-vs-total/</guid><content><![CDATA[&lt;h1 id=&#34;understand-self-vs-total-metrics-in-profiling-with-pyroscope&#34;&gt;Understand &amp;lsquo;self&amp;rsquo; vs. &amp;rsquo;total&amp;rsquo; metrics in profiling with Pyroscope&lt;/h1&gt;
&lt;p&gt;Profiling in Pyroscope provides many different ways of analyzing your profiling data. One of the key pieces of this analysis are the metrics &amp;lsquo;self&amp;rsquo; and &amp;rsquo;total&amp;rsquo;, whose understanding is key for accurate interpretation of profiling data in both CPU and memory contexts. These metrics can be seen both within the table and the flame graph view of the UI.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/pyroscope/self_vs_total_annotated.png&#34;
  alt=&#34;Self vs total annotated&#34; width=&#34;1540&#34;
     height=&#34;658&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;self&#34;&gt;Self&lt;/h2&gt;
&lt;p&gt;&amp;lsquo;Self&amp;rsquo; refers to the resource usage (CPU time, memory allocation, etc.) directly attributed to a specific function or a code segment, excluding the resources used by its sub-functions or calls&lt;/p&gt;
&lt;p&gt;This metric helps isolate the direct impact of a specific code block, making it crucial for pinpointing primary resource consumers&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/pyroscope/self_vs_total_explainer_diagram.png&#34;
  alt=&#34;Self vs total diagram&#34; width=&#34;6667&#34;
     height=&#34;2869&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;total&#34;&gt;Total&lt;/h2&gt;
&lt;p&gt;&amp;lsquo;Total&amp;rsquo; encompasses the combined resource usage of a function along with all the functions it calls&lt;/p&gt;
&lt;p&gt;It provides a holistic view of a function&amp;rsquo;s overall resource consumption, essential for understanding cumulative impacts&lt;/p&gt;
&lt;h2 id=&#34;self-and-total-in-cpu-profiling&#34;&gt;&amp;lsquo;Self&amp;rsquo; and &amp;lsquo;Total&amp;rsquo; in CPU profiling&lt;/h2&gt;
&lt;p&gt;In CPU profiling, &amp;lsquo;self&amp;rsquo; indicates the CPU time consumed directly by the function, crucial for identifying functions with high CPU demand.&lt;/p&gt;
&lt;p&gt;The &amp;rsquo;total&amp;rsquo; CPU time includes time spent in the function itself plus time in all called functions, highlighting comprehensive CPU usage&lt;/p&gt;
&lt;p&gt;The example below demonstrates a simplified pseudocode representation of a CPU-intensive process.
This illustrates how &amp;lsquo;self&amp;rsquo; and &amp;rsquo;total&amp;rsquo; time would be calculated for different functions in a typical application. The following diagram provides a visual representation of these concepts.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/media/docs/pyroscope/self_vs_total_explainer_diagram.png&#34;
  alt=&#34;Self vs total diagram&#34; width=&#34;6667&#34;
     height=&#34;2869&#34;/&gt;&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Python&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-python&#34;&gt;def handle_request():
    # Root function representing the total request handling process
    parse_json()
    process_data()

def parse_json():
    # Function for parsing JSON data
    validate()

def validate():
    # Function for validating the parsed JSON schema
    # Schema validation logic

def process_data():
    # Function for processing data
    apply()

def apply():
    # Function for applying transformations to data
    # Transformation logic

# Simulate a request handling
handle_request()&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;self-and-total-in-memory-profiling&#34;&gt;&amp;lsquo;Self&amp;rsquo; and &amp;lsquo;Total&amp;rsquo; in memory profiling&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Self in Memory&lt;/strong&gt;: For memory profiling, &amp;lsquo;self&amp;rsquo; measures the memory allocated by the function itself, vital for detecting direct memory allocation issues.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Total in Memory&lt;/strong&gt;: &amp;lsquo;Total&amp;rsquo; memory includes allocations by the function and it&amp;rsquo;s called functions, essential for assessing overall memory footprint.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The same example from the CPU profiling section can be used to illustrate the concepts of &amp;lsquo;self&amp;rsquo; and &amp;rsquo;total&amp;rsquo; in memory profiling, just with memory units instead of CPU.&lt;/p&gt;
&lt;h2 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Grasping the distinction between &amp;lsquo;self&amp;rsquo; and &amp;rsquo;total&amp;rsquo; metrics is fundamental for effective performance analysis in Pyroscope. Whether in CPU or memory profiling (or any other type), these metrics provide value insights for optimizing applications and enhancing their efficiency and reliability.&lt;/p&gt;
]]></content><description>&lt;h1 id="understand-self-vs-total-metrics-in-profiling-with-pyroscope">Understand &amp;lsquo;self&amp;rsquo; vs. &amp;rsquo;total&amp;rsquo; metrics in profiling with Pyroscope&lt;/h1>
&lt;p>Profiling in Pyroscope provides many different ways of analyzing your profiling data. One of the key pieces of this analysis are the metrics &amp;lsquo;self&amp;rsquo; and &amp;rsquo;total&amp;rsquo;, whose understanding is key for accurate interpretation of profiling data in both CPU and memory contexts. These metrics can be seen both within the table and the flame graph view of the UI.&lt;/p></description></item><item><title>Profile CLI</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/profile-cli/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/profile-cli/</guid><content><![CDATA[&lt;h1 id=&#34;profile-cli&#34;&gt;Profile CLI&lt;/h1&gt;
&lt;p&gt;Pyroscope provides a command-line interface (CLI), &lt;code&gt;profilecli&lt;/code&gt;.
This utility enables various productivity flows such as:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Interacting with a running Pyroscope server to upload profiles, query data, and more&lt;/li&gt;
&lt;li&gt;Inspecting &lt;a href=&#34;https://parquet.apache.org/docs/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Parquet&lt;/a&gt; files&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-tip&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Tip&lt;/p&gt;&lt;p&gt;Use the &lt;code&gt;help&lt;/code&gt; command (&lt;code&gt;profilecli help&lt;/code&gt;) for a full list of capabilities and help information.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;install-profile-cli&#34;&gt;Install Profile CLI&lt;/h2&gt;
&lt;p&gt;You can install Profile CLI using a package or by compiling the code.&lt;/p&gt;
&lt;h3 id=&#34;install-using-a-package&#34;&gt;Install using a package&lt;/h3&gt;
&lt;p&gt;On macOS, you can install Profile CLI using &lt;a href=&#34;https://brew.sh&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;HomeBrew&lt;/a&gt;:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;brew install pyroscope-io/brew/profilecli&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For other platforms, you can manually &lt;a href=&#34;https://github.com/grafana/pyroscope/releases/latest&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;download the &lt;code&gt;profilecli&lt;/code&gt; release asset&lt;/a&gt; for your operating system and architecture and make it executable.&lt;/p&gt;
&lt;p&gt;For example, for Linux with the AMD64 architecture:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Download and extract the package (archive).&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;curl -fL https://github.com/grafana/pyroscope/releases/download/v1.13.2/profilecli_1.13.2_linux_amd64.tar.gz | tar xvz&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Make &lt;code&gt;profilecli&lt;/code&gt; executable:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;chmod &amp;#43;x profilecli&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Make &lt;code&gt;profilecli&lt;/code&gt; reachable from anywhere:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;sudo mv profilecli /usr/local/bin&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;build-from-source-code&#34;&gt;Build from source code&lt;/h3&gt;
&lt;p&gt;To build from source code, you must have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go installed (&amp;gt; 1.19).&lt;/li&gt;
&lt;li&gt;Either &lt;code&gt;$GOPATH&lt;/code&gt; or &lt;code&gt;$GOBIN&lt;/code&gt; configured and added to your &lt;code&gt;PATH&lt;/code&gt; environment variable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To build the source code:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Clone the repository.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;git clone git@github.com:grafana/pyroscope.git&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Run the Go install command to build and install the package.&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;cd pyroscope
go install ./cmd/profilecli&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The command places the &lt;code&gt;profilecli&lt;/code&gt; executable in &lt;code&gt;$GOPATH/bin/&lt;/code&gt; (or &lt;code&gt;$GOBIN/&lt;/code&gt;) and make it available to use.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;common-flags-and-environment-variables&#34;&gt;Common flags and environment variables&lt;/h2&gt;
&lt;p&gt;The &lt;code&gt;profilecli&lt;/code&gt; commands that interact with a Pyroscope server require a server URL and optionally authentication details. These can be provided as command-line flags or environment variables.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Server URL&lt;/p&gt;
&lt;p&gt;&lt;code&gt;default: http://localhost:4040&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;--url&lt;/code&gt; flag specifies the server against which the command will run.
If using Grafana Cloud, an example URL could be &lt;code&gt;https://profiles-prod-001.grafana.net&lt;/code&gt;.
For local instances, the URL could look like &lt;code&gt;http://localhost:4040&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Authentication details.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;default: &amp;lt;empty&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;If using Grafana Cloud or authentication is enabled on your Pyroscope server, you will need to provide a username and password using the &lt;code&gt;--username&lt;/code&gt; and &lt;code&gt;--password&lt;/code&gt; flags respectively.
For Grafana Cloud, the username will be the Stack ID and the password the generated API token.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;environment-variable-naming&#34;&gt;Environment variable naming&lt;/h3&gt;
&lt;p&gt;You can use environment variables to avoid passing flags to the command every time you use it, or to protect sensitive information.
Environment variables have a &lt;code&gt;PROFILECLI_&lt;/code&gt; prefix. Here is an example of providing the server URL and credentials for the &lt;code&gt;profilecli&lt;/code&gt; tool:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=&amp;lt;pyroscope_server_url&amp;gt;
export PROFILECLI_USERNAME=&amp;lt;username&amp;gt;
export PROFILECLI_PASSWORD=&amp;lt;password&amp;gt;
# now we can run a profilecli command without specifying the url or credentials:
profilecli &amp;lt;command&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;div class=&#34;admonition admonition-caution&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Caution&lt;/p&gt;&lt;p&gt;If you&amp;rsquo;re querying data from Cloud Profiles, be sure to use the url of your Cloud Profiles server in &lt;code&gt;PROFILECLI_URL&lt;/code&gt; (e.g. &lt;code&gt;https://profiles-prod-001.grafana.net&lt;/code&gt;) and &lt;strong&gt;not&lt;/strong&gt; the url of your Grafana Cloud tenant (e.g. &lt;code&gt;&amp;lt;your tenant&amp;gt;.grafana.net&lt;/code&gt;).&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;upload-a-profile-to-a-pyroscope-server-using-profilecli&#34;&gt;Upload a profile to a Pyroscope server using &lt;code&gt;profilecli&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;Using &lt;code&gt;profilecli&lt;/code&gt; streamlines the process of uploading profiles to Pyroscope, making it a convenient alternative to manual HTTP requests.&lt;/p&gt;
&lt;h3 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Ensure you have &lt;code&gt;profilecli&lt;/code&gt; installed on your system by following the &lt;a href=&#34;#install-profile-cli&#34;&gt;installation&lt;/a&gt; steps above.&lt;/li&gt;
&lt;li&gt;Have a profile file ready for upload. Note that you can only upload pprof files at this time.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;upload-steps&#34;&gt;Upload steps&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Identify the pprof file.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Path to your pprof file: &lt;code&gt;path/to/your/pprof-file.pprof&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Specify any extra labels.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can add additional labels to your uploaded profile using the &lt;code&gt;--extra-labels&lt;/code&gt; flag.&lt;/li&gt;
&lt;li&gt;You can provide the name of the application that the profile was captured from via the &lt;code&gt;service_name&lt;/code&gt; label (defaults to &lt;code&gt;profilecli-upload&lt;/code&gt;). This will be useful when querying the data via &lt;code&gt;profilecli&lt;/code&gt; or the UI.&lt;/li&gt;
&lt;li&gt;You can use the flag multiple times to add several labels.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Construct and execute the Upload command.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Here&amp;rsquo;s a basic command template:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=&amp;lt;pyroscope_server_url&amp;gt;
export PROFILECLI_USERNAME=&amp;lt;username&amp;gt;
export PROFILECLI_PASSWORD=&amp;lt;password&amp;gt;

profilecli upload --extra-labels=&amp;lt;label_name&amp;gt;=&amp;lt;label_value&amp;gt; &amp;lt;pprof_file_path&amp;gt;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=https://profiles-prod-001.grafana.net
export PROFILECLI_USERNAME=my_username
export PROFILECLI_PASSWORD=my_password

profilecli upload path/to/your/pprof-file.pprof&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example command with extra labels:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=https://profiles-prod-001.grafana.net
export PROFILECLI_USERNAME=my_username
export PROFILECLI_PASSWORD=my_password

profilecli upload \
    --extra-labels=service_name=my_application_name \
    --extra-labels=cluster=us-east \
    path/to/your/pprof-file.pprof&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check for successful upload.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;After running the command, you should see a confirmation message indicating a successful upload. If there are any issues, &lt;code&gt;profilecli&lt;/code&gt; provides error messages to help you troubleshoot.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;query-a-pyroscope-server-using-profilecli&#34;&gt;Query a Pyroscope server using &lt;code&gt;profilecli&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;You can use the &lt;code&gt;profilecli query&lt;/code&gt; command to look up the available profiles on a Pyroscope server and read actual profile data.
This can be useful for debugging purposes or for integrating profiling in CI pipelines (for example to facilitate &lt;a href=&#34;https://go.dev/doc/pgo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;profile-guided optimization&lt;/a&gt;).&lt;/p&gt;
&lt;h3 id=&#34;look-up-available-profiles-on-a-pyroscope-server&#34;&gt;Look up available profiles on a Pyroscope server&lt;/h3&gt;
&lt;p&gt;You can use the &lt;code&gt;profilecli query series&lt;/code&gt; command to look up the available profiles on a Pyroscope server.
By default, it queries the last hour of data, though this can be controlled with the &lt;code&gt;--from&lt;/code&gt; and &lt;code&gt;--to&lt;/code&gt; flags.
You can narrow the results down with the &lt;code&gt;--query&lt;/code&gt; flag. See &lt;code&gt;profilecli help query series&lt;/code&gt; for more information.&lt;/p&gt;
&lt;h4 id=&#34;query-series-steps&#34;&gt;Query series steps&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Optional: Specify a query and a time range.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can provide a label selector using the &lt;code&gt;--query&lt;/code&gt; flag, for example: &lt;code&gt;--query=&#39;{service_name=&amp;quot;my_application_name&amp;quot;}&#39;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can provide a custom time range using the &lt;code&gt;--from&lt;/code&gt; and &lt;code&gt;--to&lt;/code&gt; flags, for example, &lt;code&gt;--from=&amp;quot;now-3h&amp;quot; --to=&amp;quot;now&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Construct and execute the Query Series command.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Here&amp;rsquo;s a basic command template:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=&amp;lt;pyroscope_server_url&amp;gt;
export PROFILECLI_USERNAME=&amp;lt;username&amp;gt;
export PROFILECLI_PASSWORD=&amp;lt;password&amp;gt;

profilecli query series --query=&amp;#39;{&amp;lt;label_name&amp;gt;=&amp;#34;&amp;lt;label_value&amp;gt;&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=https://profiles-prod-001.grafana.net
export PROFILECLI_USERNAME=my_username
export PROFILECLI_PASSWORD=my_password

profilecli query series --query=&amp;#39;{service_name=&amp;#34;my_application_name&amp;#34;}&amp;#39;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;JSON&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-json&#34;&gt;{
    &amp;#34;__name__&amp;#34;:&amp;#34;memory&amp;#34;,
    &amp;#34;__period_type__&amp;#34;:&amp;#34;space&amp;#34;,
    &amp;#34;__period_unit__&amp;#34;:&amp;#34;bytes&amp;#34;,
    &amp;#34;__profile_type__&amp;#34;:&amp;#34;memory:inuse_objects:count:space:bytes&amp;#34;,
    &amp;#34;__service_name__&amp;#34;:&amp;#34;my_application_name&amp;#34;,
    &amp;#34;__type__&amp;#34;:&amp;#34;inuse_objects&amp;#34;,
    &amp;#34;__unit__&amp;#34;:&amp;#34;count&amp;#34;,
    &amp;#34;cluster&amp;#34;:&amp;#34;eu-west-1&amp;#34;,
    &amp;#34;service_name&amp;#34;:&amp;#34;my_application_name&amp;#34;
 }&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;read-a-raw-profile-from-a-pyroscope-server&#34;&gt;Read a raw profile from a Pyroscope server&lt;/h3&gt;
&lt;p&gt;You can use the &lt;code&gt;profilecli query profile&lt;/code&gt; command to retrieve a merged (aggregated) profile from a Pyroscope server.
The command merges all samples found in the profile store for the specified query and time range.
By default it looks for samples within the last hour, though this can be controlled with the &lt;code&gt;--from&lt;/code&gt; and &lt;code&gt;--to&lt;/code&gt; flags. The source data can be narrowed down with the &lt;code&gt;--query&lt;/code&gt; flag in the same way as with the &lt;code&gt;series&lt;/code&gt; command.&lt;/p&gt;
&lt;h4 id=&#34;query-profile-steps&#34;&gt;Query profile steps&lt;/h4&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Specify optional flags.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can provide a label selector using the &lt;code&gt;--query&lt;/code&gt; flag, for example, &lt;code&gt;--query=&#39;{service_name=&amp;quot;my_application_name&amp;quot;}&#39;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can provide a custom time range using the &lt;code&gt;--from&lt;/code&gt; and &lt;code&gt;--to&lt;/code&gt; flags, for example, &lt;code&gt;--from=&amp;quot;now-3h&amp;quot; --to=&amp;quot;now&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can specify the profile type via the &lt;code&gt;--profile-type&lt;/code&gt; flag. The available profile types are listed in the output of the &lt;code&gt;profilecli query series&lt;/code&gt; command.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Construct and execute the &lt;code&gt;query profile&lt;/code&gt; command.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Here&amp;rsquo;s a basic command template:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=&amp;lt;pyroscope_server_url&amp;gt;
export PROFILECLI_USERNAME=&amp;lt;username&amp;gt;
export PROFILECLI_PASSWORD=&amp;lt;password&amp;gt;

profilecli query profile \
    --profile-type=&amp;lt;profile_type&amp;gt; \
    --query=&amp;#39;{&amp;lt;label_name&amp;gt;=&amp;#34;&amp;lt;label_value&amp;gt;&amp;#34;}&amp;#39; \
    --from=&amp;#34;&amp;lt;from&amp;gt;&amp;#34; --to=&amp;#34;&amp;lt;to&amp;gt;&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=https://profiles-prod-001.grafana.net
export PROFILECLI_USERNAME=my_username
export PROFILECLI_PASSWORD=my_password

profilecli query profile \
    --profile-type=memory:inuse_space:bytes:space:bytes \
    --query=&amp;#39;{service_name=&amp;#34;my_application_name&amp;#34;}&amp;#39; \
    --from=&amp;#34;now-1h&amp;#34; --to=&amp;#34;now&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;level=info msg=&amp;#34;query aggregated profile from profile store&amp;#34; url=http://localhost:4040 from=2023-12-11T13:38:33.115683-04:00 to=2023-12-11T14:38:33.115684-04:00 query={} type=memory:inuse_space:bytes:space:bytes
PeriodType: space bytes
Period: 524288
Time: 2023-12-11 13:59:59.999 -0400 AST
Duration: 59m5
Samples:
inuse_space/bytes[dflt]
  115366240: 107 13 14 15 16 17 1 2 3
...&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;export-a-profile-for-go-pgo&#34;&gt;Export a profile for Go PGO&lt;/h3&gt;
&lt;p&gt;You can use the &lt;code&gt;profilecli query go-pgo&lt;/code&gt; command to retrieve an aggregated profile from a Pyroscope server for use with Go PGO.
Profiles retrieved with &lt;code&gt;profilecli query profile&lt;/code&gt; include all samples found in the profile store, resulting in a large profile size.
The profile size may cause issues with network transfer and slow down the PGO process.
In contrast, profiles retrieved with &lt;code&gt;profilecli query go-pgo&lt;/code&gt; include only the information used in Go PGO, making them significantly smaller and more efficient to handle.
By default, it looks for samples within the last hour, though this can be controlled with the &lt;code&gt;--from&lt;/code&gt; and &lt;code&gt;--to&lt;/code&gt; flags. The source data can be narrowed down with the &lt;code&gt;--query&lt;/code&gt; flag in the same way as with the &lt;code&gt;query&lt;/code&gt; command.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Specify optional flags.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can provide a label selector using the &lt;code&gt;--query&lt;/code&gt; flag, for example, &lt;code&gt;--query=&#39;{service_name=&amp;quot;my_application_name&amp;quot;}&#39;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can provide a custom time range using the &lt;code&gt;--from&lt;/code&gt; and &lt;code&gt;--to&lt;/code&gt; flags, for example, &lt;code&gt;--from=&amp;quot;now-3h&amp;quot; --to=&amp;quot;now&amp;quot;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;You can specify the profile type via the &lt;code&gt;--profile-type&lt;/code&gt; flag. The available profile types are listed in the output of the &lt;code&gt;profilecli query series&lt;/code&gt; command.&lt;/li&gt;
&lt;li&gt;You can specify the number of leaf locations to keep via the &lt;code&gt;--keep-locations&lt;/code&gt; flag. The default value is &lt;code&gt;5&lt;/code&gt;. The Go compiler does not use the full stack trace. Reducing the number helps to minimize the profile size.&lt;/li&gt;
&lt;li&gt;You can control whether to use callee aggregation with the &lt;code&gt;--aggregate-callees&lt;/code&gt; flag. By default, this option is enabled, meaning samples are aggregated based on the leaf location, disregarding the callee line number, which the Go compiler does not utilize. To disable aggregation, use the &lt;code&gt;--no-aggregate-callees&lt;/code&gt; flag.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Construct and execute the command.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Example command:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;export PROFILECLI_URL=https://profiles-prod-001.grafana.net
export PROFILECLI_USERNAME=my_username
export PROFILECLI_PASSWORD=my_password

profilecli query go-pgo \
    --query=&amp;#39;{service_name=&amp;#34;my_service&amp;#34;}&amp;#39; \
    --from=&amp;#34;now-1h&amp;#34; --to=&amp;#34;now&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Example output:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Bash&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-bash&#34;&gt;level=info msg=&amp;#34;querying pprof profile for Go PGO&amp;#34; url=https://localhost:4040 query=&amp;#34;{service_name=\&amp;#34;my_service\&amp;#34;}&amp;#34; from=2024-06-20T12:32:20&amp;#43;08:00 to=2024-06-20T15:24:40&amp;#43;08:00 type=process_cpu:cpu:nanoseconds:cpu:nanoseconds output=&amp;#34;pprof=default.pgo&amp;#34; keep-locations=5 aggregate-callees=true
# By default, the profile is saved to the current directory as `default.pgo`&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
]]></content><description>&lt;h1 id="profile-cli">Profile CLI&lt;/h1>
&lt;p>Pyroscope provides a command-line interface (CLI), &lt;code>profilecli&lt;/code>.
This utility enables various productivity flows such as:&lt;/p>
&lt;ul>
&lt;li>Interacting with a running Pyroscope server to upload profiles, query data, and more&lt;/li>
&lt;li>Inspecting &lt;a href="https://parquet.apache.org/docs/" target="_blank" rel="noopener noreferrer">Parquet&lt;/a> files&lt;/li>
&lt;/ul>
&lt;div class="admonition admonition-tip">&lt;blockquote>&lt;p class="title text-uppercase">Tip&lt;/p></description></item><item><title>Traces to profiles</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/traces-to-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/traces-to-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;traces-to-profiles&#34;&gt;Traces to profiles&lt;/h1&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Your application must be instrumented for profiles and traces. For more information, refer to 
    &lt;a href=&#34;/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/&#34;&gt;Link traces to profiles&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;



&lt;div data-shared=&#34;datasources/tempo-traces-to-profiles.md&#34;&gt;
            &lt;!-- # Trace to profiles  --&gt;
&lt;p&gt;Using Trace to profiles, you can use Grafana’s ability to correlate different signals by adding the functionality to link between traces and profiles.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Trace to profiles&lt;/strong&gt; lets you link your Grafana Pyroscope data source to tracing data.
When configured, this connection lets you run queries from a trace span into the profile data using &lt;strong&gt;Explore&lt;/strong&gt;.
Each span links to your queries. Clicking a link runs the query in a split panel.
If tags are configured, Grafana dynamically inserts the span attribute values into the query.
The query runs over the time range of the (span start time - 60) to (span end time &#43; 60 seconds).&lt;/p&gt;
&lt;p&gt;Embedded flame graphs are also inserted into each span details section that has a linked profile.
This lets you see resource consumption in a flame graph visualization for each span without having to navigate away from the current view.&lt;/p&gt;
&lt;iframe width=&#34;560&#34; height=&#34;315&#34; src=&#39;https://www.youtube.com/embed/AG8VzfFMLxo&#39; title=&#34;YouTube video player&#34; frameborder=&#34;0&#34; allow=&#34;accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share&#34; referrerpolicy=&#34;strict-origin-when-cross-origin&#34; allowfullscreen&gt;&lt;/iframe&gt;
&lt;p&gt;There are two ways to configure the trace to profiles feature:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use a basic configuration with default query, or&lt;/li&gt;
&lt;li&gt;Configure a custom query where you can use a template language to interpolate variables from the trace or span.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/grafana/data-sources/tempo/tempo-data-source-trace-to-profiles.png&#34;
  alt=&#34;Traces to profiles section in the Tempo data source&#34; width=&#34;919&#34;
     height=&#34;224&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Traces to profile requires a Tempo data source with Traces to profiles configured and a 
    &lt;a href=&#34;/docs/grafana/latest/datasources/grafana-pyroscope/&#34;&gt;Grafana Pyroscope data source&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As with traces, your application needs to be instrumented to emit profiling data. For more information, refer to 
    &lt;a href=&#34;/docs/pyroscope/v1.10.x/configure-client/trace-span-profiles/&#34;&gt;Linking tracing and profiling with span profiles&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-a-basic-configuration&#34;&gt;Use a basic configuration&lt;/h2&gt;
&lt;p&gt;To use a basic configuration, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the left menu, select &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data sources&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select your configured Tempo data source from the &lt;strong&gt;Data source&lt;/strong&gt; list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Scroll down to the &lt;strong&gt;Traces to profiles&lt;/strong&gt; section.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select a Pyroscope data source in the &lt;strong&gt;Data source&lt;/strong&gt; drop-down.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add one or more tags to use in the query. If left blank, the default values of &lt;code&gt;service.name&lt;/code&gt; and &lt;code&gt;service.namespace&lt;/code&gt; are used.&lt;/p&gt;
&lt;p&gt;The tags you configure must be present in the spans attributes or resources for a trace-to-profiles span link to appear.&lt;/p&gt;
&lt;p&gt;You can optionally configure a new name for the tag. This is useful if the tag has dots in the name and the target data source doesn&amp;rsquo;t allow dots in labels. In that case, you can remap &lt;code&gt;service.name&lt;/code&gt; to &lt;code&gt;service_name&lt;/code&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select one or more profile types to use in the query. Select the drop-down and choose options from the menu.&lt;/p&gt;
&lt;p&gt;The profile type or app must be selected for the query to be valid. Grafana doesn&amp;rsquo;t show any data if the profile type or app isn’t selected when a query runs.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select &lt;strong&gt;Save and Test&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you have configured a Pyroscope data source and no profile data is available or the &lt;strong&gt;Profiles for this span&lt;/strong&gt;
button and the embedded flame graph isn&amp;rsquo;t visible, verify that the &lt;code&gt;pyroscope.profile.id&lt;/code&gt; key-value pair exists in your span tags.&lt;/p&gt;
&lt;h2 id=&#34;configure-custom-query-traces-profiles&#34;&gt;Configure a custom query&lt;/h2&gt;
&lt;p&gt;To use a custom query with the configuration, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;In the left menu, select &lt;strong&gt;Connections&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data sources&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select a configured Tempo data source from the &lt;strong&gt;Data source&lt;/strong&gt; list.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Scroll down to the &lt;strong&gt;Traces to profiles&lt;/strong&gt; section.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select a Pyroscope data source in the &lt;strong&gt;Data source&lt;/strong&gt; drop-down.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Choose any tags to use in the query. If left blank, the default values of &lt;code&gt;service.name&lt;/code&gt; and &lt;code&gt;service.namespace&lt;/code&gt; are used.&lt;/p&gt;
&lt;p&gt;These tags can be used in the custom query with &lt;code&gt;${__tags}&lt;/code&gt; variable. This variable interpolates the mapped tags as list in an appropriate syntax for the data source. Only tags present in the span are included. Tags that aren&amp;rsquo;t present are omitted.&lt;/p&gt;
&lt;p&gt;You can also configure a name for the tag. Tag names are useful where the tag has dots in the name and the target data source doesn&amp;rsquo;t allow using dots in labels. For example, you can remap &lt;code&gt;service.name&lt;/code&gt; to &lt;code&gt;service_name&lt;/code&gt;. If you don’t map any tags here, you can still use any tag in the query, for example: &lt;code&gt;method=&amp;quot;${__span.tags.method}&amp;quot;&lt;/code&gt;. Learn more about 
    &lt;a href=&#34;/docs/grafana/latest/datasources/tempo/configure-tempo-data-source/#custom-query-variables&#34;&gt;custom query variables&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select one or more profile types to use in the query. Select the drop-down and choose options from the menu.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Switch on &lt;strong&gt;Use custom query&lt;/strong&gt; to enter a custom query.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Specify a custom query to be used to query profile data. You can use various variables to make that query relevant for current span. The link shows only if all the variables are interpolated with non-empty values to prevent creating an invalid query. You can interpolate the configured tags using the &lt;code&gt;$__tags&lt;/code&gt; keyword.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select &lt;strong&gt;Save and Test&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;configuration-options&#34;&gt;Configuration options&lt;/h2&gt;
&lt;p&gt;The following table describes options for configuring your &lt;strong&gt;Trace to profiles&lt;/strong&gt; settings:&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Setting name&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Data source&lt;/td&gt;
              &lt;td&gt;Defines the target data source. You can select a Pyroscope [profiling] data source.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Tags&lt;/td&gt;
              &lt;td&gt;Defines the tags to use in the profile query. Default: &lt;code&gt;cluster&lt;/code&gt;, &lt;code&gt;hostname&lt;/code&gt;, &lt;code&gt;namespace&lt;/code&gt;, &lt;code&gt;pod&lt;/code&gt;, &lt;code&gt;service.name&lt;/code&gt;, &lt;code&gt;service.namespace&lt;/code&gt;. You can change the tag name for example to remove dots from the name if they&amp;rsquo;re not allowed in the target data source. For example, map &lt;code&gt;http.status&lt;/code&gt; to &lt;code&gt;http_status&lt;/code&gt;.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Profile type&lt;/td&gt;
              &lt;td&gt;Defines the profile type that used in the query.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Use custom query&lt;/td&gt;
              &lt;td&gt;Toggles use of custom query with interpolation.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Query&lt;/td&gt;
              &lt;td&gt;Input to write custom query. Use variable interpolation to customize it with variables from span.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;/div&gt;

        
]]></content><description>&lt;h1 id="traces-to-profiles">Traces to profiles&lt;/h1>
&lt;div class="admonition admonition-note">&lt;blockquote>&lt;p class="title text-uppercase">Note&lt;/p>&lt;p>Your application must be instrumented for profiles and traces. For more information, refer to
&lt;a href="/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/">Link traces to profiles&lt;/a>.&lt;/p>&lt;/blockquote>&lt;/div>
&lt;div data-shared="datasources/tempo-traces-to-profiles.md">
&lt;!-- # Trace to profiles -->
&lt;p>Using Trace to profiles, you can use Grafana’s ability to correlate different signals by adding the functionality to link between traces and profiles.&lt;/p></description></item><item><title>Integrate your source code on GitHub with Pyroscope profiling data.</title><link>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/line-by-line/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/view-and-analyze-profile-data/line-by-line/</guid><content><![CDATA[&lt;h1 id=&#34;integrate-your-source-code-on-github-with-pyroscope-profiling-data&#34;&gt;Integrate your source code on GitHub with Pyroscope profiling data.&lt;/h1&gt;
&lt;p&gt;The Grafana Pyroscope source code integration offers seamless integration between your GitHub code repositories and Grafana.
Using this app, you can map your code directly within Grafana and visualize resource performance line by line.
With these powerful capabilities, you can gain deep insights into your code&amp;rsquo;s execution and identify performance bottlenecks.&lt;/p&gt;
&lt;p&gt;Every profile type works with the integration for code written in Go, Java, and Python.&lt;/p&gt;
&lt;p&gt;For information on profile types and the profiles available with Go, Java, and Python, refer to &lt;a href=&#34;../../introduction/profiling-types/&#34;&gt;Profiling types and their uses&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/grafana-cloud/profiles/screenshot-profiles-github-integration.png&#34;
  alt=&#34;Example of a flame graph with the function details populated&#34; width=&#34;1298&#34;
     height=&#34;812&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;how-it-works&#34;&gt;How it works&lt;/h2&gt;
&lt;p&gt;The Pyroscope source code integration uses labels configured in the application being profiled to associate profiles with source code.
The integration is available for Go, Java, and Python applications.&lt;/p&gt;
&lt;p&gt;The Pyroscope source code integration uses three labels, &lt;code&gt;service_repository&lt;/code&gt;, &lt;code&gt;service_git_ref&lt;/code&gt;, and &lt;code&gt;service_root_path&lt;/code&gt;, to add commit information, repository link, and an enhanced source code preview to the &lt;strong&gt;Function Details&lt;/strong&gt; screen.&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;The source code mapping is only available to people who have access to the source code in GitHub.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use the Pyroscope source code integration with GitHub, you need an application that emits profiling data, a GitHub account, and a Grafana instance with a Grafana Pyroscope backend.&lt;/p&gt;
&lt;h3 id=&#34;application-with-profiling-data-requirements&#34;&gt;Application with profiling data requirements&lt;/h3&gt;


&lt;div class=&#34;admonition admonition-warning&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Warning&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;Applications in other languages aren&amp;rsquo;t supported&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;A Go application which is profiled by Grafana Alloy&amp;rsquo;s &lt;code&gt;pyroscope.scrape&lt;/code&gt;, &lt;code&gt;pyroscope.ebpf&lt;/code&gt; (Alloy v1.11.0&#43;), or using the &lt;a href=&#34;../../configure-client/language-sdks/go_push/&#34;&gt;Go Push SDK&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A Java application which is profiled by Grafana Alloy&amp;rsquo;s &lt;code&gt;pyroscope.java&lt;/code&gt;, &lt;code&gt;pyroscope.ebpf&lt;/code&gt; (Alloy v1.11.0&#43;), or using the &lt;a href=&#34;../../configure-client/language-sdks/java&#34;&gt;Java SDK&lt;/a&gt;. For Java applications, a committed &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file is required to map package names to source code locations (see &lt;a href=&#34;#advanced-source-code-mapping-with-pyroscopeyaml&#34;&gt;Advanced source code mapping with &lt;code&gt;.pyroscope.yaml&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;A Python application which is profiled by Grafana Alloy&amp;rsquo;s &lt;code&gt;pyroscope.ebpf&lt;/code&gt; (Alloy v1.11.0&#43;) or using the &lt;a href=&#34;../../configure-client/language-sdks/python&#34;&gt;Python SDK&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Your application provides the following labels (tags):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;service_git_ref&lt;/code&gt; points to the Git commit or &lt;a href=&#34;https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#about-git-references&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;reference&lt;/a&gt; from which the binary was built&lt;/li&gt;
&lt;li&gt;&lt;code&gt;service_repository&lt;/code&gt; is the GitHub repository that hosts the source code&lt;/li&gt;
&lt;li&gt;&lt;code&gt;service_root_path&lt;/code&gt; (Optional) is the path where the code lives inside the repository&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To activate this integration, add at least the two mandatory labels when
sending profiles: &lt;code&gt;service_repository&lt;/code&gt; and &lt;code&gt;service_git_ref&lt;/code&gt;. Set them to the
full repository GitHub URL and the current &lt;a href=&#34;https://docs.github.com/en/rest/git/refs?apiVersion=2022-11-28#about-git-references&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;git ref&lt;/code&gt;&lt;/a&gt;
respectively.&lt;/p&gt;
&lt;p&gt;For example, using the Go SDK you can set these labels as tags in the configuration:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;Go&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-go&#34;&gt;pyroscope.Start(pyroscope.Config{
    Tags: map[string]string{
      &amp;#34;service_git_ref&amp;#34;:    &amp;#34;&amp;lt;GIT_REF&amp;gt;&amp;#34;,
      &amp;#34;service_repository&amp;#34;: &amp;#34;https://github.com/&amp;lt;YOUR_ORG&amp;gt;/&amp;lt;YOUR_REPOSITORY&amp;gt;&amp;#34;,
      &amp;#34;service_root_path&amp;#34;: &amp;#34;&amp;lt;PATH_TO_SERVICE_ROOT&amp;gt;&amp;#34;, // optional
    },
    // Other configuration
  })&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;You can also override these values directly in the UI by clicking the edit
button next to the repository information in the Function Details panel. This
is useful for testing new configurations before deploying label changes, or for
quickly setting up source code viewing during an incident.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/pyroscope/pyroscope-edit-service-repository.png&#34;
  alt=&#34;Edit service repository settings&#34; width=&#34;533&#34;
     height=&#34;47&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;github-requirements&#34;&gt;GitHub requirements&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;A GitHub account&lt;/li&gt;
&lt;li&gt;Source code hosted on GitHub&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Data from your GitHub repository may be limited if your GitHub organization or repository restricts third-party applications.
For example, the organization may need to add this app to an allowlist to access organizational resources.
Contact your organization administrator for assistance.
Refer to &lt;a href=&#34;https://docs.github.com/en/apps/using-github-apps/requesting-a-github-app-from-your-organization-owner&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Requesting a GitHub App from your organization owner&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;ensure-the-source-code-integration-is-configured-in-grafana-pyroscope&#34;&gt;Ensure the source code integration is configured in Grafana Pyroscope&lt;/h3&gt;
&lt;p&gt;Refer to &lt;a href=&#34;../../configure-server/configuring-github-integration/&#34;&gt;Configure Pyroscope source code integration&lt;/a&gt; on the steps required.&lt;/p&gt;
&lt;h3 id=&#34;ensure-the-grafana-pyroscope-data-source-is-configured-correctly&#34;&gt;Ensure the Grafana Pyroscope data source is configured correctly&lt;/h3&gt;
&lt;p&gt;In order to make use of the GitHub integration, the Pyroscope data source needs to be configured to pass a particular cookie through.&lt;/p&gt;
&lt;p&gt;To configure cookie passthrough in Grafana:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Navigate to &lt;strong&gt;Configuration&lt;/strong&gt; &amp;gt; &lt;strong&gt;Data sources&lt;/strong&gt; in Grafana.&lt;/li&gt;
&lt;li&gt;Select your Pyroscope data source.&lt;/li&gt;
&lt;li&gt;Under &lt;strong&gt;Additional settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Advanced HTTP settings&lt;/strong&gt; , locate &lt;strong&gt;Allowed cookies&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;pyroscope_git_session&lt;/code&gt; to the list of cookies to forward.&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Save &amp;amp; test&lt;/strong&gt; to apply the changes.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/pyroscope/pyroscope-data-source-additional-settings.png&#34;
  alt=&#34;Additional data source settings for Pyroscope source code integration&#34; width=&#34;621&#34;
     height=&#34;176&#34;/&gt;&lt;/p&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Cookie forwarding must be enabled for the source code integration to work properly. Without it, you won&amp;rsquo;t be able to connect to GitHub repositories from within Grafana Profiles Drilldown.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;authorize-access-to-github&#34;&gt;Authorize access to GitHub&lt;/h2&gt;
&lt;p&gt;You can authorize with GitHub using the &lt;strong&gt;Connect to GitHub&lt;/strong&gt; in the &lt;strong&gt;Function Details&lt;/strong&gt; panel.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;From within &lt;strong&gt;Single view&lt;/strong&gt; with a configured Pyroscope app plugin.&lt;/li&gt;
&lt;li&gt;Select &lt;strong&gt;Pyroscope service&lt;/strong&gt;. For this example, select &lt;code&gt;cpu_profile&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Click in the flame graph on a function you want to explore. Select &lt;strong&gt;Function details&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;Function Details&lt;/strong&gt;, locate the &lt;strong&gt;Repository&lt;/strong&gt; field and select &lt;strong&gt;Connect to &amp;lt;GITHUB REPOSITORY&amp;gt;&lt;/strong&gt;, where &lt;code&gt;&amp;lt;GITHUB REPOSITORY&amp;gt;&lt;/code&gt; is replaced with the repository name where the files reside. In this case, it’s connecting to the &lt;code&gt;grafana/pyroscope&lt;/code&gt; repository.&lt;/li&gt;
&lt;li&gt;If prompted, log in to GitHub.&lt;/li&gt;
&lt;li&gt;After Grafana connects to your GitHub account, review the permissions and select &lt;strong&gt;Authorize Grafana Pyroscope&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;Organization owners may disallow third-party apps for the entire organization or specific organization resources, like repositories.
If this is the case, you won&amp;rsquo;t be able authorize the Grafana Pyroscope GitHub integration to view source code or commit information for the protected resources.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;modify-or-remove-the-pyroscope-source-code-integration-from-your-github-account&#34;&gt;Modify or remove the Pyroscope source code integration from your GitHub account&lt;/h3&gt;
&lt;p&gt;The Pyroscope source code integration for GitHub uses a GitHub app called &amp;ldquo;Grafana Pyroscope&amp;rdquo; to connect to GitHub.
This application authorizes Grafana Cloud to access source code and commit information.&lt;/p&gt;
&lt;p&gt;After authorizing the app, your GitHub account, &lt;strong&gt;GitHub&lt;/strong&gt; &amp;gt; &lt;strong&gt;Settings&lt;/strong&gt; &amp;gt; &lt;strong&gt;Applications&lt;/strong&gt; lists the Grafana Pyroscope app.&lt;/p&gt;
&lt;p&gt;You can change the repositories the Pyroscope source code integration can access on the &lt;strong&gt;Applications&lt;/strong&gt; page.&lt;/p&gt;
&lt;p&gt;You can use also remove the app&amp;rsquo;s permissions by selecting &lt;strong&gt;Revoke&lt;/strong&gt;.
Revoking the permissions disables the integration in your Grafana Cloud account.&lt;/p&gt;
&lt;p&gt;For more information about GitHub applications:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.github.com/en/apps/using-github-apps/about-using-github-apps&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Using GitHub apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.github.com/en/apps/using-github-apps/authorizing-github-apps&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Authorizing GitHub apps&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.github.com/en/apps/using-github-apps/installing-a-github-app-from-a-third-party#difference-between-installation-and-authorization&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Differences between installing and authorizing apps&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;how-your-github-code-shows-up-in-profile-data-queries&#34;&gt;How your GitHub code shows up in profile data queries&lt;/h2&gt;
&lt;p&gt;After authorizing the Pyroscope Grafana source code integration, you see more details in the &lt;strong&gt;Function Details&lt;/strong&gt; from flame graphs in Profiles Drilldown.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Open a browser to your Pyroscope instance.&lt;/li&gt;
&lt;li&gt;Sign in to your account, if prompted.&lt;/li&gt;
&lt;li&gt;After the Grafana instance loads, select &lt;strong&gt;Drilldown&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Next, select &lt;strong&gt;Profiles&lt;/strong&gt; &amp;gt; &lt;strong&gt;Single view&lt;/strong&gt; from the left-side menu.&lt;/li&gt;
&lt;li&gt;Optional: Select a &lt;strong&gt;Service&lt;/strong&gt; and &lt;strong&gt;Profile&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Click in the flame graph and select &lt;strong&gt;Function details&lt;/strong&gt; from the pop-up menu.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;function-details&#34;&gt;Function Details&lt;/h3&gt;
&lt;p&gt;The Function Details section provides information about the function you selected from the flame graph.&lt;/p&gt;
&lt;figure
    class=&#34;figure-wrapper figure-wrapper__lightbox w-100p center&#34;
    style=&#34;max-width: 80%;&#34;
    itemprop=&#34;associatedMedia&#34;
    itemscope=&#34;&#34;
    itemtype=&#34;http://schema.org/ImageObject&#34;
  &gt;&lt;a
        class=&#34;lightbox-link captioned&#34;
        href=&#34;/media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png&#34;
        itemprop=&#34;contentUrl&#34;
      &gt;&lt;div class=&#34;img-wrapper w-100p h-auto&#34;&gt;&lt;img
          class=&#34;lazyload mb-0&#34;
          data-src=&#34;/media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png&#34;data-srcset=&#34;/media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=320 320w, /media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=550 550w, /media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=750 750w, /media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=900 900w, /media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=1040 1040w, /media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=1240 1240w, /media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png?w=1920 1920w&#34;data-sizes=&#34;auto&#34;alt=&#34;Function Details panel from a connected Pyroscope source code integration.&#34;width=&#34;1352&#34;height=&#34;1268&#34;title=&#34;Function Details panel from a connected Pyroscope source code integration.&#34;/&gt;
        &lt;noscript&gt;
          &lt;img
            src=&#34;/media/docs/grafana-cloud/profiles/screenshot-profiles-github-funct-details-v3.png&#34;
            alt=&#34;Function Details panel from a connected Pyroscope source code integration.&#34;width=&#34;1352&#34;height=&#34;1268&#34;title=&#34;Function Details panel from a connected Pyroscope source code integration.&#34;class=&#34;center&#34;/&gt;
        &lt;/noscript&gt;&lt;/div&gt;&lt;figcaption class=&#34;w-100p caption text-gray-13 text-center  &#34;&gt;Function Details panel from a connected Pyroscope source code integration.&lt;/figcaption&gt;&lt;/a&gt;&lt;/figure&gt;
&lt;p&gt;The table explains the main fields in the table.
The values for some of the fields, such as Self and Total, change depending whether a profile uses time or memory amount.
Refer to &lt;a href=&#34;/docs/pyroscope/latest/view-and-analyze-profile-data/self-vs-total/&#34;&gt;Understand Self versus Total metrics in profiling with Pyroscope&lt;/a&gt; for more information.&lt;/p&gt;
&lt;section class=&#34;expand-table-wrapper&#34;&gt;&lt;div class=&#34;button-div&#34;&gt;
      &lt;button class=&#34;expand-table-btn&#34;&gt;Expand table&lt;/button&gt;
    &lt;/div&gt;&lt;div class=&#34;responsive-table-wrapper&#34;&gt;
    &lt;table&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Field&lt;/th&gt;
              &lt;th&gt;Meaning&lt;/th&gt;
              &lt;th&gt;Notes&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Function name&lt;/td&gt;
              &lt;td&gt;The name of the selected function&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Start time&lt;/td&gt;
              &lt;td&gt;The line where the function definition starts&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;File&lt;/td&gt;
              &lt;td&gt;Path where the function is defined&lt;/td&gt;
              &lt;td&gt;You can use the clipboard icon to copy the path.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Repository&lt;/td&gt;
              &lt;td&gt;The repository configured for the selected service&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Commit&lt;/td&gt;
              &lt;td&gt;The version of the application (commit) where the function is defined. Use the drop-down menu to target a specific commit.&lt;/td&gt;
              &lt;td&gt;Click the Commit ID to view the commit in the repository.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Breakdown per line (table)&lt;/td&gt;
              &lt;td&gt;Provides the function location in the code and self and total values.&lt;/td&gt;
              &lt;td&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Self&lt;/td&gt;
              &lt;td&gt;&amp;lsquo;Self&amp;rsquo; refers to the resource usage (CPU time, memory allocation, etc.) directly attributed to a specific function or a code segment, excluding the resources used by its sub-functions or calls&lt;/td&gt;
              &lt;td&gt;This value can be a time or memory amount depending on the profile selected.&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Total&lt;/td&gt;
              &lt;td&gt;&amp;lsquo;Total&amp;rsquo; encompasses the combined resource usage of a function along with all the functions it calls.&lt;/td&gt;
              &lt;td&gt;This value can be a time or memory amount depending on the profile selected.&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;advanced-source-code-mapping-with-pyroscopeyaml&#34;&gt;Advanced source code mapping with &lt;code&gt;.pyroscope.yaml&lt;/code&gt;&lt;/h2&gt;
&lt;p&gt;For more complex applications with multiple dependencies and external libraries, you can configure custom source code mappings using a &lt;code&gt;.pyroscope.yaml&lt;/code&gt; configuration file in your repository. This feature enables Pyroscope to resolve and display source code from:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Multiple GitHub repositories (for example, third-party dependencies)&lt;/li&gt;
&lt;li&gt;Different versions and branches of dependencies&lt;/li&gt;
&lt;li&gt;Standard library code (Go, Java)&lt;/li&gt;
&lt;li&gt;Vendor directories and local paths&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;how-source-code-mapping-works&#34;&gt;How source code mapping works&lt;/h3&gt;
&lt;p&gt;When you click on a function in the flame graph, Pyroscope performs the following steps to retrieve the source code:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Load configuration&lt;/strong&gt;: Pyroscope checks for a &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file in your service&amp;rsquo;s root path. This is determined by labels on the profiling data as mentioned in &lt;a href=&#34;#how-this-works&#34;&gt;How this works&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Match file location&lt;/strong&gt;: If a configuration file exists, the system matches the file path or function name from the profiling data against the configured mappings using a longest-prefix-match algorithm.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resolve matched source location&lt;/strong&gt;: If a mapping matches, Pyroscope determines whether to fetch code from:
&lt;ul&gt;
&lt;li&gt;A local path within your repository&lt;/li&gt;
&lt;li&gt;An external GitHub repository at a specific version&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Automatic mapping&lt;/strong&gt;: If no configuration file exists or no mappings matched, the system tries to find the related source code using heuristics:
&lt;ul&gt;
&lt;li&gt;Go: Detect standard library functions and &lt;code&gt;go.mod&lt;/code&gt; dependencies&lt;/li&gt;
&lt;li&gt;All languages: Resolve using the file path relative to the service root&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fetch and display&lt;/strong&gt;: The source code is retrieved and displayed in the Function Details panel with line-by-line profiling data&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;supported-languages&#34;&gt;Supported languages&lt;/h3&gt;
&lt;p&gt;Pyroscope&amp;rsquo;s source code integration supports the following languages:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Go&lt;/strong&gt;: Full support including standard library, Go modules, and vendor directories. Works automatically without configuration, but can be customized with &lt;code&gt;.pyroscope.yaml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Python&lt;/strong&gt;: Full support including standard library and installed packages. Works automatically without configuration, but can be customized with &lt;code&gt;.pyroscope.yaml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Java&lt;/strong&gt;: Requires a &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file with explicit mappings for application code and dependencies.&lt;/li&gt;
&lt;/ul&gt;


&lt;div class=&#34;admonition admonition-note&#34;&gt;&lt;blockquote&gt;&lt;p class=&#34;title text-uppercase&#34;&gt;Note&lt;/p&gt;&lt;p&gt;While Go and Python work automatically, you can use a &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file to customize source mappings for any language.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h3 id=&#34;configuration-file-format&#34;&gt;Configuration file format&lt;/h3&gt;
&lt;p&gt;Create a &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file in the root of your repository (or in the path specified by &lt;code&gt;service_root_path&lt;/code&gt; if configured) with the following structure:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;version: v1                    # Config format version (currently only v1 is supported)
source_code:
  mappings:                    # Array of source-to-repository mappings
    - path:                    # Match files by path prefix (optional if function_name is specified)
        - prefix: path/to/match
        - prefix: another/path
      function_name:           # Match by function name prefix (optional if path is specified)
        - prefix: function/prefix
      language: go             # Required: &amp;#34;go&amp;#34;, &amp;#34;java&amp;#34;, or &amp;#34;python&amp;#34;
      source:                  # Define where to fetch the source code
        local:
          path: src/main/java  # Path relative to the location of the .pyroscope.yaml file
        # OR
        github:
          owner: organization  # GitHub repository owner
          repo: repository     # GitHub repository name
          ref: v1.0.0         # Branch, tag, or commit SHA
          path: src            # Path within the external repository&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;configuration-rules&#34;&gt;Configuration rules&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Each mapping must specify either a &lt;code&gt;local&lt;/code&gt; or &lt;code&gt;github&lt;/code&gt; source (not both)&lt;/li&gt;
&lt;li&gt;Multiple &lt;code&gt;path&lt;/code&gt; or &lt;code&gt;function_name&lt;/code&gt; prefixes can be specified per mapping (they are OR&amp;rsquo;d together)&lt;/li&gt;
&lt;li&gt;Mappings are evaluated using longest-prefix-match (more specific mappings take precedence)&lt;/li&gt;
&lt;li&gt;If no mapping matches, Pyroscope falls back to language-specific default behavior (automatic resolution for Go; Java requires explicit mappings)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;example-go-standard-library-mapping&#34;&gt;Example: Go standard library mapping&lt;/h3&gt;
&lt;p&gt;Map the Go standard library to a specific Go version:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;version: v1
source_code:
  mappings:
    - path:
        - prefix: $GOROOT/src
      language: go
      source:
        github:
          owner: golang
          repo: go
          ref: go1.24.10
          path: src&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This configuration ensures that when you view standard library functions like &lt;code&gt;fmt.Println&lt;/code&gt; or &lt;code&gt;net/http.Server&lt;/code&gt;, Pyroscope fetches the source code from the &lt;code&gt;golang/go&lt;/code&gt; repository at version 1.24.10.&lt;/p&gt;
&lt;h3 id=&#34;example-java-application-with-dependencies&#34;&gt;Example: Java application with dependencies&lt;/h3&gt;
&lt;p&gt;Configure mappings for a Java Spring application:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;version: v1
source_code:
  mappings:
    # Local application code
    - function_name:
        - prefix: org/example/myapp
      language: java
      source:
        local:
          path: src/main/java

    # JDK standard library
    - function_name:
        - prefix: java
        - prefix: javax
      language: java
      source:
        github:
          owner: openjdk
          repo: jdk
          ref: jdk-17&amp;#43;0
          path: src/java.base/share/classes

    # Spring Framework dependencies
    - function_name:
        - prefix: org/springframework/web/servlet
      language: java
      source:
        github:
          owner: spring-projects
          repo: spring-framework
          ref: v5.3.20
          path: spring-webmvc/src/main/java

    - function_name:
        - prefix: org/springframework/web
        - prefix: org/springframework/http
      language: java
      source:
        github:
          owner: spring-projects
          repo: spring-framework
          ref: v5.3.20
          path: spring-web/src/main/java&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This configuration demonstrates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Longest-prefix matching&lt;/strong&gt;: &lt;code&gt;org/springframework/web/servlet&lt;/code&gt; matches the more specific mapping, while &lt;code&gt;org/springframework/web/client&lt;/code&gt; matches the less specific one&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Multiple prefixes&lt;/strong&gt;: HTTP and web packages from Spring are grouped together&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Mixed sources&lt;/strong&gt;: Local application code and external dependencies&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;example-go-application-with-vendor-dependencies&#34;&gt;Example: Go application with vendor dependencies&lt;/h3&gt;
&lt;p&gt;Map vendored dependencies and modules:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;version: v1
source_code:
  mappings:
    # Vendor directory (for dependencies copied into your repo)
    - path:
        - prefix: vendor/
      language: go
      source:
        local:
          path: vendor

    # External dependency at specific version
    - path:
        - prefix: github.com/prometheus/client_golang
      language: go
      source:
        github:
          owner: prometheus
          repo: client_golang
          ref: v1.19.0
          path: &amp;#34;&amp;#34;&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;example-python-application-with-dependencies&#34;&gt;Example: Python application with dependencies&lt;/h3&gt;
&lt;p&gt;Map Python application code and external dependencies:&lt;/p&gt;

&lt;div class=&#34;code-snippet &#34;&gt;&lt;div class=&#34;lang-toolbar&#34;&gt;
    &lt;span class=&#34;lang-toolbar__item lang-toolbar__item-active&#34;&gt;YAML&lt;/span&gt;
    &lt;span class=&#34;code-clipboard&#34;&gt;
      &lt;button x-data=&#34;app_code_snippet()&#34; x-init=&#34;init()&#34; @click=&#34;copy()&#34;&gt;
        &lt;img class=&#34;code-clipboard__icon&#34; src=&#34;/media/images/icons/icon-copy-small-2.svg&#34; alt=&#34;Copy code to clipboard&#34; width=&#34;14&#34; height=&#34;13&#34;&gt;
        &lt;span&gt;Copy&lt;/span&gt;
      &lt;/button&gt;
    &lt;/span&gt;
    &lt;div class=&#34;lang-toolbar__border&#34;&gt;&lt;/div&gt;
  &lt;/div&gt;&lt;div class=&#34;code-snippet &#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-yaml&#34;&gt;version: v1
source_code:
  mappings:
    # Local application code
    - path:
        - prefix: /app/src
      language: python
      source:
        local:
          path: src

    # Python standard library
    - path:
        - prefix: /usr/lib/python3.12
        - prefix: /usr/local/lib/python3.12
      language: python
      source:
        github:
          owner: python
          repo: cpython
          ref: v3.12.0
          path: Lib

    # External package (requests)
    - path:
        - prefix: /usr/local/lib/python3.12/site-packages/requests
      language: python
      source:
        github:
          owner: psf
          repo: requests
          ref: v2.31.0
          path: src/requests&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;This configuration demonstrates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Local application code&lt;/strong&gt;: Maps your application&amp;rsquo;s source directory&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Standard library&lt;/strong&gt;: Maps Python standard library paths to the CPython repository&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;External packages&lt;/strong&gt;: Maps third-party packages to their GitHub repositories&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;language-specific-behavior&#34;&gt;Language-specific behavior&lt;/h3&gt;
&lt;h4 id=&#34;go&#34;&gt;Go&lt;/h4&gt;
&lt;p&gt;For Go applications, Pyroscope provides intelligent fallback behavior even without a &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Standard library&lt;/strong&gt;: Automatically detected and mapped to the appropriate &lt;code&gt;golang/go&lt;/code&gt; repository version&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Go modules&lt;/strong&gt;: Parsed from &lt;code&gt;go.mod&lt;/code&gt; in your repository, with automatic version resolution&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vanity URLs&lt;/strong&gt;: Resolved to canonical repositories (for example, &lt;code&gt;gopkg.in&lt;/code&gt;, &lt;code&gt;google.golang.org&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Vendor directories&lt;/strong&gt;: Files in &lt;code&gt;vendor/&lt;/code&gt; are searched relative to repository root&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The system extracts Go version information from paths like &lt;code&gt;/usr/local/go/go1.24.10/src/fmt/print.go&lt;/code&gt;.&lt;/p&gt;
&lt;h4 id=&#34;java&#34;&gt;Java&lt;/h4&gt;
&lt;p&gt;Java applications &lt;strong&gt;require&lt;/strong&gt; explicit mappings in &lt;code&gt;.pyroscope.yaml&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Function name conversion&lt;/strong&gt;: Java function names like &lt;code&gt;org/example/App$Inner.method&lt;/code&gt; are automatically converted to &lt;code&gt;org/example/App.java&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;No fallback&lt;/strong&gt;: Unlike Go and Python, Java files cannot be resolved without configuration&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Inner classes&lt;/strong&gt;: Automatically handled (inner class markers are stripped)&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&#34;python&#34;&gt;Python&lt;/h4&gt;
&lt;p&gt;For Python applications, Pyroscope provides intelligent fallback behavior similar to Go:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Standard library&lt;/strong&gt;: Automatically detected and mapped to the appropriate &lt;code&gt;python/cpython&lt;/code&gt; repository version&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Installed packages&lt;/strong&gt;: Resolved from virtual environments or system packages&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;File paths&lt;/strong&gt;: Direct file paths are used when available from profiling data&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The system extracts Python version information from paths to map to the correct CPython repository version.&lt;/p&gt;
&lt;h3 id=&#34;troubleshooting&#34;&gt;Troubleshooting&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;No source code displayed&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Verify the &lt;code&gt;.pyroscope.yaml&lt;/code&gt; file is in your service&amp;rsquo;s configured root path and that the root path is configured as expected&lt;/li&gt;
&lt;li&gt;Check that the &lt;code&gt;path&lt;/code&gt; or &lt;code&gt;function_name&lt;/code&gt; prefixes match your profiling data&lt;/li&gt;
&lt;li&gt;For Java applications, ensure all dependencies have mappings configured&lt;/li&gt;
&lt;li&gt;Confirm GitHub OAuth authorization is active and hasn&amp;rsquo;t expired&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Wrong version displayed&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Check the &lt;code&gt;ref&lt;/code&gt; field in your mapping points to the correct branch, tag, or commit&lt;/li&gt;
&lt;li&gt;For Go standard library, verify the Go version in your mapping matches your application&amp;rsquo;s Go version&lt;/li&gt;
&lt;li&gt;Use explicit commit SHAs for reproducibility&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Mapping precedence issues&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pyroscope uses longest-prefix-match. If a more specific mapping isn&amp;rsquo;t being used:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Verify the prefix exactly matches the beginning of the path or function name&lt;/li&gt;
&lt;li&gt;Check that more specific mappings are listed in the configuration (order doesn&amp;rsquo;t matter, but clarity helps)&lt;/li&gt;
&lt;li&gt;Test with exact prefixes from your profiling data&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="integrate-your-source-code-on-github-with-pyroscope-profiling-data">Integrate your source code on GitHub with Pyroscope profiling data.&lt;/h1>
&lt;p>The Grafana Pyroscope source code integration offers seamless integration between your GitHub code repositories and Grafana.
Using this app, you can map your code directly within Grafana and visualize resource performance line by line.
With these powerful capabilities, you can gain deep insights into your code&amp;rsquo;s execution and identify performance bottlenecks.&lt;/p></description></item></channel></rss>