Vibe coded mlflow to prometheus metrics
- Rust 76.4%
- Nix 12.4%
- Dockerfile 11.2%
| .forgejo/workflows | ||
| src | ||
| .dockerignore | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| Dockerfile | ||
| README.md | ||
| shell.nix | ||
mlflowtoprom
A simple Rust service that receives MLflow metrics and exposes them in Prometheus format.
Usage
-
Send metrics (from TensorFlow/MLflow):
curl -X POST http://localhost:8080/api/v2.0/mlflow/runs/MY_RUN_ID/log-metrics \ -H "Content-Type: application/json" \ -d '{"metrics": [{"key": "accuracy", "value": 0.95, "timestamp": 123, "step": 10}]}' -
Scrape metrics (Prometheus):
curl http://localhost:8080/metricsOutput:
# HELP mlflow_MY_RUN_ID_accuracy Metric from MLflow run MY_RUN_ID # TYPE mlflow_MY_RUN_ID_accuracy gauge mlflow_MY_RUN_ID_accuracy 0.95 -
Health checks (Kubernetes):
curl http://localhost:8080/healthz # Liveness probe curl http://localhost:8080/ready # Readiness probe
Run
cargo run
Server listens on 0.0.0.0:8080.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v2.0/mlflow/runs/{run_id}/log-metrics |
Accept MLflow metrics |
| GET | /metrics |
Prometheus metrics |
| GET | /healthz |
Kubernetes liveness |
| GET | /ready |
Kubernetes readiness |
Docker (optional)
FROM rust:1.70
WORKDIR /app
COPY . .
RUN cargo build --release
CMD ["./target/release/mlflowtoprom"]