<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Service graphs on Grafana Labs</title><link>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/</link><description>Recent content in Service graphs on Grafana Labs</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/index.xml" rel="self" type="application/rss+xml"/><item><title>Enable service graphs</title><link>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/enable-service-graphs/</link><pubDate>Fri, 03 Apr 2026 16:45:36 +0000</pubDate><guid>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/enable-service-graphs/</guid><content><![CDATA[&lt;h1 id=&#34;enable-service-graphs&#34;&gt;Enable service graphs&lt;/h1&gt;
&lt;p&gt;You can enable service graphs in Tempo by using the metrics-generator or by configuring service graphs in Grafana Alloy.&lt;/p&gt;
&lt;p&gt;Using the metrics-generator to generate service graphs is more efficient and recommended for larger installations.&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;Cardinality can pose a problem when you have lots of services.
To learn more about cardinality and how to perform a dry run of the metrics-generator, refer to the 
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/metrics-generator/cardinality/&#34;&gt;Cardinality documentation&lt;/a&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;h2 id=&#34;enable-service-graphs-with-metrics-generator&#34;&gt;Enable service graphs with metrics-generator&lt;/h2&gt;
&lt;p&gt;Service graphs are generated in Tempo and pushed to a metrics storage.
Then, they can be represented in Grafana as a graph.
You need those components to fully use service graphs.&lt;/p&gt;
&lt;h3 id=&#34;enable-service-graphs-in-tempo&#34;&gt;Enable service graphs in Tempo&lt;/h3&gt;
&lt;p&gt;To enable service graphs in Tempo, enable the metrics-generator and add an overrides section which enables the &lt;code&gt;service-graphs&lt;/code&gt; generator.
For more information, refer to the 
    &lt;a href=&#34;/docs/tempo/v2.9.x/configuration/#metrics-generator&#34;&gt;configuration details&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;To enable service graphs when using Grafana Alloy, refer to the &lt;a href=&#34;#enable-service-graphs-using-alloy&#34;&gt;Grafana Alloy and service graphs section&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;enable-service-graphs-in-grafana&#34;&gt;Enable service graphs in Grafana&lt;/h3&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;Service graphs are enabled by default in Grafana. Prior to Grafana 9.0.4, service graphs were hidden
under the 
    &lt;a href=&#34;/docs/grafana/next/setup-grafana/configure-grafana/&#34;&gt;feature toggle&lt;/a&gt; &lt;code&gt;tempoServiceGraph&lt;/code&gt;.&lt;/p&gt;&lt;/blockquote&gt;&lt;/div&gt;

&lt;p&gt;Configure a Tempo data source&amp;rsquo;s service graphs by linking to the Prometheus backend where metrics are being sent:&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;apiVersion: 1
datasources:
  # Prometheus backend where metrics are sent
  - name: Prometheus
    type: prometheus
    uid: prometheus
    url: &amp;lt;prometheus-url&amp;gt;
    jsonData:
      httpMethod: GET
    version: 1
  - name: Tempo
    type: tempo
    uid: tempo
    url: &amp;lt;tempo-url&amp;gt;
    jsonData:
      httpMethod: GET
      serviceMap:
        datasourceUid: &amp;#39;prometheus&amp;#39;
    version: 1&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;enable-service-graphs-using-alloy&#34;&gt;Enable service graphs using Alloy&lt;/h2&gt;
&lt;p&gt;A service graph is a visual representation of the interrelationships between various services.
Service graphs help to understand the structure of a distributed system,
and the connections and dependencies between its components.&lt;/p&gt;
&lt;p&gt;The same service graph metrics can also be generated by Tempo.
This is more efficient and recommended for larger installations.
For a deep look into service graphs, visit 
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/&#34;&gt;this section&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Service graphs are also used in the application performance management dashboard.
For more information, refer to the 
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/service-graph-view/&#34;&gt;service graph view documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h3&gt;
&lt;p&gt;Service graphs are generated in Grafana Alloy and pushed to a Prometheus-compatible backend.
Once generated, they can be represented in Grafana as a graph.
You need these components to fully use service graphs.&lt;/p&gt;
&lt;h3 id=&#34;steps&#34;&gt;Steps&lt;/h3&gt;
&lt;p&gt;To start using service graphs, enable the feature in the Alloy configuration.&lt;/p&gt;
&lt;p&gt;The following example adds the &lt;code&gt;http.method&lt;/code&gt; and &lt;code&gt;http.target&lt;/code&gt; span attributes as Prometheus labels
to the generated service graph metrics, before writing the metrics to the Grafana OTLP gateway.
Received trace spans are immediately written to the OTLP gateway.&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;Alloy&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-alloy&#34;&gt;otelcol.receiver.otlp &amp;#34;default&amp;#34; {
  grpc {}
  http {}

  output {
    traces = [
      otelcol.connector.servicegraph.default.input,
      otelcol.exporter.otlp.default.input,
    ]
  }
}

