<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Link tracing and profiling with Span Profiles on Grafana Labs</title><link>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/</link><description>Recent content in Link tracing and profiling with Span Profiles on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/index.xml" rel="self" type="application/rss+xml"/><item><title>Span profiles with Traces to profiles for Go</title><link>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/go-span-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/go-span-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;span-profiles-with-traces-to-profiles-for-go&#34;&gt;Span profiles with Traces to profiles for Go&lt;/h1&gt;
&lt;p&gt;Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p&gt;
&lt;p&gt;This shift enables a more granular view of performance, enhancing the utility of profiles by linking them directly with traces for a comprehensive understanding of application behavior. As a result, engineering teams can more efficiently identify and address performance bottlenecks.&lt;/p&gt;
&lt;p&gt;To learn more about Span Profiles, refer to &lt;a href=&#34;/blog/2024/02/06/combining-tracing-and-profiling-for-enhanced-observability-introducing-span-profiles/&#34;&gt;Combining tracing and profiling for enhanced observability: Introducing Span Profiles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/tempo-profiles-Span-link-profile-data-source.png&#34;
  alt=&#34;span-profiles screenshot&#34; width=&#34;1681&#34;
     height=&#34;1102&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Pyroscope can integrate with distributed tracing systems supporting the &lt;a href=&#34;https://opentelemetry.io/docs/instrumentation/go/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;strong&gt;OpenTelemetry&lt;/strong&gt;&lt;/a&gt; standard.
This integration lets you link traces with the profiling data and find resource usage for specific lines of code for your trace spans.&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;ul&gt;
&lt;li&gt;Only CPU profiling is supported.&lt;/li&gt;
&lt;li&gt;Because of how sampling profilers work, spans shorter than the sample interval may not be captured. Go CPU profiler probes stack traces 100 times per second, meaning that spans shorter than 10ms may not be captured.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To use Span Profiles, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../&#34;&gt;Configure Pyroscope to send profiling data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Configure a client-side package to link traces and profiles: &lt;a href=&#34;https://github.com/grafana/otel-profiling-go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Go&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/data-sources/tempo/configure-tempo-data-source/&#34;&gt;Configure the Tempo data source in Grafana or Grafana Cloud to discover linked traces and profiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Your applications must be instrumented for profiling and tracing before you can use span profiles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Profiling: Your application must be instrumented with Pyroscope&amp;rsquo;s Go SDK. If you haven&amp;rsquo;t done this yet, please refer to the &lt;a href=&#34;../../language-sdks/go_push/&#34;&gt;Go (push mode)&lt;/a&gt; guide.&lt;/li&gt;
&lt;li&gt;Tracing: Your application must be instrumented with OpenTelemetry traces. If you haven&amp;rsquo;t done this yet, please refer to the &lt;a href=&#34;https://opentelemetry.io/docs/languages/go/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt; guide.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-the-otel-profiling-go-package&#34;&gt;Configure the &lt;code&gt;otel-profiling-go&lt;/code&gt; package&lt;/h2&gt;
&lt;p&gt;To start collecting Span Profiles for your Go application, you need to include the &lt;a href=&#34;https://github.com/pyroscope-io/otel-profiling-go&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;otel-profiling-go&lt;/code&gt;&lt;/a&gt; package in your code.&lt;/p&gt;
&lt;p&gt;This package is a &lt;code&gt;TracerProvider&lt;/code&gt; implementation that labels profiling data with span IDs. This makes it possible to query for span-specific profiling data with a Tempo data source configured in Grafana or Grafana Cloud.&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;shell&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-shell&#34;&gt;# Make sure you also upgrade pyroscope server to version 0.14.0 or higher.
go get github.com/grafana/otel-profiling-go&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, you need to create and configure the tracer provider:&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;package main

import (
	otelpyroscope &amp;#34;github.com/grafana/otel-profiling-go&amp;#34;
	&amp;#34;github.com/grafana/pyroscope-go&amp;#34;
)

func main() {
	// Initialize your tracer provider as usual.
	tp := initTracer()

	// Wrap it with otelpyroscope tracer provider.
	otel.SetTracerProvider(otelpyroscope.NewTracerProvider(tp))

	// If you&amp;#39;re using Pyroscope Go SDK, initialize pyroscope profiler.
	_, _ = pyroscope.Start(pyroscope.Config{
		ApplicationName: &amp;#34;my-service&amp;#34;,
		ServerAddress:   &amp;#34;http://localhost:4040&amp;#34;,
	})

	// Your code goes here.
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now that you set up the tracer, you can create a new trace from anywhere and the profiler automatically captures profiles for it.&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;ctx, span := otel.Tracer(&amp;#34;tracerName&amp;#34;).Start(ctx, &amp;#34;ExampleSpan&amp;#34;)
defer span.End()

// Your code goes here.&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;view-the-span-profiles-in-grafana-or-grafana-cloud&#34;&gt;View the span profiles in Grafana or Grafana Cloud&lt;/h2&gt;
&lt;p&gt;To view the span profiles in Grafana Tempo, you need to have a Grafana instance with a Tempo data source configured to link trace spans and profiles.
Refer to the configuration documentation for 
    &lt;a href=&#34;/docs/grafana/latest/datasources/tempo/configure-tempo-data-source/&#34;&gt;Grafana&lt;/a&gt; or &lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/data-sources/tempo/configure-tempo-data-source/&#34;&gt;Grafana Cloud&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To learn how to set up Traces to profiles and view the span profiles, refer to &lt;a href=&#34;../../../view-and-analyze-profile-data/traces-to-profiles/&#34;&gt;Traces to profiles&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Check out the &lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/golang-push&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;examples&lt;/a&gt; directory for a complete demo application that shows tracing integration features.&lt;/p&gt;
&lt;!-- ## Using tracing exemplars manually

If you&#39;re not using open telemetry integration you can still use exemplars storage to store profiles associated with some execution context (e.g. individual HTTP / GRPC request). To create exemplars you need to tag specific parts of your code with a special `profile_id` tag, for example, in golang you could do this:
```golang
pprof.Do(ctx, pprof.Labels(&#34;profile_id&#34;, &#34;8474e98b95013e4f&#34;), func(ctx context.Context) {
  slowRequest()
})
```

`&#34;8474e98b95013e4f&#34;` can be any ID that you use to identify execution contexts (individual HTTP / GRPC requests). --&gt;
]]></content><description>&lt;h1 id="span-profiles-with-traces-to-profiles-for-go">Span profiles with Traces to profiles for Go&lt;/h1>
&lt;p>Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p></description></item><item><title>Span profiles with Traces to profiles for Java</title><link>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/java-span-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/java-span-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;span-profiles-with-traces-to-profiles-for-java&#34;&gt;Span profiles with Traces to profiles for Java&lt;/h1&gt;
&lt;p&gt;Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p&gt;
&lt;p&gt;This shift enables a more granular view of performance, enhancing the utility of profiles by linking them directly with traces for a comprehensive understanding of application behavior. As a result, engineering teams can more efficiently identify and address performance bottlenecks.&lt;/p&gt;
&lt;p&gt;To learn more about Span Profiles, refer to &lt;a href=&#34;/blog/2024/02/06/combining-tracing-and-profiling-for-enhanced-observability-introducing-span-profiles/&#34;&gt;Combining tracing and profiling for enhanced observability: Introducing Span Profiles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/tempo-profiles-Span-link-profile-data-source.png&#34;
  alt=&#34;span-profiles screenshot&#34; width=&#34;1681&#34;
     height=&#34;1102&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Pyroscope integrates with distributed tracing systems supporting the &lt;a href=&#34;https://opentelemetry.io/docs/instrumentation/java/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;strong&gt;OpenTelemetry&lt;/strong&gt;&lt;/a&gt; standard.
This integration lets you link traces with the profiling data and find resource usage for specific lines of code for your trace spans.&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;ul&gt;
&lt;li&gt;Only CPU profiling is supported at the moment.&lt;/li&gt;
&lt;li&gt;Because of how sampling profilers work, spans shorter than the sample interval may not be captured.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To use Span Profiles, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../&#34;&gt;Configure Pyroscope to send profiling data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Configure a client-side package to link traces and profiles: &lt;a href=&#34;https://github.com/grafana/otel-profiling-java&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Java&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/data-sources/tempo/configure-tempo-data-source/&#34;&gt;Configure the Tempo data source in Grafana or Grafana Cloud to discover linked traces and profiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Your applications must be instrumented for profiling and tracing before you can use span profiles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Profiling: Your application must be instrumented with Pyroscope&amp;rsquo;s Java client SDK. Refer to the &lt;a href=&#34;../../language-sdks/java/&#34;&gt;Java&lt;/a&gt; guide for instructions.&lt;/li&gt;
&lt;li&gt;Tracing: Your application must be instrumented with OpenTelemetry traces. Refer to the &lt;a href=&#34;https://opentelemetry.io/docs/languages/java/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt; guide for instructions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-the-otel-profiling-java-package&#34;&gt;Configure the otel-profiling-java package&lt;/h2&gt;
&lt;p&gt;To start collecting Span Profiles for your Java application, you need to include &lt;a href=&#34;https://github.com/pyroscope-io/otel-profiling-java&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;otel-profiling-java&lt;/a&gt; as an extension
for the &lt;a href=&#34;https://opentelemetry.io/docs/zero-code/java/agent/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OTel Java agent&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Assuming you have this sample application Docker image:&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;Dockerfile&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-dockerfile&#34;&gt;# [...]

EXPOSE 5000

