A typed reader for MongoDB FTDC metric archives
Project description
pymongoftdc
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43229a5327f9533797ae8a9bead92aeb588c187405c8953f40ac789a7bf8d61b
|
|
| MD5 |
0d562d10f3f7c969d4cfc26349af9223
|
|
| BLAKE2b-256 |
350c9cc94264ddd73561a4ea375a585ed4acf32af1b9878436e142999ec17f55
|
Provenance
The following attestation bundles were made for pymongoftdc-0.1.0.tar.gz:
Publisher:
publish.yml on zhangyaoxing/pyftdc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymongoftdc-0.1.0.tar.gz -
Subject digest:
43229a5327f9533797ae8a9bead92aeb588c187405c8953f40ac789a7bf8d61b - Sigstore transparency entry: 2009861377
- Sigstore integration time:
-
Permalink:
zhangyaoxing/pyftdc@6d0c33f1ab867a02a0318eda29acd226e32685f2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/zhangyaoxing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6d0c33f1ab867a02a0318eda29acd226e32685f2 -
Trigger Event:
release
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd35ddf9732db28157fc168307b1356ee692f89d3d0f11e4bdd2eab53b726c8f
|
|
| MD5 |
512b87244a7d85f962ba35067c907474
|
|
| BLAKE2b-256 |
cf439fec1318c893592432c36422d84a784eeb89091021c25c2c5f44c209732a
|
Provenance
The following attestation bundles were made for pymongoftdc-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on zhangyaoxing/pyftdc
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pymongoftdc-0.1.0-py3-none-any.whl -
Subject digest:
cd35ddf9732db28157fc168307b1356ee692f89d3d0f11e4bdd2eab53b726c8f - Sigstore transparency entry: 2009861417
- Sigstore integration time:
-
Permalink:
zhangyaoxing/pyftdc@6d0c33f1ab867a02a0318eda29acd226e32685f2 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/zhangyaoxing
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6d0c33f1ab867a02a0318eda29acd226e32685f2 -
Trigger Event:
release
-
Statement type: