The repository is organized as follows:
/pyroscope
Dockerfile # Builds the Pyroscope server and client image connect_pyroscope.js # Script to connect Pyroscope to the parent process pyroscope-data # Directory for storing Pyroscope server data
/process-exporter
Dockerfile # Builds the Process Exporter image config.yml # Configuration file for Process Exporter
/middleware
Dockerfile # Builds the middleware API service server.js # Main entry point for the middleware service package.json # Node.js dependencies for the middleware service
docker-compose.yml
# Orchestrates the Pyroscope and Process Exporter containers README.md # Documentation for the repository
Before you begin, ensure you have the following installed:
Use Docker Compose to build and run the monitoring sidecar:
docker-compose down
docker-compose build
docker-compose up -d
http://localhost:4040
http://localhost:9256/metrics
The Pyroscope client connects to the parent process running on the host using the connect_pyroscope.js script. It uses eBPF or other profiling methods to capture CPU and memory usage.
The Process Exporter monitors the parent process and exposes metrics in a Prometheus-compatible format. It uses a configuration file (config.yml) to specify which processes to monitor. Host Integration:
The containers share the host‘s process namespace (pid: “host”) and mount the host’s proc filesystem to access process information.
The containers run with elevated privileges (privileged: true) to access host resources. Use this setup cautiously in production environments. Ensure that only trusted users can access the exposed metrics and profiling data.