CMD [&amp;#34;java&amp;#34;, &amp;#34;-Dserver.port=5000&amp;#34;, &amp;#34;-jar&amp;#34;, &amp;#34;./my-app.jar&amp;#34; ]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;By adding the OTel Java agent and the Pyroscope OTel Java Agent extension, you can enrich your profiles with span IDs. This makes it possible to query for span-specific profiling data in Grafana Tempo:&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;Dockerfile&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-dockerfile&#34;&gt;# [...]

EXPOSE 5000

## Add required libararies
ADD https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.17.0/opentelemetry-javaagent.jar opentelemetry-javaagent.jar
ADD https://github.com/grafana/otel-profiling-java/releases/download/v1.0.4/pyroscope-otel.jar pyroscope-otel.jar

ENV PYROSCOPE_APPLICATION_NAME=my-app
ENV PYROSCOPE_FORMAT=jfr
ENV PYROSCOPE_PROFILING_INTERVAL=10ms
ENV PYROSCOPE_PROFILER_EVENT=itimer
ENV PYROSCOPE_PROFILER_LOCK=10ms
ENV PYROSCOPE_PROFILER_ALLOC=512k
ENV PYROSCOPE_UPLOAD_INTERVAL=15s
ENV OTEL_JAVAAGENT_EXTENSIONS=./pyroscope-otel.jar
ENV OTEL_PYROSCOPE_ADD_PROFILE_URL=false
ENV OTEL_PYROSCOPE_ADD_PROFILE_BASELINE_URL=false
ENV OTEL_PYROSCOPE_START_PROFILING=true

## Useful for debugging
# ENV PYROSCOPE_LOG_LEVEL=debug

## Those environment variables need to be overwritten at runtime, if you are using Grafana Cloud
ENV PYROSCOPE_SERVER_ADDRESS=http://localhost:4040
# ENV PYROSCOPE_BASIC_AUTH_USER=123     ## Grafana Cloud Username
# ENV PYROSCOPE_BASIC_AUTH_PASSWORD=glc_secret ## Grafana Cloud Password / API Token

## Add the opentelemetry java agent
CMD [&amp;#34;java&amp;#34;, &amp;#34;-Dserver.port=5000&amp;#34;, &amp;#34;-javaagent:./opentelemetry-javaagent.jar&amp;#34;, &amp;#34;-jar&amp;#34;, &amp;#34;./my-app.jar&amp;#34; ]&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h3 id=&#34;available-configuration-options&#34;&gt;Available configuration options&lt;/h3&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;Flag&lt;/th&gt;
              &lt;th&gt;Description&lt;/th&gt;
              &lt;th&gt;Default&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;otel.pyroscope.start.profiling&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Boolean flag to start PyroscopeAgent. Set to false if you want to start the PyroscopeAgent manually.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;otel.pyroscope.root.span.only&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Boolean flag. When enabled, the tracer will annotate only the first span created locally (the root span), but the profile will include samples of all the nested spans. This may be helpful in case if the trace consists of multiple spans shorter than 10ms and profiler can&amp;rsquo;t collect and annotate samples properly.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;&lt;code&gt;otel.pyroscope.add.span.name&lt;/code&gt;&lt;/td&gt;
              &lt;td&gt;Boolean flag. Controls whether the span name added to profile labels.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;true&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;view-the-span-profiles-in-grafana-tempo&#34;&gt;View the span profiles in Grafana Tempo&lt;/h2&gt;
&lt;p&gt;To view the span profiles in Grafana Tempo, you need to have a Grafana instance running and a data source configured to link trace spans and profiles.&lt;/p&gt;
&lt;p&gt;Refer to the 
    &lt;a href=&#34;/docs/grafana/latest/datasources/tempo/configure-tempo-data-source/&#34;&gt;data source configuration documentation&lt;/a&gt; to see how to configure the visualization to link trace spans with profiles.&lt;/p&gt;
&lt;p&gt;To use a simple configuration, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a Pyroscope data source from the Data source 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;/li&gt;
&lt;/ol&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. You can optionally configure a new name for the tag. This is useful for example if the tag has dots in the name and the target data source doesn&amp;rsquo;t allow using dots in labels. In that case you can for example remap service.name to service_name.&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Select one or more profile types to use in the query. Select the drop-down and choose options from the menu.&lt;/li&gt;
&lt;/ol&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;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/Tempo-data-source-profiles-Settings.png&#34;
  alt=&#34;span-profiles configuration&#34; width=&#34;933&#34;
     height=&#34;261&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Check out the &lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/java&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;examples&lt;/a&gt; directory for a complete demo application that shows tracing integration features.&lt;/p&gt;
]]></content><description>&lt;h1 id="span-profiles-with-traces-to-profiles-for-java">Span profiles with Traces to profiles for Java&lt;/h1>
&lt;p>Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p></description></item><item><title>Span profiles with Traces to profiles for Ruby</title><link>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/ruby-span-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/ruby-span-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;span-profiles-with-traces-to-profiles-for-ruby&#34;&gt;Span profiles with Traces to profiles for Ruby&lt;/h1&gt;
&lt;p&gt;Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p&gt;
&lt;p&gt;This shift enables a more granular view of performance, enhancing the utility of profiles by linking them directly with traces for a comprehensive understanding of application behavior. As a result, engineering teams can more efficiently identify and address performance bottlenecks.&lt;/p&gt;
&lt;p&gt;To learn more about Span Profiles, refer to &lt;a href=&#34;/blog/2024/02/06/combining-tracing-and-profiling-for-enhanced-observability-introducing-span-profiles/&#34;&gt;Combining tracing and profiling for enhanced observability: Introducing Span Profiles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/tempo-profiles-Span-link-profile-data-source.png&#34;
  alt=&#34;span-profiles screenshot&#34; width=&#34;1681&#34;
     height=&#34;1102&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Pyroscope integrates with distributed tracing systems supporting the &lt;a href=&#34;https://opentelemetry.io/docs/instrumentation/ruby/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;strong&gt;OpenTelemetry&lt;/strong&gt;&lt;/a&gt; standard.
