Skip to main content

A typed reader for MongoDB FTDC metric archives

Project description

pymongoftdc

CI Python 3.10+ License: MIT

pymongoftdc reads numeric time-series metrics directly from MongoDB Full-Time Diagnostic Data Capture (FTDC) archive files.

Install

python -m pip install -e .

For development:

python -m pip install -e '.[test]'
pytest

Use

from datetime import datetime, timezone
from pyftdc import FTDCReader

reader = FTDCReader("/var/lib/mongo/diagnostic.data")
metrics = reader.get_metric(
    {"serverStatus.connections.current"},
    start=datetime(2026, 1, 1, tzinfo=timezone.utc),
    end=datetime(2026, 1, 1, 1, tzinfo=timezone.utc),
    sample_rate=0.1,
)
points = metrics["serverStatus.connections.current"]

The source may be one metrics.* file or a diagnostic.data directory. Timespan endpoints are inclusive and must be timezone-aware. Omit start or end to use the earliest or latest timestamp in the source. The result maps each requested name to points ordered by UTC timestamp. Pass an empty set to read every metric. sample_rate must be greater than 0 and at most 1; for example, 0.1 returns approximately 10% of points. Its default is 1.0. query() is an alias for get_metric().

Use reader.list_metrics() to discover dotted metric paths. A missing requested metric raises MetricNotFoundError; an invalid archive raises FTDCDecodeError.

Project layout

src/pyftdc/
  _codec.py       BSON framing and FTDC decompression
  reader.py       public query API
  models.py       returned value objects
  exceptions.py   library-specific errors
tests/             pytest tests and fixture builders

The reader supports BSON-framed type-1 metric chunks using MongoDB's delta/RLE/varint/zlib encoding. Metadata documents are safely skipped.

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

pymongoftdc-0.1.0.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

pymongoftdc-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pymongoftdc-0.1.0.tar.gz.

File metadata

  • Download URL: pymongoftdc-0.1.0.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pymongoftdc-0.1.0.tar.gz
Algorithm Hash digest
SHA256 43229a5327f9533797ae8a9bead92aeb588c187405c8953f40ac789a7bf8d61b
MD5 0d562d10f3f7c969d4cfc26349af9223
BLAKE2b-256 350c9cc94264ddd73561a4ea375a585ed4acf32af1b9878436e142999ec17f55

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymongoftdc-0.1.0.tar.gz:

Publisher: publish.yml on zhangyaoxing/pyftdc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pymongoftdc-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pymongoftdc-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pymongoftdc-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cd35ddf9732db28157fc168307b1356ee692f89d3d0f11e4bdd2eab53b726c8f
MD5 512b87244a7d85f962ba35067c907474
BLAKE2b-256 cf439fec1318c893592432c36422d84a784eeb89091021c25c2c5f44c209732a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pymongoftdc-0.1.0-py3-none-any.whl:

Publisher: publish.yml on zhangyaoxing/pyftdc

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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