---
name: "pyroscope-continuous-profiling"
description: "Profile production CPU, memory, and goroutine allocations continuously with minimal overhead."
metadata:
  author: "Grafana Labs"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "setup pyroscope profiling"
  - "analyze flame graph pyroscope"
  - "find memory leak pyroscope"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Grafana Pyroscope Continuous CPU & Memory Profiling

Integrates Grafana Pyroscope: embedding lightweight profiling agents (Go, Node.js, Python, Java, eBPF), analyzing flame graphs, comparing diff profiles before/after deployments, and pinpointing memory leaks.

## When to Invoke
Invoke this skill whenever you need to:
- setup pyroscope profiling
- analyze flame graph pyroscope
- find memory leak pyroscope

## Execution SOP & Rules
1. Initialize Pyroscope agent in code: pyroscope.Start(pyroscope.Config{ ApplicationName: 'api', ServerAddress: '...' }).
2. Deploy Pyroscope server or connect to Grafana Cloud Profiles.
3. Inspect interactive flame graphs in Grafana to locate widest frames consuming CPU cycles.
4. Use profile comparison mode (diff) to compare baseline vs deployment performance profiles.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