This integration lets you link traces with the profiling data and find resource usage for specific lines of code for your trace spans.&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;ul&gt;
&lt;li&gt;Only CPU profiling is supported at the moment.&lt;/li&gt;
&lt;li&gt;Because of how sampling profilers work, spans shorter than the sample interval may not be captured.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To use Span Profiles, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../&#34;&gt;Configure Pyroscope to send profiling data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Configure a client-side package to link traces and profiles: &lt;a href=&#34;https://github.com/grafana/otel-profiling-ruby&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Ruby&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/data-sources/tempo/configure-tempo-data-source/&#34;&gt;Configure the Tempo data source in Grafana or Grafana Cloud to discover linked traces and profiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Your applications must be instrumented for profiling and tracing before you can use span profiles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Profiling: Your application must be instrumented with Pyroscope&amp;rsquo;s Ruby SDK. Refer to the &lt;a href=&#34;../../language-sdks/ruby/&#34;&gt;Ruby&lt;/a&gt; guide for instructions.&lt;/li&gt;
&lt;li&gt;Tracing: Your application must be instrumented with OpenTelemetry traces. Refer to the &lt;a href=&#34;https://opentelemetry.io/docs/languages/ruby/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt; guide for instructions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-the-otel-profiling-ruby-package&#34;&gt;Configure the otel-profiling-ruby package&lt;/h2&gt;
&lt;p&gt;To start collecting Span Profiles for your Ruby application, you need to include &lt;a href=&#34;https://github.com/pyroscope-io/otel-profiling-ruby&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;otel-profiling-ruby&lt;/a&gt; in your code.&lt;/p&gt;
&lt;p&gt;This package is a &lt;code&gt;TracerProvider&lt;/code&gt; implementation, that labels profiling data with span IDs which makes it possible to query for span-specific profiling data in Grafana Tempo UI.&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;shell&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-shell&#34;&gt;# Add to your Gemfile
gem install pyroscope-otel&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, you need to create and configure the tracer provider:&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;ruby&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-ruby&#34;&gt;Pyroscope.configure do |config|
  # Configure pyroscope as described https://pyroscope.io/docs/ruby/
end

OpenTelemetry::SDK.configure do |config|
  config.add_span_processor Pyroscope::Otel::SpanProcessor.new(
    &amp;#34;#{app_name}.cpu&amp;#34;, # your app name with &amp;#34;.cpu&amp;#34; suffix, for example rideshare-ruby.cpu
    pyroscope_endpoint # link to your pyroscope server, for example &amp;#34;http://localhost:4040&amp;#34;
  )
  # Configure the rest of opentelemetry as described  https://github.com/open-telemetry/opentelemetry-ruby
end&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;view-the-span-profiles-in-grafana-tempo&#34;&gt;View the span profiles in Grafana Tempo&lt;/h2&gt;
&lt;p&gt;To view the span profiles in Grafana Tempo, you need to have a Grafana instance running and a data source configured to link trace spans and profiles.&lt;/p&gt;
&lt;p&gt;Refer to the 
    &lt;a href=&#34;/docs/grafana/latest/datasources/tempo/configure-tempo-data-source/&#34;&gt;data source configuration documentation&lt;/a&gt; to see how to configure the visualization to link trace spans with profiles.&lt;/p&gt;
&lt;p&gt;To use a simple configuration, follow these steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Select a Pyroscope data source from the Data source 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;/li&gt;
&lt;/ol&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. You can optionally configure a new name for the tag. This is useful for example if the tag has dots in the name and the target data source doesn&amp;rsquo;t allow using dots in labels. In that case you can for example remap service.name to service_name.&lt;/p&gt;
&lt;ol start=&#34;3&#34;&gt;
&lt;li&gt;Select one or more profile types to use in the query. Select the drop-down and choose options from the menu.&lt;/li&gt;
&lt;/ol&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;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/Tempo-data-source-profiles-Settings.png&#34;
  alt=&#34;span-profiles configuration&#34; width=&#34;933&#34;
     height=&#34;261&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Check out the &lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/tempo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;examples&lt;/a&gt; directory for a complete demo application that shows tracing integration features.&lt;/p&gt;
