Skip to content

feat: migrate Python monitoring components to TypeScript/Bun#23

Closed
NikolayS wants to merge 5 commits into
mainfrom
claude/add-python-monitoring-N0sKt
Closed

feat: migrate Python monitoring components to TypeScript/Bun#23
NikolayS wants to merge 5 commits into
mainfrom
claude/add-python-monitoring-N0sKt

Conversation

@NikolayS

Copy link
Copy Markdown
Contributor

No description provided.

This commit migrates the Flask backend and reporter from Python to
TypeScript/Bun, achieving feature parity with the original implementation.

Changes:
- Add cli/lib/metrics-server.ts: TypeScript port of Flask backend with
  endpoints for PGSS metrics, btree bloat, and table stats (CSV export)
- Add cli/lib/reporter.ts: TypeScript port of reporter with support for
  generating A002-H002 check reports from Prometheus metrics
- Add comprehensive tests for both components (69 tests for metrics-server
  and reporter with 95-98% coverage)
- Add tests for Flask backend (52 tests, 99% coverage) - useful during
  transition period
- Add Dockerfiles for both TypeScript components

The TypeScript versions use the existing CLI patterns and can run with Bun.
Remove the Python Flask backend and reporter, keeping only the TypeScript
implementations. The JSON schemas in reporter/schemas/ are retained as
they define the report format contract used by CLI tests.

Removed:
- monitoring_flask_backend/ (Python Flask backend)
- reporter/*.py (Python reporter code)
- reporter/Dockerfile
- tests/monitoring_flask_backend/ (Python tests)
- tests/reporter/ (Python tests)

Retained:
- reporter/schemas/*.json (JSON schema files for report validation)
Explicitly set PGAI_API_KEY to empty string in isolatedEnv() helper
to prevent API key leakage from parent environment during tests.
- Update .gitlab-ci.yml to use TypeScript Dockerfiles instead of Python
- Remove reporter:tests job (Python tests no longer exist)
- Replace monitoring-flask-backend with metrics-server in CI builds
- Update docker-compose files to use metrics-server service
- Update Helm templates: rename flask to metrics-server
- Update Grafana dashboards to use metrics-server container name
- Update documentation (README, CONTRIBUTING) for new service names
- Add test isolation: afterEach cleanup in init.test.ts
- Install curl in metrics-server Dockerfile for healthcheck
@NikolayS NikolayS closed this Jan 2, 2026
@NikolayS NikolayS deleted the claude/add-python-monitoring-N0sKt branch January 2, 2026 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants