Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Profile a Tornado application via REST

Project description

https://travis-ci.org/makearl/tornado-profile.svg?branch=master

Add this library to your routes to add a REST API for profiling your Tornado application.

Usage

import tornado
from tornado_profile import TornadoProfiler

port = 8888
routes = []

routes += TornadoProfiler().get_routes()
app = tornado.web.Application(routes)
app.listen(port)
tornado.ioloop.IOLoop.current().start()

# Create with optional route prefix and base class for handlers
routes += TornadoProfiler(prefix="", handler_base_class=custom_base_class).get_routes()

Installation

$ pip install tornado-profile

API

# Start the profiler
POST /profiler

# Stop the profiler
DELETE /profiler

# Get the profiler status
GET /profiler
{"running": true/false}

# Get the profiler statistics
GET /profiler/stats
{
    "statistics": [
        {
            "path": ...,
            "line": ...,
            "func_name": ...,
            "num_calls": ...,
            "total_time": ...,
            "total_time_per_call": ...,
            "cum_time": ...,
            "cum_time_per_call": ...
        }
        ...
    ]
}

# Get the profiler statistics with optional query parameters
GET /profiler/stats?count=1&sort=num_calls&strip_dirs=false

# Clear the profiler statistics
DELETE /profiler/stats

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
tornado_profile-1.2.0-py2.7.egg (7.7 kB) Copy SHA256 hash SHA256 Egg 2.7
tornado_profile-1.2.0-py2-none-any.whl (5.6 kB) Copy SHA256 hash SHA256 Wheel py2

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page