Menu

This is documentation for the next version of Grafana Tempo documentation. For the latest stable release, go to the latest version.

Open source

Enable service graphs

You can enable service graphs in Tempo by using the metrics-generator or by configuring service graphs in Grafana Alloy.

Using the metrics-generator to generate service graphs is more efficient and recommended for larger installations.

Note

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 Cardinality documentation.

Enable service graphs with metrics-generator

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.

Enable service graphs in Tempo

To enable service graphs in Tempo, enable the metrics-generator and add an overrides section which enables the service-graphs generator. For more information, refer to the configuration details.

To enable service graphs when using Grafana Alloy, refer to the Grafana Alloy and service graphs section.

Enable service graphs in Grafana

Note

Service graphs are enabled by default in Grafana. Prior to Grafana 9.0.4, service graphs were hidden under the feature toggle tempoServiceGraph.

Configure a Tempo data source’s service graphs by linking to the Prometheus backend where metrics are being sent:

YAML
apiVersion: 1
datasources:
  # Prometheus backend where metrics are sent
  - name: Prometheus
    type: prometheus
    uid: prometheus
    url: <prometheus-url>
    jsonData:
      httpMethod: GET
    version: 1
  - name: Tempo
    type: tempo
    uid: tempo
    url: <tempo-url>
    jsonData:
      httpMethod: GET
      serviceMap:
        datasourceUid: 'prometheus'
    version: 1

Enable service graphs using Alloy

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.

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 this section.

Service graphs are also used in the application performance management dashboard. For more information, refer to the service graph view documentation.

Before you begin

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.

Steps

To start using service graphs, enable the feature in the Alloy configuration.

The following example adds the http.method and http.target 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.

alloy
otelcol.receiver.otlp "default" {
  grpc {}
  http {}

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

otelcol.connector.servicegraph "default" {
  dimensions = ["http.method", "http.target"]
  output {
    metrics = [otelcol.exporter.otlp.default.input]
  }
}

otelcol.exporter.otlp "default" {
  client {
    endpoint = env("OTLP_ENDPOINT")
  }
}

To see all the available configuration options, refer to the component reference.