writing-skills
writing-skills
Use when creating new skills, editing existing skills, or verifying skills work before deployment
pyroscopeContinuously profile applications with Grafana Pyroscope and read the result as flame graphs. Covers three instrumentation paths — language SDK push (Go / Java / Python / Ruby / Node / .NET / Rust), Alloy eBPF auto-instrumentation (no code change, requires kernel 5.8+ with BTF), and SDK → Alloy receiver — plus ProfileQL queries, profile types (CPU / memory …
Independent GitHub snapshot · Automated classification · Original documentation governs
Continuous profiling — flame graphs of CPU, memory, allocations, mutex contention, goroutines.
pyroscope.receive_http, Alloy forwardspip install pyroscope-io==1.0.11
import pyroscope, os
pyroscope.configure(
application_name="my.python.app",
server_address="http://pyroscope:4040",
sample_rate=100, oncpu=True,
tags={"region": os.getenv("REGION"), "env": "prod"},
)
# Dynamic tag for a hot path
with pyroscope.tag_wrapper({"controller": "slow_controller"}):
slow_code()
# Verify the app is pushing — Pyroscope ingests samples in a few seconds
curl -s http://pyroscope:4040/ready # → "ready"
curl -s http://pyroscope:4040/api/v1/labels | jq '.data | index("service_name")' # → not null
# Verify the service shows up in Grafana → Explore → Profiles → service dropdown.
Other SDKs (Java agent, Node, Ruby, .NET, Rust) + Cloud auth + tunable env vars: references/sdks.md.
# config.alloy — full block in references/ebpf-and-query.md
pyroscope.ebpf "local_pods" {
forward_to = [pyroscope.write.cloud.receiver]
targets = discovery.relabel.local_pods.output
sample_rate = 97
collect_interval = "15s"
}
pyroscope.write "cloud" {
endpoint {
url = "https://profiles-prod-xxx.grafana.net"
basic_auth { username = sys.env("PYROSCOPE_USER")
password = sys.env("GRAFANA_API_KEY") }
}
}
# 1. Reload Alloy
curl -X POST http://localhost:12345/-/reload
# 2. Verify the eBPF component is healthy
curl -s http://localhost:12345/api/v0/web/components \
| jq '.[] | select(.id|contains("pyroscope.ebpf")) | {id,health:.health.state}'
# Expect: health.state == "healthy"
# 3. Verify profiles arriving in Pyroscope
# Grafana → Explore → Profiles datasource → query:
# {namespace="default", __profile_type__="process_cpu:cpu:nanoseconds:cpu:nanoseconds"}
# Expect flame graph to render with frames from the target pods.
{service_name="myapp", env="prod",
__profile_type__="process_cpu:cpu:nanoseconds:cpu:nanoseconds"}
Profile-type list + full ProfileQL grammar: references/ebpf-and-query.md.
start() / configure() (some SDKs are lazy); check server_address reachable from inside the containerunhealthy with BPF errors → kernel < 5.8 or BTF missing; ls /sys/kernel/btf/vmlinuxbasic_auth_username (must be the numeric stack id, not the slug)PYROSCOPE_FORMAT=jfr; for Python on Alpine, ensure procfs and glibc compatibilityreferences/sdks.md — Java/Node/Ruby/.NET/Rust install + config + env-var table + profile-type matrixreferences/ebpf-and-query.md — full Alloy eBPF pipeline + ProfileQL