github.com/pyroscope-io/pyroscope@v0.37.3-0.20230725203016-5f6947968bd0/examples/golang-pull/file/README.md (about) 1 # Pyroscope pull with static targets 2 3 This example demonstrates how Pyroscope can be used to scrape pprof profiles from remote targets discovered via file-based service discovery mechanism. 4 5 ### 1. Run Pyroscope server and demo applications in docker containers 6 7 ```shell 8 docker-compose up -d 9 ``` 10 11 As a sample application we use slightly modified Jaeger [Hot R.O.D.](https://github.com/jaegertracing/jaeger/tree/master/examples/hotrod) demo – 12 the only difference is that we enabled built-in Go `pprof` HTTP endpoints. You can find the modified code in the [hotrod-goland](https://github.com/pyroscope-io/hotrod-golang) repository. 13 14 Note that we apply configuration defined in `server.yml`: 15 16 <details> 17 <summary>server.yml</summary> 18 19 ```yaml 20 --- 21 log-level: debug 22 scrape-configs: 23 - job-name: testing 24 enabled-profiles: [cpu, mem, goroutines, mutex, block] 25 file-sd-configs: 26 - refresh-interval: 10s 27 files: 28 - '/targets.json' 29 ``` 30 31 </details> 32 33 The file contains a list of remote target the Pyroscope server will pull profiling data from. When files from the list change, the server will automatically update the scrape target list, without requiring a restart. 34 35 <details> 36 <summary>targets.json</summary> 37 38 ```json 39 [ 40 { 41 "application": "hotrod", 42 "spy-name": "gospy", 43 "labels": { 44 "env": "dev" 45 }, 46 "targets": [ 47 "hotrod:6060" 48 ] 49 }, 50 { 51 "application": "my-app", 52 "spy-name": "gospy", 53 "labels": { 54 "env": "dev" 55 }, 56 "targets": [ 57 "app:6060" 58 ] 59 } 60 ] 61 ``` 62 63 </details> 64 65 ### 2. Observe profiling data 66 67 Profiling is more fun when the application does some work. Let's order some rides [in our Hot R.O.D. app](http://localhost:8080). 68 69 Now that everything is set up, you can browse profiling data via [Pyroscope UI](http://localhost:4040).