Skip to content

Sidecar Docker image for generating flamegraphs for Python applications

License

Notifications You must be signed in to change notification settings

binbashar/pyflame-docker-sidecar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Stars Docker Pulls

This a sidecar Docker container which can be used to generate flamegraphs for Python applications. It uses Uber pyflame library and flamegraph.pl script developed by Brendan Gregg.

In order to generate a flamegraph for an application you have to run this container in the same PID namespace as the application container. You also have to run it in priveledged mode or with SYS_ADMIN and SYS_PTRACE capabilities enabled:

# Start sidecar container in the same PID namespace as application container
docker run -it \ 
           --rm \ 
           --cap-add SYS_ADMIN \
           --cap-add SYS_PTRACE \
           --pid "container:<name or id of the application container>" \
           inikolaev/pyflame-docker-sidecar \
           ash

# Now you should be able to find the PID of your application and generate a flamegraph for it
pyflame -p <application pid> | flamegraph.pl > flamegraph.svg

I'm still figuring out a better way of running it automatically somehow. Raise an issue if you have an idea.


Release Management

CircleCi PR auto-release job

leverage-circleci

About

Sidecar Docker image for generating flamegraphs for Python applications

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages

  • Makefile 51.4%
  • Dockerfile 48.6%