From 6ec883a7fd40a14f2882076bd1a377bbbd0438ad Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Thu, 27 Aug 2026 13:06:20 +0200 Subject: Add local Pyroscope server and Go continuous profiling Add a docker-compose service running the Grafana Pyroscope backend on port 4040 with a persistent data volume, and instrument the Go app via github.com/grafana/pyroscope-go. The app pushes CPU, memory, and goroutine profiles every 10s when pyroscope.enabled is set in config.yaml. Config is extended with application_name and server_address (defaults to http://localhost:4040). Document usage in the README. --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 9c042d4..35bb1c9 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,15 @@ go run . -extract-osm france-latest.osm.pbf # Extract mountain passes from a Fra go run . -backfill # Recompute and persist all ride computed values go run . -backtest # Benchmark computed vs stored ride values go run . -pprof # Expose pprof endpoints at `/debug/pprof` +docker compose up -d pyroscope # Start the local Pyroscope server on http://localhost:4040 ``` +Continuous profiling with Pyroscope: the app pushes CPU, memory, and goroutine +profiles every 10s when `pyroscope.enabled` is set in `config.yaml`. Run +`docker compose up -d pyroscope` to start the ingest server, then browse +`http://localhost:4040` to inspect the `biking_home` application profile. + + Configuration is stored in `config.yaml`. Start from `config.example.yaml` and set the Strava credentials before launching the server. ## Strava API @@ -149,17 +156,8 @@ Other endpoints: go tool pprof -http=:8081 http://localhost:8080/debug/pprof/heap # allocs ``` -Optional continuous profiling with Pyroscope (local docker, ~1-2% overhead): - -```bash -docker run --rm -p 4040:4040 grafana/pyroscope -``` - -Add `github.com/grafana/pyroscope-go` and call `pyroscope.Start` with `ServerAddress: "http://localhost:4040"` and `route` label — gives the same flamegraphs but over time. Keep it only if pprof snapshots are not enough. - ## TODO -- pyroscope - screaming archi + hexagon - Compute estimated power, speed - For a ride, scatter, one point per 100m segment. Slope vs speed -- cgit v1.3