Skip to main content

Geprofiler is a Python HTTP Server profiler that makes it easy to find slow code.

Project description

cover image

Geprofiler is a Python call stack profiler built on top of Pyinstrument but stripped of the unnecessary and focused on supporting features for HTTP Server.

Installation

$ pip install geprofiler

Geprofiler supports Python 3.7+. In addition, curl is required to be installed if you want to use geprofiler.yaml.

Usage

The examples below use Django to create a simple HTTP server that will be profiled by Geprofiler.

⚡ Quick start

To profile Django web requests:

  • Add geprofiler.middleware.ProfilerMiddleware to MIDDLEWARE in your settings.py.
  • Once the server has been started, add ?geprofiler (as a query param) to the end of a request URL you want to profile (also geprofiler can also be added as a request header). As soon as the request is processed, a new browser tab will be opened to display the profile information. web profile
  • Add GEPROFILER_PROFILE_DIR = 'profiles' to your settings.py if you want the result page to be saved to the folder profiles in your working directory.

📋 Use geprofiler.yaml

Sometimes, you need a different solution to solve advanced problems. For example, you might want Geprofiler to automatically profile all the APIs you specified immediately, instead of spending too much time profiling each API manually. In this case, you can define a file geprofiler.yaml in your working directory with a structure similar to the one below.

yaml

  • request:
    • format: the format of your request list.
    • list: a list of request statements corresponding to the format declared above.
    • filter:
      • min_duration: the minimum duration that a request has taken in milliseconds.
  • output_dir: (optional) the folder that you want to save the result page in.

Finally, to start profiling, run:

$ geprofiler

Result: geprofiler-yaml-result

Project details


Download files

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

Source Distribution

geprofiler-1.0.8.tar.gz (337.7 kB view details)

Uploaded Source

File details

Details for the file geprofiler-1.0.8.tar.gz.

File metadata

  • Download URL: geprofiler-1.0.8.tar.gz
  • Upload date:
  • Size: 337.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.8.9

File hashes

Hashes for geprofiler-1.0.8.tar.gz
Algorithm Hash digest
SHA256 956400e0641612645c15a11dda1a94ccf6ee78f1ff09b9e3ad7bf087ac2b0d28
MD5 bbbf96c686780f1496cb6ebc4be4342b
BLAKE2b-256 790e217ddee67f750a9602c05635607e5fa1eca7b0922309b91c2d9cd6a3fd77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page