Skip to main content

WSGI Middleware version of the CherryPy memory leak debugger

Project description

Dozer

https://github.com/mgedmin/dozer/actions/workflows/build.yml/badge.svg?branch=master https://ci.appveyor.com/api/projects/status/github/mgedmin/dozer?branch=master&svg=true https://coveralls.io/repos/mgedmin/dozer/badge.svg?branch=master

Dozer was originally a WSGI middleware version of Robert Brewer’s Dowser CherryPy tool that displays information as collected by the gc module to assist in tracking down memory leaks. It now also has middleware for profiling and for looking at logged messages.

Tracking down memory leaks

Usage:

from dozer import Dozer

# my_wsgi_app is a WSGI application
wsgi_app = Dozer(my_wsgi_app)

Assuming you’re serving your application on the localhost at port 5000, you can then load up http://localhost:5000/_dozer/index to view the gc info.

Profiling requests

Usage:

from tempfile import mkdtemp
from dozer import Profiler

# my_wsgi_app is a WSGI application
wsgi_app = Profiler(my_wsgi_app, profile_path=mkdtemp(prefix='dozer-'))

Assuming you’re serving your application on the localhost at port 5000, you can then load up http://localhost:5000/_profiler to view the list of recorded request profiles.

The profiles are stored in the directory specified via profile_path. If you want to keep seeing older profiles after restarting the web app, specify a fixed directory instead of generating a fresh empty new one with tempfile.mkdtemp. Make sure the directory is not world-writable, as the profiles are stored as insecure Python pickles, which allow arbitrary command execution during load.

Here’s a blog post by Marius Gedminas that contains a longer description of Dozer’s profiler.

Inspecting log messages

Usage:

from dozer import Logview

# my_wsgi_app is a WSGI application
wsgi_app = Logview(my_wsgi_app)

Every text/html page served by your application will get some HTML and Javascript injected into the response body listing all logging messages produced by the thread that generated this response.

Here’s a blog post by Marius Gedminas that contains a longer description of Dozer’s logview.

Dozer Changelog

0.9 (November 7, 2025)

  • Add support for Python 3.10, 3.11, 3.12, 3.13, and 3.14.

  • Drop support for Python 2.7, 3.6, 3.7, 3.8, and 3.9.

  • Stop using the cgi module (which wasn’t really being used).

  • Possibly fix a bug where unbound methods were not being filtered out properly in memory leak reports.

0.8 (November 13, 2020)

  • Add support for Python 3.8 and 3.9.

  • Drop support for Python 3.5.

  • Add UI input for existing “floor” query string parameter (https://github.com/mgedmin/dozer/issues/2)

  • Add UI input to filter type charts by a regular expression

  • Add sorting option: monotonicity

  • Display traceback on 500 Internal Server Error

  • Dicts and sets with unsortable keys are no longer unrepresentable

  • Aggregate dynamically-created types with the same __name__ and __module__ (issue 9).

0.7 (April 23, 2019)

  • Add support for Python 3.7.

  • Drop support for Python 3.3 and 3.4.

  • Stop using cgi.escape on Python 3, which is especially important now that it’s been removed from Python 3.8.

0.6 (May 18, 2017)

  • Add support for Python 3.6.

  • Drop support for Python 2.6.

  • Fix rare TypeError when listing profiles, if two profiles happen to have the exact same timestamp (https://github.com/mgedmin/dozer/pull/4).

0.5 (December 2, 2015)

  • Make /_dozer show the index page (instead of an internal server error).

  • Add support for Python 3.4 and 3.5.

  • Drop support for Python 2.5.

  • Move to GitHub.

0.4 (March 21, 2013)

  • 100% test coverage.

  • Add support for Python 3.2 or newer.

  • Drop dependency on Paste.

0.3.2 (February 10, 2013)

0.3.1 (February 6, 2013)

0.3 (December 13, 2012)

  • Emit the “PIL is not installed” only if the Dozer middleware is actually used.

  • Give a name to the Dozer memleak thread.

  • You can now supply a function directly to Logview(stack_formatter=fn)

  • New configuration option for Logview middleware: tb_formatter, similar to stack_formatter, but for exception tracebacks.

0.2 (December 5, 2012)

  • Adding logview that appends log events for the current request to the bottom of the html output for html requests.

  • Adding profiler for request profiling and call tree viewing.

  • Refactored Dozer into its own leak package.

  • New maintainer: Marius Gedminas.

0.1 (June 14, 2008)

  • Initial public release, port from Dowser, a CherryPy tool.

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

dozer-0.9.tar.gz (88.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dozer-0.9-py3-none-any.whl (92.0 kB view details)

Uploaded Python 3

File details

Details for the file dozer-0.9.tar.gz.

File metadata

  • Download URL: dozer-0.9.tar.gz
  • Upload date:
  • Size: 88.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for dozer-0.9.tar.gz
Algorithm Hash digest
SHA256 65fc27bf6ae5f642be14211c94e19c21c04e7c0572612a479ce6834fb25b5976
MD5 d1732f754510102aceb3870e5c5f3f70
BLAKE2b-256 5636eff9638fa2d1af5268d288ae105b1ef72cef181572b17edffdb60be67679

See more details on using hashes here.

File details

Details for the file dozer-0.9-py3-none-any.whl.

File metadata

  • Download URL: dozer-0.9-py3-none-any.whl
  • Upload date:
  • Size: 92.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for dozer-0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 ef2b15e0dd9b1eca0b59989ec842ae8f418a57e2a2823223cdcee3cfe56d3ebc
MD5 8219fc1be0defc48fe0167a51f9d32e1
BLAKE2b-256 706ee01c55b7224ef1bbedb724bd714c1ab113441270ded4d1fb01bb73c22a74

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