Back to Pyroscope

Span Profiles with Grafana Tempo and Pyroscope

examples/tracing/java/README.md

2.0.12.9 KB
Original Source

Span Profiles with Grafana Tempo and Pyroscope

The docker compose consists of:

  • The Java Rideshare App
  • Tempo
  • Pyroscope
  • Grafana

The rideshare app generate traces and profiling data that should be available in Grafana. Datasources for Pyroscope and Tempo are provisioned automatically.

Build and run

The project can be run locally with the following commands:

shell
# (optionally) pull latest pyroscope and grafana images:
docker pull grafana/pyroscope:latest
docker pull grafana/grafana:latest

# build and run the example
docker compose up --build

Navigate to the Explore page, select a trace and click on a span that has a linked profile:

By default, only the root span gets labeled (the first span created locally): such spans are marked with the link icon and have the pyroscope.profile.id attribute set to the corresponding span ID. Please note that presence of the attribute does not necessarily indicate that the span has a profile: stack trace samples might not be collected, if the utilized CPU time is less than the sample interval (10ms).

Instrumentation

The rideshare demo application is instrumented with OpenTelemetry: OTel integration

Grafana Tempo configuration

In order to correlate trace spans with profiling data, the Tempo datasource should have the following configured:

  • The profiling data source
  • Tags to use when making profiling queries

While tags are optional, configuring them is highly recommended for optimizing query performance. In our example, we configured the service.name tag for use in Pyroscope queries as the service_name label. This configuration restricts the data set for lookup, ensuring that queries remain consistently fast. Note that the tags you configure must be present in the span attributes or resources for a trace to profiles span link to appear.

Please refer to our documentation for more details.