&lt;h2 id=&#34;examples-1&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Check out these demo applications for span profiles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/ruby&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Ruby example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/tempo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Other examples&lt;/a&gt; in multiple languages&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="span-profiles-with-traces-to-profiles-for-ruby">Span profiles with Traces to profiles for Ruby&lt;/h1>
&lt;p>Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p></description></item><item><title>Span profiles with Traces to profiles for .NET</title><link>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/dotnet-span-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/dotnet-span-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;span-profiles-with-traces-to-profiles-for-net&#34;&gt;Span profiles with Traces to profiles for .NET&lt;/h1&gt;
&lt;p&gt;Span Profiles represent a shift in profiling methodology.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p&gt;
&lt;p&gt;To learn more about Span Profiles, refer to &lt;a href=&#34;/blog/2024/02/06/combining-tracing-and-profiling-for-enhanced-observability-introducing-span-profiles/&#34;&gt;Combining tracing and profiling for enhanced observability: Introducing Span Profiles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/tempo-profiles-Span-link-profile-data-source.png&#34;
  alt=&#34;span-profiles screenshot&#34; width=&#34;1681&#34;
     height=&#34;1102&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;supported-profile-types&#34;&gt;Supported profile types&lt;/h2&gt;
&lt;p&gt;Pyroscope integrates with distributed tracing systems supporting the &lt;a href=&#34;https://opentelemetry.io/docs/languages/net/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;strong&gt;OpenTelemetry&lt;/strong&gt;&lt;/a&gt; standard.
This integration lets you link traces with the profiling data and find resource usage for specific lines of code for your trace spans.&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;ul&gt;
&lt;li&gt;Only CPU profiling is supported at the moment.&lt;/li&gt;
&lt;li&gt;Because of how sampling profilers work, spans shorter than the sample interval may not be captured.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;For a more detailed list of supported profile types, refer to &lt;a href=&#34;/docs/pyroscope/%3cPYROSCOPE_VERSION/configure-client/profile-types/%3e/&#34;&gt;Profile types&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;To use Span Profiles, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/pyroscope/v1.18.x/configure-client/&#34;&gt;Configure Pyroscope to send profiling data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Configure a client-side package to link traces and profiles: &lt;a href=&#34;https://github.com/grafana/pyroscope-dotnet/tree/main/Pyroscope/Pyroscope.OpenTelemetry&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;.NET&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/data-sources/tempo/configure-tempo-data-source/&#34;&gt;Configure the Tempo data source in Grafana or Grafana Cloud to discover linked traces and profiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;instrument-your-application-for-profiles&#34;&gt;Instrument your application for profiles&lt;/h3&gt;
&lt;p&gt;Your applications must be instrumented for profiling and tracing before you can use span profiles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Profiling: Your application must be instrumented with Pyroscope&amp;rsquo;s .NET instrumentation library. Refer to the &lt;a href=&#34;../../language-sdks/dotnet/&#34;&gt;.NET&lt;/a&gt; guide for instructions.&lt;/li&gt;
&lt;li&gt;Tracing: Your application must be instrumented with OpenTelemetry traces. Refer to the &lt;a href=&#34;https://opentelemetry.io/docs/languages/net/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt; guide for instructions.&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;Span profiles in .NET are only supported using &lt;a href=&#34;https://opentelemetry.io/docs/languages/net/instrumentation/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry manual instrumentation&lt;/a&gt;
because Pyroscope&amp;rsquo;s .NET profiler and OpenTelemetry&amp;rsquo;s auto instrumentation are based on separate .NET CLR profilers.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;configure-the-pyroscopeopentelemetry-package&#34;&gt;Configure the &lt;code&gt;Pyroscope.OpenTelemetry&lt;/code&gt; package&lt;/h2&gt;
&lt;p&gt;To start collecting Span Profiles for your .NET application, you need to include &lt;a href=&#34;https://github.com/grafana/pyroscope-dotnet/tree/main/Pyroscope/Pyroscope.OpenTelemetry&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Pyroscope.OpenTelemetry&lt;/a&gt; in your code.&lt;/p&gt;
&lt;p&gt;This package provides a &lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry/BaseProcessor.cs&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;SpanProcessor&lt;/code&gt;&lt;/a&gt; implementation, which connects the two telemetry signals (traces and profiles) together.&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;shell&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-shell&#34;&gt;dotnet add package Pyroscope.OpenTelemetry&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, create and register the &lt;code&gt;PyroscopeSpanProcessor&lt;/code&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;csharp&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-csharp&#34;&gt;builder.Services.AddOpenTelemetry()
    .WithTracing(b =&amp;gt;
    {
        b
        .AddAspNetCoreInstrumentation()
        .AddConsoleExporter()
        .AddOtlpExporter()
        .AddProcessor(new Pyroscope.OpenTelemetry.PyroscopeSpanProcessor());
    });&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With the span processor registered, spans created automatically (for example, HTTP handlers) and manually (&lt;code&gt;ActivitySource.StartActivity()&lt;/code&gt;) have profiling data associated with them.&lt;/p&gt;
