v0.18.0

sleep3r/mtproto.zigv0.18.0Apr 15, 2026by sleep3r

Upgrading?

AI Summary

Introduces built-in Prometheus metrics for monitoring and migrates the dashboard dependency manager to `uv` to resolve compatibility issues with newer Python environments.

Key Highlights

  • New Prometheus `/metrics` endpoint with global, per-user, and cgroup metrics.
  • Includes ready-to-use Grafana dashboard and Docker Compose stack.
  • Dashboard installation now works on Debian 12+ and Ubuntu 23.04+.

New Features

  • Prometheus metrics endpoint (C2S/S2C bytes, connections, process stats).
  • Migration of Python dependency management from pip3 to uv.
  • Isolated virtualenv for dashboard dependencies.

Full Release Notes

### 🇷🇺 Что нового (RU)

**Что решает этот релиз**

- Встроенный Prometheus-эндпоинт — мониторинг прокси без парсинга логов и внешних экспортёров.
- Установка дашборда больше не ломается на Debian 12+ / Ubuntu 23.04+ из-за PEP 668 (`externally-managed-environment`).

**Что изменено**

- **Prometheus `/metrics` endpoint** (#179)
  - Новая секция `[metrics]` в `config.toml` (`enabled`, `host`, `port`).
  - Прокси поднимает отдельный HTTP-listener и отдаёт метрики в Prometheus text format.
  - Глобальные метрики: активные подключения, handshakes in flight, accepted/closed totals, drop-счётчики, трафик (C2S/S2C bytes).
  - Per-user метрики: `mtproto_user_connections_active`, `mtproto_user_*_bytes_total` — по настроенным пользователям.
  - Метрики процесса: RSS, VSZ, CPU, open FDs.
  - cgroup-метрики (опциональные): `mtproto_cgroup_memory_usage_bytes`, `mtproto_cgroup_memory_limit_bytes` — для Docker/контейнеров.
  - Готовый Grafana-дашборд (`hack/docker/grafana-dashboard.json`) + Docker Compose стек (Prometheus + Grafana).
  - Документация в `hack/docker/README.md`.

- **Dashboard: pip3 → uv** (#185, #189)
  - `pip3 install` заменён на [`uv`](https://github.com/astral-sh/uv) — быстрый менеджер Python-пакетов.
  - Зависимости ставятся в изолированный virtualenv (`/opt/mtproto-proxy/monitor/.venv`), а не в системный Python.
  - Если `uv` не установлен — скачивается автоматически через официальный `astral.sh/uv/install.sh`.
  - Systemd-сервис `proxy-monitor` теперь запускает `server.py` через `.venv/bin/python`.
  - Убрана зависимость от `python3-pip`.

> [!IMPORTANT]
> Для обновления дашборда на существующих серверах:
> ```bash
> sudo mtbuddy update          # обновить бинарь
> sudo mtbuddy setup dashboard # переустановить дашборд (создаст venv через uv)
> ```

---

### 🇬🇧 Release notes (EN)

**What this release addresses**

- Built-in Prometheus metrics — monitor the proxy without log parsing or external exporters.
- Dashboard installation no longer breaks on Debian 12+ / Ubuntu 23.04+ due to PEP 668 (`externally-managed-environment`).

**What changed**

- **Prometheus `/metrics` endpoint** (#179)
  - New `[metrics]` config section (`enabled`, `host`, `port`).
  - The proxy starts a dedicated HTTP listener serving metrics in Prometheus text format.
  - Global metrics: active connections, handshakes in flight, accepted/closed totals, drop counters, C2S/S2C traffic bytes.
  - Per-user metrics: `mtproto_user_connections_active`, `mtproto_user_*_bytes_total` — keyed by configured users.
  - Process metrics: RSS, VSZ, CPU seconds, open/max FDs.
  - Optional cgroup metrics: `mtproto_cgroup_memory_usage_bytes`, `mtproto_cgroup_memory_limit_bytes` — appear automatically in containers.
  - Ready-to-import Grafana dashboard (`hack/docker/grafana-dashboard.json`) + Docker Compose stack (Prometheus + Grafana).
  - Docs at `hack/docker/README.md`.

- **Dashboard: pip3 → uv** (#185, #189)
  - Replaced `pip3 install` with [`uv`](https://github.com/astral-sh/uv) for Python dependency management.
  - Dependencies are installed into an isolated virtualenv (`/opt/mtproto-proxy/monitor/.venv`) instead of the system Python.
  - If `uv` is not present, it is bootstrapped automatically via the official `astral.sh/uv/install.sh` installer.
  - The `proxy-monitor` systemd service now runs `server.py` via `.venv/bin/python`.
  - Removed `python3-pip` prerequisite.

> [!IMPORTANT]
> To update the dashboard on existing servers:
> ```bash
> sudo mtbuddy update          # update the binary
> sudo mtbuddy setup dashboard # redeploy dashboard (creates venv via uv)
> ```

---

### Changelog

- feat: Metrics endpoint (#179) (6cc6674)
- feat(dashboard): replace pip3 with uv for dependency management (#189, closes #185) (83614bc)

Related Repositories