Your application is slow. Metrics tell you WHAT is slow. Traces tell you WHERE it's slow. Profiling tells you WHY it's slow.
What Is Grafana Pyroscope?
Grafana Pyroscope is a continuous profiling platform. It captures CPU, memory, goroutine, mutex, and other profiles from your production applications — with minimal overhead (<2% CPU).
Think of it as always-on profiling. Instead of attaching a profiler during an incident, you have historical profiles for any point in time.
SDK Integration
// Go
import "github.com/grafana/pyroscope-go"
pyroscope.Start(pyroscope.Config{
ApplicationName: "my-service",
ServerAddress: "http://pyroscope:4040",
ProfileTypes: []pyroscope.ProfileType{
pyroscope.ProfileCPU,
pyroscope.ProfileAllocObjects,
pyroscope.ProfileAllocSpace,
pyroscope.ProfileGoroutines,
},
})
// That's it — profiles are now continuously sent
# Python
import pyroscope
pyroscope.configure(
application_name="my-python-app",
server_address="http://pyroscope:4040",
)
# Profiling is now active
// Java — just add the agent
// java -javaagent:pyroscope.jar -Dpyroscope.application.name=my-app -jar app.jar
The Query API
# Get profile data
curl 'http://pyroscope:4040/pyroscope/render?query=my-service.cpu&from=now-1h&until=now&format=json'
# List applications
curl 'http://pyroscope:4040/pyroscope/api/apps'
# Label values
curl 'http://pyroscope:4040/pyroscope/label-values?label=__name__'
Why Continuous Profiling
1. Find the exact function — Not "the API is slow" but "json.Marshal in handlers.go:142 takes 340ms."
2. Compare time periods — Diff profiles from before and after a deploy. See exactly what got slower.
3. Optimize costs — A fintech company found one function consuming 40% of CPU. One optimization saved $12,000/month in cloud costs.
4. Correlate with metrics and traces — In Grafana, click from a slow trace span directly to its CPU profile.
Quick Start
docker run -p 4040:4040 grafana/pyroscope:latest
# UI at http://localhost:4040
Building performance-critical systems? Check out my developer tools or email spinov001@gmail.com.
Top comments (0)