&lt;h2 id=&#34;view-the-span-profiles-in-grafana&#34;&gt;View the span profiles in Grafana&lt;/h2&gt;
&lt;p&gt;To view the span profiles in Grafana Explore or Grafana Traces Drilldown, you need to have a Grafana instance running and a Tempo data source configured to link traces and profiles.&lt;/p&gt;
&lt;p&gt;Refer to the 
    &lt;a href=&#34;/docs/grafana/latest/datasources/tempo/configure-tempo-data-source/&#34;&gt;Tempo data source configuration documentation&lt;/a&gt; to see how to configure the visualization to link traces with profiles.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Check out these demo applications for span profiles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/dotnet&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;.NET example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/tempo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Other examples&lt;/a&gt; in multiple languages&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="span-profiles-with-traces-to-profiles-for-net">Span profiles with Traces to profiles for .NET&lt;/h1>
&lt;p>Span Profiles represent a shift in profiling methodology.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p></description></item><item><title>Span profiles with Traces to profiles for Python</title><link>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/python-span-profiles/</link><pubDate>Wed, 08 Apr 2026 14:38:28 +0000</pubDate><guid>https://grafana.com/docs/pyroscope/v1.18.x/configure-client/trace-span-profiles/python-span-profiles/</guid><content><![CDATA[&lt;h1 id=&#34;span-profiles-with-traces-to-profiles-for-python&#34;&gt;Span profiles with Traces to profiles for Python&lt;/h1&gt;
&lt;p&gt;Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p&gt;
&lt;p&gt;This shift enables a more granular view of performance, enhancing the utility of profiles by linking them directly with traces for a comprehensive understanding of application behavior. As a result, engineering teams can more efficiently identify and address performance bottlenecks.&lt;/p&gt;
&lt;p&gt;To learn more about Span Profiles, refer to &lt;a href=&#34;/blog/2024/02/06/combining-tracing-and-profiling-for-enhanced-observability-introducing-span-profiles/&#34;&gt;Combining tracing and profiling for enhanced observability: Introducing Span Profiles&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;https://grafana.com/static/img/docs/tempo/profiles/tempo-profiles-Span-link-profile-data-source.png&#34;
  alt=&#34;span-profiles screenshot&#34; width=&#34;1681&#34;
     height=&#34;1102&#34;/&gt;&lt;/p&gt;
&lt;p&gt;Pyroscope integrates with distributed tracing systems supporting the &lt;a href=&#34;https://opentelemetry.io/docs/languages/python/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;strong&gt;OpenTelemetry&lt;/strong&gt;&lt;/a&gt; standard.
This integration lets you link traces with the profiling data and find resource usage for specific lines of code for your trace spans.&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;ul&gt;
&lt;li&gt;Only CPU profiling is supported at the moment.&lt;/li&gt;
&lt;li&gt;Because of how sampling profilers work, spans shorter than the sample interval may not be captured.&lt;/li&gt;
&lt;/ul&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;To use Span Profiles, you need to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;../../&#34;&gt;Configure Pyroscope to send profiling data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Configure a client-side package to link traces and profiles: &lt;a href=&#34;https://github.com/grafana/otel-profiling-python&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Python&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;/docs/grafana-cloud/connect-externally-hosted/data-sources/tempo/configure-tempo-data-source/&#34;&gt;Configure the Tempo data source in Grafana or Grafana Cloud to discover linked traces and profiles&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;Your applications must be instrumented for profiling and tracing before you can use span profiles.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Profiling: Your application must be instrumented with Pyroscope&amp;rsquo;s Python instrumentation library. Refer to the &lt;a href=&#34;../../language-sdks/python/&#34;&gt;Python&lt;/a&gt; guide for instructions.&lt;/li&gt;
&lt;li&gt;Tracing: Your application must be instrumented with OpenTelemetry traces. Refer to the &lt;a href=&#34;https://opentelemetry.io/docs/languages/python/getting-started/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;OpenTelemetry&lt;/a&gt; guide for isntructions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;configure-the-pyroscope-otel-package&#34;&gt;Configure the &lt;code&gt;pyroscope-otel&lt;/code&gt; package&lt;/h2&gt;
&lt;p&gt;To start collecting Span Profiles for your Python application, you need to include &lt;a href=&#34;https://github.com/grafana/otel-profiling-python&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;pyroscope-otel&lt;/a&gt; in your code.&lt;/p&gt;
&lt;p&gt;This package provides a &lt;a href=&#34;https://github.com/open-telemetry/opentelemetry-python/blob/d213e02941039d4383abc3608b75404ce84725b1/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py#L85&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;&lt;code&gt;SpanProcessor&lt;/code&gt;&lt;/a&gt; implementation, which connects the two telemetry signals (traces and profiles) together.&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;shell&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-shell&#34;&gt;pip install pyroscope-otel&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Next, create and register the &lt;code&gt;PyroscopeSpanProcessor&lt;/code&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;# import span processor
from pyroscope.otel import PyroscopeSpanProcessor

# obtain a OpenTelemetry tracer provider
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
provider = TracerProvider()

# register the span processor
provider.add_span_processor(PyroscopeSpanProcessor())

# register the tracer provider
trace.set_tracer_provider(provider)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;With the span processor registered, spans created automatically (for example, HTTP handlers) and manually will have profiling data associated with them.&lt;/p&gt;
&lt;h2 id=&#34;view-the-span-profiles-in-grafana-tempo&#34;&gt;View the span profiles in Grafana Tempo&lt;/h2&gt;
&lt;p&gt;To view the span profiles in Grafana Tempo, you need to have a Grafana instance running and a data source configured to link traces and profiles.&lt;/p&gt;
&lt;p&gt;Refer to the 
    &lt;a href=&#34;/docs/grafana/latest/datasources/tempo/configure-tempo-data-source/&#34;&gt;data source configuration documentation&lt;/a&gt; to see how to configure the visualization to link traces with profiles.&lt;/p&gt;
&lt;h2 id=&#34;examples&#34;&gt;Examples&lt;/h2&gt;
&lt;p&gt;Check out these demo applications for span profiles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/python&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Python example&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/grafana/pyroscope/tree/main/examples/tracing/tempo&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Other examples&lt;/a&gt; in multiple languages&lt;/li&gt;
&lt;/ul&gt;
]]></content><description>&lt;h1 id="span-profiles-with-traces-to-profiles-for-python">Span profiles with Traces to profiles for Python&lt;/h1>
&lt;p>Span Profiles represent a major shift in profiling methodology, enabling deeper analysis of both tracing and profiling data.
Traditional continuous profiling provides an application-wide view over fixed intervals.
In contrast, Span Profiles delivers focused, dynamic analysis on specific execution scopes within applications, such as individual requests or specific trace spans.&lt;/p></description></item></channel></rss>