otelcol.connector.servicegraph &amp;#34;default&amp;#34; {
  dimensions = [&amp;#34;http.method&amp;#34;, &amp;#34;http.target&amp;#34;]
  output {
    metrics = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp &amp;#34;default&amp;#34; {
  client {
    endpoint = env(&amp;#34;OTLP_ENDPOINT&amp;#34;)
  }
}&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;To see all the available configuration options, refer to the 
    &lt;a href=&#34;/docs/alloy/v2.9.x/reference/components/otelcol/otelcol.connector.servicegraph/&#34;&gt;component reference&lt;/a&gt;.&lt;/p&gt;
]]></content><description>&lt;h1 id="enable-service-graphs">Enable service graphs&lt;/h1>
&lt;p>You can enable service graphs in Tempo by using the metrics-generator or by configuring service graphs in Grafana Alloy.&lt;/p>
&lt;p>Using the metrics-generator to generate service graphs is more efficient and recommended for larger installations.&lt;/p></description></item><item><title>Create custom service graphs</title><link>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/custom-service-graphs/</link><pubDate>Fri, 03 Apr 2026 16:45:36 +0000</pubDate><guid>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/custom-service-graphs/</guid><content><![CDATA[&lt;h1 id=&#34;create-custom-service-graphs&#34;&gt;Create custom service graphs&lt;/h1&gt;
&lt;p&gt;You can craft custom service graphs based on the metrics generated from metrics-generator.&lt;/p&gt;
&lt;h2 id=&#34;before-you-begin&#34;&gt;Before you begin&lt;/h2&gt;
&lt;p&gt;For custom service graphs, you&amp;rsquo;ll use:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tempo metrics-generator&lt;/li&gt;
&lt;li&gt;Grafana deployment of version v10 or higher&lt;/li&gt;
&lt;li&gt;Grafana &lt;a href=&#34;/docs/grafana/latest/panels-visualizations/visualizations/node-graph/&#34;&gt;Node graph panel&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The metrics-generator creates multiple metrics, including &lt;code&gt;traces_service_graph_request_total&lt;/code&gt;. This metric holds:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;relationships between services&lt;/li&gt;
&lt;li&gt;total number of requests performed between services&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;create-one-or-more-grafana-dashboards&#34;&gt;Create one or more Grafana dashboards&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;In Grafana, &lt;a href=&#34;/docs/grafana/latest/dashboards/build-dashboards/create-dashboard/&#34;&gt;create a new dashboard&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Add two variables:
&lt;ul&gt;
&lt;li&gt;Data source of type &lt;code&gt;Prometheus&lt;/code&gt;.
&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/tempo/metrics/custom-service-graph-var-datasource.png&#34;
  alt=&#34;Custom service graph Grafana data source variable&#34; width=&#34;544&#34;
     height=&#34;770&#34;/&gt;&lt;/li&gt;
&lt;li&gt;Service of type &lt;code&gt;Label values&lt;/code&gt;, enable multi-value option
&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/tempo/metrics/custom-service-graph-var-service.png&#34;
  alt=&#34;Custom service graph service variable&#34; width=&#34;640&#34;
     height=&#34;815&#34;/&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&#34;add-a-panel&#34;&gt;Add a panel&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Create a panel with a single query called &lt;code&gt;edges&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Select your Prometheus data source with metrics from the metrics-generator.&lt;/li&gt;
&lt;li&gt;Query using the following example:

&lt;div class=&#34;code-snippet code-snippet__mini&#34;&gt;&lt;div class=&#34;lang-toolbar__mini&#34;&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&gt;&lt;div class=&#34;code-snippet code-snippet__border&#34;&gt;
    &lt;pre data-expanded=&#34;false&#34;&gt;&lt;code class=&#34;language-none&#34;&gt;label_join(
  label_join(
    label_join(
      sum(increase(traces_service_graph_request_total{server=~&amp;#34;$service&amp;#34;}[5m])) by (server, client) &amp;gt; 0
      or
      sum(increase(traces_service_graph_request_total{client=~&amp;#34;$service&amp;#34;}[5m])) by (server, client) &amp;gt; 0,
    &amp;#34;source&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;client&amp;#34;),
  &amp;#34;target&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;server&amp;#34;),
&amp;#34;id&amp;#34;, &amp;#34;-&amp;#34;, &amp;#34;server&amp;#34;, &amp;#34;client&amp;#34;)&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Use Instant query type.&lt;/li&gt;
&lt;li&gt;If you encounter issues, switch to the Table data visualization. Refer to the &lt;a href=&#34;/docs/grafana/latest/panels-visualizations/visualizations/node-graph/&#34;&gt;Node graph panel&lt;/a&gt; documentation for more options and expected data shape.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/tempo/metrics/custom-service-graph-var-service.png&#34;
  alt=&#34;Custom service graph panel view&#34; width=&#34;640&#34;
     height=&#34;815&#34;/&gt;&lt;/p&gt;
&lt;p&gt;All data transformations are done with the Prometheus &lt;code&gt;label_join&lt;/code&gt; operators.&lt;/p&gt;
&lt;p&gt;Explanation of the query:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The first &lt;code&gt;label_join&lt;/code&gt; creates a new field &lt;code&gt;id&lt;/code&gt; which is required by the Node graph panel.&lt;/li&gt;
&lt;li&gt;The second and third &lt;code&gt;label_join&lt;/code&gt; copy the client and server labels to source and target respectively, as these names are also required by Node graph panel.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;traces_service_graph_request_total&lt;/code&gt; is queried twice with the &lt;code&gt;OR&lt;/code&gt; operator to get a combination of requests from and to all of the selected services.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This query gets most of the job done. However, it&amp;rsquo;s limitations can&amp;rsquo;t be compensated for even using the Grafana transform data feature.
These limitations include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unable to add request stats to nodes and edges, such as req/sec and error rates&lt;/li&gt;
&lt;li&gt;Unable to add custom icons for nodes&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These limitations can be overcome by wrapping the Prometheus query into a REST API, which provides more flexibility with query results data transformations.
You can use &lt;a href=&#34;/grafana/plugins/yesoreyeram-infinity-datasource/&#34;&gt;Grafana Infinity data source&lt;/a&gt; to visualize data from REST API.&lt;/p&gt;
]]></content><description>&lt;h1 id="create-custom-service-graphs">Create custom service graphs&lt;/h1>
&lt;p>You can craft custom service graphs based on the metrics generated from metrics-generator.&lt;/p>
&lt;h2 id="before-you-begin">Before you begin&lt;/h2>
&lt;p>For custom service graphs, you&amp;rsquo;ll use:&lt;/p></description></item><item><title>Service graph view</title><link>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/service-graph-view/</link><pubDate>Fri, 03 Apr 2026 16:45:36 +0000</pubDate><guid>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/service-graph-view/</guid><content><![CDATA[&lt;h1 id=&#34;service-graph-view&#34;&gt;Service graph view&lt;/h1&gt;
&lt;p&gt;Grafana&amp;rsquo;s service graph view uses metrics generated by the metrics-generator or Grafana Alloy to display span request rates, error rates, and durations, as well as service graphs.
Once the requirements are set up, this pre-configured view is immediately available.&lt;/p&gt;
&lt;p&gt;Using the service graph view, you can:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Discover spans which are consistently erroring and the rates at which they occur&lt;/li&gt;
&lt;li&gt;Get an overview of the overall rate of span calls throughout your services&lt;/li&gt;
&lt;li&gt;Determine how long the slowest queries in your service take to complete&lt;/li&gt;
&lt;li&gt;Examine all traces that contain spans of particular interest based on rate, error, and duration values (RED signals)&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/query-editor/tempo-ds-query-service-graph.png&#34;
  alt=&#34;Service graph view&#34; width=&#34;1290&#34;
     height=&#34;1145&#34;/&gt;&lt;/p&gt;
&lt;h2 id=&#34;requirements&#34;&gt;Requirements&lt;/h2&gt;
&lt;p&gt;You have to enable span metrics and service graph generation on the Grafana backend so metrics that are generated as traces are ingested.&lt;/p&gt;
&lt;p&gt;To use the service graph view, you need:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tempo or Grafana Cloud Traces with either the metrics generator enabled and configured or Grafana Alloy enabled and configured to send data to a Prometheus-compatible metrics store&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/enable-service-graphs/&#34;&gt;Services graphs&lt;/a&gt;, which are enabled by default in Grafana&lt;/li&gt;
&lt;li&gt;
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/span-metrics/&#34;&gt;Span metrics&lt;/a&gt; enabled in your Tempo data source configuration&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The service graph view can be derived from metrics generated by either the metrics-generator or Grafana Alloy.&lt;/p&gt;
&lt;p&gt;For information on how to configure these features, refer to the 
    &lt;a href=&#34;/docs/grafana/next/datasources/tempo/&#34;&gt;Tempo data sources documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;what-does-the-service-graph-view-show&#34;&gt;What does the service graph view show?&lt;/h2&gt;
&lt;p&gt;Using this view, you can see the top five spans with a type of server (listed in the &lt;code&gt;Name&lt;/code&gt; column).
You can refine any of this data using the filters.
Selecting any of the data points lets you see more specific data.&lt;/p&gt;
&lt;p&gt;The service graph view provides a span metrics visualization (table) and service graph (node map). In addition, you can use the filters to customize the data displayed.&lt;/p&gt;
&lt;p&gt;You can select any information in the table that has an underline to show more detailed information.
You can also select any node in the service graph to display additional information.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/grafana/data-sources/tempo/query-editor/tempo-ds-query-service-graph.png&#34;
  alt=&#34;Service graph with extended information&#34; width=&#34;1290&#34;
     height=&#34;1145&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;error-rate-example&#34;&gt;Error rate example&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s say you want to learn more about why &lt;code&gt;cortex.Ingester&lt;/code&gt; has the highest error rates.
Selecting the second row of the Error rate column displays details about the span metrics in a new window on the right side.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;/media/docs/tempo/metrics/apm-error-rate-example.png&#34; alt=&#34;Error rate example&#34;&gt;&lt;/p&gt;
&lt;p&gt;The metrics query used to generate the data appears in the &lt;strong&gt;Metrics browser&lt;/strong&gt; field.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;/media/docs/tempo/metrics/apm-error-example-editor.png&#34; alt=&#34;Error example query editor&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;span-metrics-table&#34;&gt;Span metrics table&lt;/h2&gt;
&lt;p&gt;The span metrics, shown in the table, are generated by the metrics-generator or Grafana Alloy.
These metrics are created from ingested tracing data, including RED metrics.&lt;/p&gt;
&lt;p&gt;Span metrics generate two metrics:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A counter that computes requests&lt;/li&gt;
&lt;li&gt;A histogram that tracks the distribution of durations of all requests&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For information about span metrics and how they are calculated, refer to the 
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/span-metrics/&#34;&gt;Span metrics documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&#34;table-contents&#34;&gt;Table contents&lt;/h3&gt;
&lt;p&gt;The span metrics table contains seven columns with five column headings. Selecting a heading sorts the data by ascending or descending values.&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;&lt;strong&gt;Column&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;Explanation&lt;/strong&gt;&lt;/th&gt;
              &lt;th&gt;&lt;strong&gt;PromQL query for span&lt;/strong&gt;&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
          &lt;tr&gt;
              &lt;td&gt;Name&lt;/td&gt;
              &lt;td&gt;Use the span name. OTel semantic conventions generally expect the span name to be some kind of low cardinality indicator of the http route or database function being performed.&lt;/td&gt;
              &lt;td&gt;N/A&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Rate&lt;/td&gt;
              &lt;td&gt;LCD gauge (horizontal bar graph). Instances per second of the span. Clicking this field can jump to the appropriate metrics.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sum(rate( traces_spanmetrics_calls_total{ span_name=&amp;quot;&amp;quot;, &amp;lt;filters&amp;gt; }[$__range]))&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Error Rate&lt;/td&gt;
              &lt;td&gt;Number and LCD gauge (horizontal bar graph). Clicking this field shows more detailed metrics.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;sum(rate( traces_spanmetrics_calls_total{ span_name=&amp;quot;&amp;quot;, span_status=&amp;quot;STATUS_CODE_ERROR&amp;quot;, &amp;lt;filters&amp;gt; }[$__range]))&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Duration&lt;/td&gt;
              &lt;td&gt;p90 duration: 90% of all occurrences of this span complete within this time. Clicking this field shows the appropriate metrics.&lt;/td&gt;
              &lt;td&gt;&lt;code&gt;histogram_quantile(.9, sum(rate( traces_spanmetrics_duration_seconds_bucket{ span_name=&amp;quot;&amp;quot;, span_status=&amp;quot;STATUS_CODE_ERROR&amp;quot;, &amp;lt;filters&amp;gt; }[$__range]) by (le))&lt;/code&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
              &lt;td&gt;Links&lt;/td&gt;
              &lt;td&gt;Provide links to example traces given the span name and other applied filters. Link to a search for all spans with the same name from the same Tempo data source.&lt;/td&gt;
              &lt;td&gt;N/A&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
    &lt;/table&gt;
  &lt;/div&gt;
&lt;/section&gt;&lt;h2 id=&#34;service-graphs&#34;&gt;Service graphs&lt;/h2&gt;
&lt;p&gt;A service graph (node graph) is a visual representation of the interrelationships between various services.
Service graphs help to understand the structure of a distributed system, and the connections and dependencies between its components.&lt;/p&gt;
&lt;p&gt;Service graphs infer the topology of a distributed system, provide a high level overview of the health of your system, and a historic view of a system’s topology.
Service graphs show error rates and latencies, among other relevant data.
The service graph layout can be the default or grid.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/grafana/data-sources/tempo/query-editor/tempo-ds-query-node-graph.png&#34;
  alt=&#34;Node graph view&#34; width=&#34;1333&#34;
     height=&#34;715&#34;/&gt;&lt;/p&gt;
&lt;p&gt;If you are using the metrics-generator, then it processes traces and generates service graphs in the form of time series metrics like:&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;traces_service_graph_request_total{client=&amp;#34;app&amp;#34;, server=&amp;#34;db&amp;#34;} 20&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;For information about service graphs and how they are calculated, refer to the 
    &lt;a href=&#34;/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/&#34;&gt;Service Graphs documentation&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&#34;use-filters-to-reveal-details&#34;&gt;Use filters to reveal details&lt;/h2&gt;
&lt;p&gt;The service graph view uses service graphs and span metrics to provide a gateway to your tracing information.
This dashboard is derived from a fixed set of metrics queries.
These underlying queries can not be changed.
However, you can choose which traces are included in the metrics query by filtering.&lt;/p&gt;
&lt;p&gt;You can explore data by clicking on selectable items or by using filters.&lt;/p&gt;
&lt;h3 id=&#34;select-items-or-nodes-for-more-detail&#34;&gt;Select items or nodes for more detail&lt;/h3&gt;
&lt;p&gt;Clicking on selectable items, such as underlined text in the table or nodes on the service graph, lets you reveal specific details based upon your selection.&lt;/p&gt;
&lt;p&gt;In the table, you can select items in the &lt;strong&gt;Rate&lt;/strong&gt;, &lt;strong&gt;Error Rate&lt;/strong&gt;, &lt;strong&gt;Duration (p90)&lt;/strong&gt;, and &lt;strong&gt;Links&lt;/strong&gt; columns. Choosing one of these items provides details about the span metrics.&lt;/p&gt;
&lt;p&gt;You can view request rate, request histogram, failed request rate, and traces for any node in the service graph.
To view more information, select the node in the service graph and then choose an option from the popup.
For details on navigating the service graph, refer to the &lt;a href=&#34;/docs/grafana/latest/visualizations/node-graph/&#34;&gt;Node graph panel&lt;/a&gt; documentation.&lt;/p&gt;
&lt;h3 id=&#34;filter-with-metric-queries&#34;&gt;Filter with metric queries&lt;/h3&gt;
&lt;p&gt;Using the filters at the top of the screen, you can narrow the data set based upon span attributes (key-value pairs or labels).
The filters build a query to refine what is shown in the service graph and span metrics.
You can add one or more label filters.&lt;/p&gt;
&lt;p&gt;To use the filters:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;At the top of the Service Graph, select the text box after &lt;strong&gt;Filter&lt;/strong&gt; to display a list of available labels.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select or search for a value for the label. In this case, the value of &lt;strong&gt;server&lt;/strong&gt; is equal to &lt;strong&gt;tempo-ingester&lt;/strong&gt;. The default operator is equals (=).&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Change the operator by selecting &lt;strong&gt;=&lt;/strong&gt; and choosing a new option from the drop-down.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Optional: Add additional key-value pairs to refine the data set. Any subsequent label filters use AND, which requires both key-value pairs to be presents for matches.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Select &lt;strong&gt;Run query&lt;/strong&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Filters can be removed by selecting the filter drop-down and choosing &lt;strong&gt;– remove filter –&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Each field or label represents a key-value pair. Number 1 selects a service as the label whose value is &lt;code&gt;Go-http-client&lt;/code&gt; (2). The second key-value pair has a client as a label whose value is &lt;code&gt;02e807&lt;/code&gt;.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;/media/docs/tempo/metrics/apm-filter-example-numbered.png&#34; alt=&#34;Filter example with numbers&#34;&gt;&lt;/p&gt;
&lt;p&gt;If your metrics queries are too specific, they may not return any results.&lt;/p&gt;
&lt;p&gt;Updating the filter to be less specific returns a result. In this case, the results show only span metrics data associated with the &lt;code&gt;span_name&lt;/code&gt; label with a value of &lt;code&gt;/base.Ruler/Rules&lt;/code&gt;. No service graph data was available.&lt;/p&gt;
&lt;p align=&#34;center&#34;&gt;&lt;img src=&#34;/media/docs/tempo/metrics/apm-filter-example2.png&#34; alt=&#34;Filter example with one results&#34;&gt;&lt;/p&gt;
]]></content><description>&lt;h1 id="service-graph-view">Service graph view&lt;/h1>
&lt;p>Grafana&amp;rsquo;s service graph view uses metrics generated by the metrics-generator or Grafana Alloy to display span request rates, error rates, and durations, as well as service graphs.
Once the requirements are set up, this pre-configured view is immediately available.&lt;/p></description></item><item><title>Analyze service graph data</title><link>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/metrics-queries/</link><pubDate>Fri, 03 Apr 2026 16:45:36 +0000</pubDate><guid>https://grafana.com/docs/tempo/v2.9.x/metrics-from-traces/service_graphs/metrics-queries/</guid><content><![CDATA[&lt;h1 id=&#34;analyze-service-graph-data&#34;&gt;Analyze service graph data&lt;/h1&gt;
&lt;p&gt;You can use this collection of PromQL queries to explore service graph metrics.&lt;/p&gt;
&lt;p&gt;Grafana uses the service graph metrics created by Tempo and builds that visual for the user.
However, you may want to interact with the metrics that define that service graph directly.
You may want to, for example, programmatically analyze how your services are interconnected and build downstream applications that use this information.&lt;/p&gt;
&lt;h2 id=&#34;instant-queries&#34;&gt;Instant Queries&lt;/h2&gt;
&lt;p&gt;An instant query gives a single value at the end of the selected time range.
&lt;a href=&#34;https://prometheus.io/docs/prometheus/latest/querying/api/#instant-queries&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Instant queries&lt;/a&gt; are quicker to execute and it often easier to understand their results. We prefer them in some scenarios:&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/tempo/metrics/screenshot-serv-graph-instant-query.png&#34;
  alt=&#34;Instant query in Grafana&#34; width=&#34;1831&#34;
     height=&#34;753&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;connectivity-between-services&#34;&gt;Connectivity between services&lt;/h3&gt;
&lt;p&gt;Show the total calls in the last 7 days for every client/server pair:&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;promql&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-promql&#34;&gt;sum(increase(traces_service_graph_request_server_seconds_count{}[7d])) by (server, client) &amp;gt; 0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Use this query to only see when a single service is the server:&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;promql&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-promql&#34;&gt;sum(increase(traces_service_graph_request_server_seconds_count{server=&amp;#34;foo&amp;#34;}[7d])) by (client) &amp;gt; 0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If you&amp;rsquo;d like to only see when a single service is the client:&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;promql&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-promql&#34;&gt;sum(increase(traces_service_graph_request_server_seconds_count{client=&amp;#34;foo&amp;#34;}[7d])) by (server) &amp;gt; 0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In all of the above queries, you can adjust the interval to change the amount of time this is calculated for. So if you wanted the same analysis done over one day:&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;promql&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-promql&#34;&gt;sum(increase(traces_service_graph_request_server_seconds_count{}[1d])) by (server, client) &amp;gt; 0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;h2 id=&#34;range-queries&#34;&gt;Range queries&lt;/h2&gt;
&lt;p&gt;Range queries are nice for calculating service graph info over a time range instead of a single point in time.&lt;/p&gt;
&lt;p&gt;&lt;img
  class=&#34;lazyload d-inline-block&#34;
  data-src=&#34;/media/docs/tempo/metrics/screenshot-serv-graph-range-query.png&#34;
  alt=&#34;Range query in Grafana&#34; width=&#34;1838&#34;
     height=&#34;768&#34;/&gt;&lt;/p&gt;
&lt;h3 id=&#34;rates-over-time-between-services&#34;&gt;Rates over time between services&lt;/h3&gt;
&lt;p&gt;Taking two of the queries above, we can request the rate over time that any given service acted as the client or server:&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;promql&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-promql&#34;&gt;sum(rate(traces_service_graph_request_server_seconds_count{server=&amp;#34;foo&amp;#34;}[5m])) by (client) &amp;gt; 0

sum(rate(traces_service_graph_request_server_seconds_count{client=&amp;#34;foo&amp;#34;}[5m])) by (server) &amp;gt; 0&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Notice that our interval dropped to 5m. This is so we only calculate the rate over the past 5 minutes which creates a more responsive graph.&lt;/p&gt;
&lt;h3 id=&#34;latency-percentiles-over-time-between-services&#34;&gt;Latency percentiles over time between services&lt;/h3&gt;
&lt;p&gt;These queries provide latency quantiles for the above rate.
If you&amp;rsquo;re interested in how the latency changed over time between any two services we could use these. In the following query the &lt;code&gt;.9&lt;/code&gt; means we&amp;rsquo;re calculating the 90th percentile.
Adjust this value if you want to calculate a different percentile for latency, for example, &lt;code&gt;p50&lt;/code&gt;, &lt;code&gt;p95&lt;/code&gt;, &lt;code&gt;p99&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;promql&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-promql&#34;&gt;histogram_quantile(.9, sum(rate(traces_service_graph_request_server_seconds_bucket{client=&amp;#34;foo&amp;#34;}[5m])) by (server, le))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Using the optional metric for latency of a messaging system to see potential middleware latencies:&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;promql&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-promql&#34;&gt;histogram_quantile(.9, sum(rate(traces_service_graph_request_messaging_system_seconds_bucket{}[5m])) by (client, server, le))&lt;/code&gt;&lt;/pre&gt;
  &lt;/div&gt;
&lt;/div&gt;
]]></content><description>&lt;h1 id="analyze-service-graph-data">Analyze service graph data&lt;/h1>
&lt;p>You can use this collection of PromQL queries to explore service graph metrics.&lt;/p>
&lt;p>Grafana uses the service graph metrics created by Tempo and builds that visual for the user.
However, you may want to interact with the metrics that define that service graph directly.
You may want to, for example, programmatically analyze how your services are interconnected and build downstream applications that use this information.&lt;/p></description></item></channel></rss>