github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/examples/tracing/jaeger/README.md (about) 1 ## OTel Tracing integration example 2 3 Currently this integration is supported for: 4 - Go: [OTel Profiling Go](https://github.com/pyroscope-io/otel-profiling-go) 5 - Java: [OTel Profiling Java](https://github.com/pyroscope-io/otel-profiling-java) 6 7 The example demonstrates how Pyroscope can be used in conjunction with tracing. 8 In the example we will instrument a sample application with OpenTelemetry tracer and 9 will be using [Jaeger](https://www.jaegertracing.io) and [Grafana](https://grafana.com). 10 11 To achieve that, we will be using a special label – `profile_id` that is set by the profiler 12 dynamically. Our simple application specifies Span ID as a profile ID which establishes 13 one-to-one relation between a trace span execution scope and the profiling scope. By default, only the root span gets annotated (the first span created locally), this is done to circumvent the fact that the profiler records only the time spent on CPU. 14 15 There are a few limitations: 16 17 1. Only Go CPU profiling is fully supported at the moment. 18 2. Due to the very idea of the sampling profilers, spans shorter than the sample interval may 19 not be captured. For example, Go CPU profiler probes stack traces 100 times per second, 20 meaning that spans shorter than 10ms may not be captured. 21 22 ### 1. Run the docker-compose file 23 24 ``` 25 # You will need to add loki plugin as well for this example 26 docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions 27 docker-compose up --build 28 ``` 29 30 Optionally, for debugging purposes, you can specify `DEBUG_TRACER` variable to make the sample app 31 printing traces to stdout instead of sending them to Jaeger: 32 33 ``` 34 # DEBUG_TRACER=1 docker-compose up --build 35 ``` 36 37 ### 2. Access profile exemplars via Jaeger UI 38 39 The newly collected data should be available for querying. Open [Jaeger UI](http://localhost:4000) and query a trace: 40 41 ![image](https://user-images.githubusercontent.com/23323466/162067415-07737db7-9978-4f2b-a99a-bc9b7a0faa66.png) 42 43 ### 3. Access profile exemplars via Jaeger in Grafana 44 45 The newly collected data should be available for querying. Open [Grafana](http://localhost:3000) 46 and Navigate to the **Explore** page and query a trace: 47 48 [![Watch the video](https://user-images.githubusercontent.com/23323466/172881613-842f67f0-6bfa-4671-a44a-e966d5ca67a4.mov)](https://user-images.githubusercontent.com/23323466/172881613-842f67f0-6bfa-4671-a44a-e966d5ca67a4.mov) 49 50 ### 4. Access profiling data via Pyroscope UI 51 52 Now let's filter out spans with the `pyroscope.profile.id` attribute. It's also important to note 53 that only **root** spans have profiles: in our case these are `OrderVehicle` and `CarHandler`: 54 55 ![image](https://user-images.githubusercontent.com/12090599/153310051-4f7b9fd2-ae9b-4e61-9714-7fb8c71a331f.png) 56 57 Click on the `pyroscope.profile.url` tag value to open [Pyroscope UI](http://localhost:4040) with 58 the span CPU time flamegraph: 59 60 ![image](https://user-images.githubusercontent.com/12090599/153314565-c7be8ef6-cd5d-4d0b-9070-83ae8a3a8e8a.png)