Skip to main content

Python profiler endpoints like Go's net/http/pprof.

Project description

pypprof

pypprof adds HTTP-based endpoints for collecting profiles from a running Python application a la Go's net/http/pprof.

Under the hood, it uses zprofile and mprofile to collect CPU and heap profiles with minimal overhead.

Usage

Add profiling endpoints to an application

Register the profiling endpoints in your application:

from pypprof.net_http import start_pprof_server

start_pprof_server(port=8081)

Fetch profiles from your running application

Fetch a 30s CPU profile, and view as a flamegraph:

$ go tool pprof -http=:8088 :8081/debug/pprof/profile

Fetch a heap profile:

$ go tool pprof :8081/debug/pprof/heap

Dump stacks from your application:

$ curl localhost:8081/debug/pprof/thread?debug=1

Compatibility

pypprof is compatible with Python >= 2.7. Memory profiling is only available by default in Python >= 3.4. To enable memory profiling in earlier Pythons, you must patch Python and manually install mprofile.

Contributing

Pull requests and issues are welcomed!

License

pypprof is released under the GNU Lesser General Public License, Version 3.0

Project details


Release history Release notifications

This version

0.0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pypprof, version 0.0.1
Filename, size File type Python version Upload date Hashes
Filename, size pypprof-0.0.1.tar.gz (11.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page