mdbkit 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {mdbkit-0.2.0/mdbkit.egg-info → mdbkit-0.2.1}/PKG-INFO +54 -3
  2. mdbkit-0.2.0/PKG-INFO → mdbkit-0.2.1/README.md +604 -577
  3. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/__init__.py +1 -1
  4. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/cli.py +73 -5
  5. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/ftdc.py +263 -75
  6. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/rebuild.py +23 -9
  7. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/triage.py +10 -4
  8. mdbkit-0.2.0/README.md → mdbkit-0.2.1/mdbkit.egg-info/PKG-INFO +628 -553
  9. {mdbkit-0.2.0 → mdbkit-0.2.1}/pyproject.toml +1 -1
  10. {mdbkit-0.2.0 → mdbkit-0.2.1}/tests/test_ftdc.py +54 -0
  11. {mdbkit-0.2.0 → mdbkit-0.2.1}/tests/test_rebuild_report.py +35 -0
  12. {mdbkit-0.2.0 → mdbkit-0.2.1}/LICENSE +0 -0
  13. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/advisor.py +0 -0
  14. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/analysis.py +0 -0
  15. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/explain.py +0 -0
  16. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/filtering.py +0 -0
  17. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/parser.py +0 -0
  18. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/render.py +0 -0
  19. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/report.py +0 -0
  20. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit/scripts.py +0 -0
  21. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit.egg-info/SOURCES.txt +0 -0
  22. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit.egg-info/dependency_links.txt +0 -0
  23. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit.egg-info/entry_points.txt +0 -0
  24. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit.egg-info/requires.txt +0 -0
  25. {mdbkit-0.2.0 → mdbkit-0.2.1}/mdbkit.egg-info/top_level.txt +0 -0
  26. {mdbkit-0.2.0 → mdbkit-0.2.1}/setup.cfg +0 -0
  27. {mdbkit-0.2.0 → mdbkit-0.2.1}/tests/test_explain.py +0 -0
  28. {mdbkit-0.2.0 → mdbkit-0.2.1}/tests/test_mdbkit.py +0 -0
  29. {mdbkit-0.2.0 → mdbkit-0.2.1}/tests/test_triage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdbkit
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: Offline toolkit for MongoDB 4.4+ structured logs: log analysis, slow-query shapes, connection churn, and deterministic index advice. A spiritual successor to mtools' log tools.
5
5
  Author: Saqib Ameen Subhan
6
6
  License: MIT
@@ -295,7 +295,7 @@ query with different parameters is counted once.
295
295
  | `--limit N` | all | Show only the top N shapes |
296
296
  | `--min-ms N` | 0 | Ignore operations faster than N milliseconds |
297
297
  | `--include-system` | off | Include internal `admin`/`config`/`local` namespaces (hidden by default — they are server housekeeping, not your workload) |
298
- | `--report FILE` | | Write a shareable `.md` or `.html` report instead |
298
+ | `--report FILE` | | Write a shareable `.md` or `.html` report instead (see [Shareable reports](#shareable-reports----report-file)) |
299
299
  | `--json` | | Machine-readable output |
300
300
 
301
301
  **Reading the columns:**
@@ -500,11 +500,21 @@ not encrypted; mdbkit decodes it offline.
500
500
 
501
501
  | Option | Default | Description |
502
502
  |---|---|---|
503
+ | `--last DURATION` | `4h` | Analyze only the most recent window — `90m`, `4h`, `2d` |
504
+ | `--all` | off | Analyze the entire history (see the performance note below) |
503
505
  | `--metric LABEL` | all | Restrict to one metric (repeatable), e.g. `--metric conns.current` |
504
506
  | `--step SECONDS` | 60 | Timeline bucket size |
505
- | `--from` / `--to` | | Time bounds (same formats as `filter`) |
507
+ | `--from` / `--to` | | Explicit time bounds (same formats as `filter`) |
506
508
  | `--json` | | Machine-readable output |
507
509
 
510
+ **Performance note.** `diagnostic.data` can hold weeks of per-second samples —
511
+ a few hundred megabytes covering thousands of chunks and several thousand
512
+ metrics each. Decoding all of it is CPU-bound and takes minutes, so these
513
+ commands **default to the last 4 hours** and skip older chunks before
514
+ decompressing them. On a 250 MB directory that is the difference between about
515
+ a second and about a minute. Use `--last`/`--from`/`--to` to move the window,
516
+ and `--all` when you really do want the whole history.
517
+
508
518
  ```bash
509
519
  mdbkit ftdc summary /var/lib/mongodb/diagnostic.data
510
520
  mdbkit ftdc timeline diagnostic.data --metric conns.current --step 300
@@ -521,6 +531,47 @@ contains metrics only, never document contents.
521
531
 
522
532
  ---
523
533
 
534
+ ### Shareable reports — `--report FILE`
535
+
536
+ `triage` and `queries` can write a self-contained report instead of printing to
537
+ the terminal — for a ticket, a handover, or a post-incident review.
538
+
539
+ ```bash
540
+ mdbkit triage mongod.log --report incident.html # styled, self-contained
541
+ mdbkit triage mongod.log --report incident.md # for tickets and PRs
542
+ mdbkit queries mongod.log --limit 20 --report slow-queries.md
543
+ ```
544
+
545
+ The format follows the file extension: `.html` or `.md`.
546
+
547
+ Markdown output looks like this:
548
+
549
+ ```markdown
550
+ # MongoDB incident triage
551
+
552
+ *window 2026-07-01 08:10 -> 09:10 · generated 2026-07-01 09:12*
553
+
554
+ ## Findings
555
+
556
+ - **[CRIT] Replica set instability** — 3 election/stepdown event(s) at 08:41:02, 08:58:14
557
+ - Starting an election, since we've seen no PRIMARY in election timeout period
558
+ - *next:* `Correlate with connection storms and slow checkpoints below`
559
+ - **[WARN] Connection storm** — 2 minute(s) at >= 60 new connections/min; peak 480 at 08:41
560
+ - 10.2.1.7: 312 in the peak minute
561
+ - *next:* `mdbkit connections <log>`
562
+ - **[OK] Errors** — No error/fatal severity lines in window.
563
+ ```
564
+
565
+ The HTML version carries the same content with a dark, print-friendly
566
+ stylesheet. It is **fully self-contained**: inline CSS, no JavaScript, no
567
+ external assets or CDN references, so it opens on an air-gapped machine and
568
+ sends nothing anywhere.
569
+
570
+ Reports contain the same information as the terminal output — query **shapes**
571
+ and metrics, never literal values from your documents.
572
+
573
+ ---
574
+
524
575
  ### `mdbkit export-script {schema|indexes}`
525
576
 
526
577
  Prints a small `mongosh` script to stdout. **mdbkit never connects to your