github.com/grafana/pyroscope@v1.18.0/examples/tracing/dotnet/README.md (about)

     1  # Span Profiles with Grafana Tempo and Pyroscope
     2  
     3  The docker compose consists of:
     4  - The .NET Rideshare App
     5  - Tempo
     6  - Pyroscope
     7  - Grafana
     8  
     9  The `rideshare` app generate traces and profiling data that should be available in Grafana.
    10  Datasources for Pyroscope and Tempo are provisioned automatically.
    11  
    12  ### Build and run
    13  
    14  The project can be run locally with the following commands:
    15  
    16  ```shell
    17  # (optionally) pull latest pyroscope and grafana images:
    18  docker pull grafana/pyroscope:latest
    19  docker pull grafana/grafana:latest
    20  
    21  # build and run the example
    22  docker compose up --build
    23  ```
    24  
    25  Navigate to the [Explore page](http://localhost:3000/explore?schemaVersion=1&panes=%7B%22f36%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.dotnet.push.app%22%5D,%22valueType%22:%22string%22%7D%5D,%22query%22:%22%7Bresource.service.name%3D%5C%22rideshare.dotnet.push.app%5C%22%7D%22%7D%5D,%22range%22:%7B%22from%22:%22now-15m%22,%22to%22:%22now%22%7D%7D%7D&orgId=1), select a trace and click on a span that has a linked profile:
    26  
    27  ![image](https://github.com/grafana/otel-profiling-go/assets/12090599/31e33cd1-818b-4116-b952-c9ec7b1fb593)
    28  
    29  By default, only the root span gets labeled (the first span created locally): such spans are marked with the _link_ icon
    30  and have the `pyroscope.profile.id` attribute set to the corresponding span ID.
    31  Please note that presence of the attribute does not necessarily
    32  indicate that the span has a profile: stack trace samples might not be collected, if the utilized CPU time is
    33  less than the sample interval (10ms).
    34  
    35  ### Instrumentation
    36  
    37  The `rideshare` demo application is instrumented with Pyroscope: [Pyroscope .NET Agent](https://github.com/grafana/pyroscope-dotnet)
    38  
    39  ### Grafana Tempo configuration
    40  
    41  In order to correlate trace spans with profiling data, the Tempo datasource should have the following configured:
    42  - The profiling data source
    43  - Tags to use when making profiling queries
    44  
    45  ![image](https://github.com/grafana/pyroscope/assets/12090599/380ac574-a298-440d-acfb-7bc0935a3a7c)
    46  
    47  While tags are optional, configuring them is highly recommended for optimizing query performance.
    48  In our example, we configured the `service.name` tag for use in Pyroscope queries as the `service_name` label.
    49  This configuration restricts the data set for lookup, ensuring that queries remain
    50  consistently fast. Note that the tags you configure must be present in the span attributes or resources
    51  for a trace to profiles span link to appear.
    52  
    53  Please refer to our [documentation](https://grafana.com/docs/grafana/next/datasources/tempo/configure-tempo-data-source/#trace-to-profiles) for more details.