RousselTMLEARNING

Observability

Grafana Pyroscope architecture and deployment

Pyroscope components (distributor, ingester, querier, store-gateway, compactor), object storage, monolithic and microservices modes, configuration and retention.

1. The components #

An architecture borrowed from Mimir.

Overview #

Available in: ✓ OSS ✓ Enterprise ✕ Cloud In Grafana Cloud the service is managed by Grafana Labs: nothing to install

Pyroscope architecture
Same split as Mimir and Loki: separate write, read and compaction.
ComponentRole
distributorReceives profiles, validates, applies limits, distributes to the ingesters
ingesterAggregates recent profiles in memory and writes blocks to object storage
querier / query-frontendMerges the requested profiles and builds flame graphs and series
store-gatewayReads historical blocks from object storage
compactorMerges blocks and applies retention
Good to know: The internal architecture evolves quickly between versions (notably towards ingestion written directly to object storage). The principles (object storage, per-component scaling, Grafana compatibility) remain the same: refer to the release notes of your version.

2. Running Pyroscope #

Monolithic to start with.

Docker #

docker run -d --name pyroscope -p 4040:4040 grafana/pyroscope:latest
curl -s localhost:4040/ready

The built-in web interface is available at http://localhost:4040; so is the ingestion API (SDK: /ingest, Alloy: /push.v1.PusherService/Push).

Configuration with object storage #

# pyroscope.yaml
target: all
server:
  http_listen_port: 4040
storage:
  backend: s3
  s3:
    endpoint: minio:9000
    bucket_name: pyroscope
    access_key_id: pyroscope
    secret_access_key: supersecret
    insecure: true
limits:
  compactor_blocks_retention_period: 30d
  ingestion_rate_mb: 4
  ingestion_burst_size_mb: 8
  max_label_names_per_series: 30
pyroscope -config.file=/etc/pyroscope.yaml
Good practice: Without object storage, Pyroscope writes to the local disk (filesystem): perfect for a lab, not for production.

3. Grafana and profilecli #

Explore and automate.

Data source #

In Grafana, add a Grafana Pyroscope data source with the URL http://pyroscope:4040. The Profiles Drilldown app (formerly Explore Profiles) offers query-less navigation: services, profile types, labels, then flame graph.

profilecli #

# Lister les séries et les types de profils disponibles
profilecli query series --url http://localhost:4040 --query '{service_name="checkout"}'

# Télécharger un profil fusionné au format pprof (analysable avec go tool pprof)
profilecli query profile --url http://localhost:4040 \
  --profile-type process_cpu:cpu:nanoseconds:cpu:nanoseconds \
  --query '{service_name="checkout"}' --from now-1h --output pprof=cpu.pb.gz

# Envoyer un profil pprof existant
profilecli upload --url http://localhost:4040 --extra-labels service_name=batch cpu.pb.gz

Related articles

Continuous profiling with Grafana Pyroscope: why and how

The fourth signal of observability: what continuous profiling is, profile types (CPU, memory, locks), reading…

Instrumenting applications for Pyroscope: SDKs, Alloy and eBPF

Send profiles to Pyroscope from Go, Java, Python and Node.js with the SDKs, collect pprof endpoints with Allo…

Analyzing profiles in Grafana: flame graphs, comparisons and diagnostics

A method for analyzing profiles in Grafana: Profiles Drilldown, flame graph and top table, comparing two peri…

Keep learning

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!