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.

Metadata

Release files for mongomon 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mongomon 0.0.2
File Size Uploaded Provenance Actions
mongomon-0.0.2.tar.gz 4.2 kB Without provenance Details for mongomon-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mongomon 0.0.2
File Interpreter ABI Platform Actions
mongomon-0.0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for mongomon-0.0.2-py2.py3-none-any.whl

Total release size: 8.6 kB

Release files / mongomon-0.0.2.tar.gz

Download URL mongomon-0.0.2.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9544e3dbb5a016ccc975bc8103f55d5812e9cd905c933a85e47077591e92c464
BLAKE2b-256 checksum
How to use checksums
1eff6e090bc815c51fe088e4cbae2c69ef732938e6e042f17002e558d7fbbd9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.12 CPython/3.7.2 Darwin/18.2.0

Release files / mongomon-0.0.2-py2.py3-none-any.whl

Download URL mongomon-0.0.2-py2.py3-none-any.whl
Size 4.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
455cfeec8dfff6a82aac1df0d589de264423a90784e15d8e9c38d097e6a45550
BLAKE2b-256 checksum
How to use checksums
df1c7d97577764e0d36dc24e179cbe49e8d56b4902b38ad387b13b79aa6a56f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/0.12.12 CPython/3.7.2 Darwin/18.2.0

Security for mongomon 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page