github.com/grafana/pyroscope@v1.18.0/examples/tracing/ruby/README.md (about) 1 # Span Profiles with Grafana Tempo and Pyroscope 2 3 The docker compose consists of: 4 - Three Ruby Rideshare App instances (us-east, eu-north, ap-south regions) 5 - Tempo for trace collection 6 - Pyroscope for continuous profiling 7 - Grafana for visualization 8 - Load Generator for simulating traffic 9 10 For a detailed guide about Ruby span profiles configuration, refer to the docs [Pyroscope documentation](https://grafana.com/docs/pyroscope/latest/configure-client/trace-span-profiles/ruby-span-profiles/). 11 12 The `rideshare` app generates traces and profiling data that should be available in Grafana. 13 Pyroscope and Tempo datasources are provisioned automatically. 14 15 ### Build and run 16 17 The project can be run locally with the following commands: 18 19 ```shell 20 # Pull latest pyroscope and grafana images: 21 docker pull grafana/pyroscope:latest 22 docker pull grafana/grafana:latest 23 24 bundle install 25 26 docker compose up 27 ``` 28 The load generator will automatically start sending requests to all regional instances. 29 30 ### Viewing Traces and Profiles 31 32 Navigate to the [Explore page](http://localhost:3000/explore?schemaVersion=1&panes=%7B%22yM9%22:%7B%22datasource%22:%22tempo%22,%22queries%22:%5B%7B%22refId%22:%22A%22,%22datasource%22:%7B%22type%22:%22tempo%22,%22uid%22:%22tempo%22%7D,%22queryType%22:%22traceqlSearch%22,%22limit%22:20,%22tableType%22:%22traces%22,%22filters%22:%5B%7B%22id%22:%22e73a615e%22,%22operator%22:%22%3D%22,%22scope%22:%22span%22%7D,%7B%22id%22:%22service-name%22,%22tag%22:%22service.name%22,%22operator%22:%22%3D%22,%22scope%22:%22resource%22,%22value%22:%5B%22rideshare.ruby.push.app%22%5D,%22valueType%22:%22string%22%7D%5D%7D%5D,%22range%22:%7B%22from%22:%22now-6h%22,%22to%22:%22now%22%7D%7D%7D&orgId=1), select a trace and click on a span that has a linked profile: 33 34  35 36 By default, only the root span gets labeled (the first span created locally): such spans are marked with the link icon 37 and have `pyroscope.profile.id` attribute set to the corresponding span ID. 38 Please note that presence of the attribute does not necessarily 39 indicate that the span has a profile: stack trace samples might not be collected, if the utilized CPU time is 40 less than the sample interval (10ms). 41 42 ### Grafana Tempo configuration 43 44 In order to correlate trace spans with profiling data, the Tempo datasource should have the following configured: 45 - The profiling data source 46 - Tags to use when making profiling queries 47 48  49 50 While tags are optional, configuring them is highly recommended for optimizing query performance. 51 In our example, we configured the `service.name` tag for use in Pyroscope queries as the `service_name` label. 52 This configuration restricts the data set for lookup, ensuring that queries remain 53 consistently fast. Note that the tags you configure must be present in the span attributes or resources 54 for a trace to profiles span link to appear. 55 56 Please refer to our [documentation](https://grafana.com/docs/grafana/next/datasources/tempo/configure-tempo-data-source/#trace-to-profiles) for more details.