Skip to content

feat(test): deterministic async memory and connection pool profiler (devops test profile-memory) #199

Closed

Description

@dan-petty

Description & Architectural Objectives

Implement a deterministic async memory and connection pool profiler under devops test profile-memory as specified in the v0.2.17 roadmap:

  1. Diagnostic Memory Profiling (devops test profile-memory):
    • Leverage Python tracemalloc to snapshot, measure, and analyze heap allocations.
    • Profile memory across configurable targets: fastmcp server tools, http-pool async client connections, custom CLI commands, or arbitrary Python modules/callables.
    • Track peak memory usage, net allocated delta, top allocation source lines, and object counts.
  2. Socket Lifecycle & Connection Pool Leak Detection:
    • Inspect active socket descriptors and connection broker states to assert proper socket closing and connection recycling.
    • Detect leaked socket instances, unclosed streams, and unbounded connection pool growth.
  3. Threshold Guardrails & Reporting:
    • Enforce configurable peak memory thresholds (--max-peak-mb) and socket leak thresholds (--fail-on-leak).
    • Rich tabular display and structured JSON export (--json, --output).
  4. Architectural Invariants & Quality Standards:
    • Cyclomatic complexity $\le 10$ and maximum nesting depth $\le 5$ project-wide.
    • Unit test coverage $\ge 90%$.
    • Bounded string truncation on all error details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p2-mediumtype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions