Skip to content

Add database size and storage metrics to health command #9

@roeimichael

Description

@roeimichael

Problem

The health command shows event and snapshot counts but not the database file size, per-table row counts, or schema version. Users with long retention periods have no visibility into how much disk space CAT is consuming.

What to do

Enhance the /api/health endpoint and CLI health command to include:

  1. Database file sizePath(db_path).stat().st_size (format as human-readable KB/MB)
  2. Per-table row counts — use the existing get_table_counts() from src/context_analyzer_tool/db/maintenance.py
  3. Schema version — use get_schema_version() from src/context_analyzer_tool/db/schema.py

Files to look at

  • src/context_analyzer_tool/collector/routes.py/api/health endpoint
  • src/context_analyzer_tool/collector/models.pyHealthResponse model (add fields)
  • src/context_analyzer_tool/cli.pyhealth command output
  • src/context_analyzer_tool/db/maintenance.pyget_table_counts() already exists

Why this is a good first issue

Uses existing helper functions — just wire them into the health response and display. Small, well-scoped change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions