Skip to content

Comments

feat: comprehensive Pyroscope profiling for Ethereum clients#1302

Draft
qu0b wants to merge 3 commits intomainfrom
qu0b/profiling-pprof
Draft

feat: comprehensive Pyroscope profiling for Ethereum clients#1302
qu0b wants to merge 3 commits intomainfrom
qu0b/profiling-pprof

Conversation

@qu0b
Copy link
Member

@qu0b qu0b commented Jan 27, 2026

Summary

This PR adds comprehensive continuous profiling support for Ethereum clients using Grafana Pyroscope, with automatic integration into Grafana dashboards.

Profiling Support Matrix

Client Type Method Status
Geth EL Native Pyroscope SDK ✅ Automatic
Erigon EL pprof via Alloy ✅ Automatic
Reth EL pprof heap ✅ Requires profiling image
Besu EL Pyroscope Java Agent ✅ Automatic
Nethermind EL - ❌ Not supported
Prysm CL pprof via Alloy ✅ Automatic
Teku CL Pyroscope Java Agent ✅ Automatic
Lighthouse CL OTEL traces only ⚠️ Traces to Tempo
Lodestar CL - ❌ Not supported
Nimbus CL - ❌ Not supported

Key Changes

  • Pyroscope early launch - Pyroscope starts before EL/CL clients so native SDKs can connect
  • Java Agent support - Downloads and configures Pyroscope Java Agent for Besu/Teku
  • Alloy pprof scraping - New Grafana Alloy service for continuous pprof collection from Erigon/Prysm
  • Grafana integration - Pyroscope datasource + trace-to-profile linking with Tempo
  • Updated dashboard - Flame graphs, Go runtime metrics, JVM metrics, Lighthouse jemalloc metrics

Usage

additional_services:
  - prometheus
  - grafana
  - pyroscope
  - tempo  # optional, for Lighthouse OTEL traces

participants:
  - el_type: geth
    cl_type: lighthouse
  - el_type: besu
    cl_type: teku

For Reth profiling, use the profiling image:

  - el_type: reth
    el_image: ghcr.io/paradigmxyz/reth:nightly-profiling

Files Changed

  • main.star - Early Pyroscope launch, Alloy integration, Grafana pyroscope_url
  • src/pyroscope/pyroscope_launcher.star - Java agent download, early launch function
  • src/alloy/alloy_launcher.star - New Alloy service for pprof scraping
  • src/el/besu/besu_launcher.star - Pyroscope Java Agent integration
  • src/cl/teku/teku_launcher.star - Pyroscope Java Agent integration
  • src/grafana/grafana_launcher.star - Pyroscope URL parameter
  • static_files/grafana-config/templates/datasource.yml.tmpl - Pyroscope datasource + trace linking
  • static_files/grafana-config/dashboards/profiling-dashboard.json - Updated with flame graphs
  • static_files/alloy/config.alloy.tmpl - Alloy pprof scraping config
  • static_files/tempo-config/tempo.yaml.tmpl - Fixed config format

Test plan

  • Run with Geth + Lighthouse - verify Geth profiles in Pyroscope
  • Run with Besu + Teku - verify Java profiles in Pyroscope
  • Run with Erigon + Prysm - verify Alloy scrapes pprof endpoints
  • Verify Grafana dashboard loads with flame graphs
  • Verify Tempo trace-to-profile linking works

🤖 Generated with Claude Code

qu0b and others added 3 commits January 27, 2026 11:01
- Add Pyroscope service as an optional additional_service
- Enable pprof on Geth (port 6060) for Go runtime profiling
- Prysm already has pprof enabled by default
- Add pyroscope_params configuration (image, scrape_interval, resources)
- Add Go Runtime Profiling Grafana dashboard showing:
  - Memory usage (allocated, heap, stack)
  - GC metrics (duration rate, frequency)
  - Goroutines and OS threads
  - Memory allocation rate and heap objects

Usage:
```yaml
additional_services:
  - pyroscope
  - prometheus_grafana

pyroscope_params:
  scrape_interval: "15s"  # optional, default 15s
```

When Pyroscope is enabled, it automatically scrapes pprof endpoints from:
- Geth (EL): http://<geth-service>:6060/debug/pprof/
- Prysm (CL): http://<prysm-service>:6060/debug/pprof/
Grafana Pyroscope server doesn't support scraping directly - it requires
Grafana Alloy for that. This commit simplifies the deployment to just
run Pyroscope as a storage/query backend, and logs available pprof
endpoints for users to access directly or configure with Alloy.
…ana integration

This commit adds continuous profiling support for Ethereum clients:

Pyroscope Integration:
- Launch Pyroscope early (before EL/CL) for native SDK support
- Download Pyroscope Java Agent for JVM-based clients
- Add Reth pprof support (requires profiling image)

Client-specific profiling:
- Geth: Native Pyroscope SDK (push-based, automatic)
- Erigon/Prysm: pprof scraping via Grafana Alloy
- Besu/Teku: Pyroscope Java Agent for JFR profiles
- Reth: pprof heap endpoint (with profiling image)
- Lighthouse: OTEL traces to Tempo (no profiling)

Grafana Integration:
- Add Pyroscope as datasource
- Configure Tempo trace-to-profile linking
- Update profiling dashboard with flame graphs
- Add sections for Go, JVM, and jemalloc metrics

Alloy pprof Scraping:
- New Alloy service for continuous pprof collection
- Scrapes CPU, memory, goroutine, mutex, block profiles
- Pushes to Pyroscope for unified profile storage

Config fixes:
- Fix Tempo config format for newer versions
- Increase Pyroscope limits for JFR profiles (500MB)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant