Skip to main content

mongomon

A Python mongodb monitor and profiler for development.

Quick Start

Install using pip/pipenv/etc. (we recommend poetry for sane dependency management):

$ poetry add mongomon --dev

Initialize before you set up your MongoDB connection:

from mongomon import Monitor, Config
Monitor(Config(file_capture=".*/(wiki.*)")).monitor()

Use file_capture to specify how to extract relevant project file paths from traces, rather than absolute file paths.

Exploring the Example

We've taken the example from Flask-PyMongo to show how easy it is to have mongomon integrated and running.

You can look at the integration here. To run it:

$ poetry shell
$ cd examples/wiki && pip install -r requirements
$ python wiki.py

Configuration

Your main configuration points for mongomon are:

  • file_capture - an aesthetic configuration point for capturing files for your project. Usually of the form .*/(your-project.*), content in parenthesis are a regular expression capture group, and is what we actually extract.
  • low_watermark_us - a threshold in microseconds (us) above which mongomon starts working (yellow).
  • high_watermark_us - a high threshold in microseconds (us) above which mongomon displays timing as alert (red).

Rest of configuration looks like so (with their defaults and comments):

    # cleans up stack trace with uninteresting things. Usually packages, standard library, etc.
    ignores = attrib(
        default=[
            ".*/site-packages/.*",
            ".*traceback.format_stack.*",
            r".*/lib/python\d\.\d+/.*",
        ]
    )
    # shows a file, cleans up absolute path to a file
    file_capture = attrib(default="(.*)")
    # above this value mongomon starts working
    low_watermark_us = attrib(default=5000)
    # above this value mongomon flags as alert
    high_watermark_us = attrib(default=40000)
    # customize how mongodb query looks like before printing to screen
    query_filter = attrib(default=identity)
    # want to print to something else? replace this
    print_fn = attrib(default=print_)
    # want shorter stack traces? customize this
    stack_preprocess = attrib(default=trim_last)

Thanks:

To all Contributors - you make this happen, thanks!

Copyright

Copyright (c) 2019 @jondot. See LICENSE for further details.

Download files

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

Source Distribution

mongomon-0.0.3.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

mongomon-0.0.3-py2.py3-none-any.whl (4.3 kB view details)

Uploaded Python 2Python 3

File details

Details for the file mongomon-0.0.3.tar.gz.

File metadata

  • Download URL: mongomon-0.0.3.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.12 CPython/3.7.2 Darwin/18.2.0

File hashes

Hashes for mongomon-0.0.3.tar.gz
Algorithm Hash digest
SHA256 9b48855e70cce0934ce3980b407e6d865253f0b5dcedd8e1b78a5e2aa9af3fa5
MD5 c0f0ac8397a8c8d5971fc2f3931191b4
BLAKE2b-256 284c6a1f1d89d786675e6ad69b513cd6a81868b077dd1b17960b863e6b8fe05a

See more details on using hashes here.

File details

Details for the file mongomon-0.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: mongomon-0.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.12 CPython/3.7.2 Darwin/18.2.0

File hashes

Hashes for mongomon-0.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 158593a0119659db5a492dbd6169a816be5c0204365f54b18f2aca2acb1225f2
MD5 87271a57f4939e7b62fd471c5510707d
BLAKE2b-256 4fcc9e3c8847892adc81b0226385cc9a9fe5114c0be174f0547977bdfa706dbb

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 Sentry Error logging StatusPage Status page