# Prometheus Logging
A simple logging library for ML projects using Prometheus.
## Installation
```bash
pip install prometheus_logging
```
## Usage
```python
from prometheus_logging import init_logging, log_model_loss, start_metrics_server
import threading
# Initialize logging
init_logging(
project="my_project",
config={"batch_size": 32, "learning_rate": 0.001},
notes="Training run",
name="experiment_1",
fake_gpu=True
)
# Start metrics server in a separate thread
threading.Thread(target=start_metrics_server, daemon=True).start()
# In your training loop
for epoch in range(num_epochs):
for batch in dataloader:
# ... training logic ...
loss = model(batch)
log_model_loss(loss.item())
# Make sure Prometheus is configured to scrape metrics from `localhost:8000`.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/prometheus_logging",
"name": "prometheus-logging",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Your Name",
"author_email": "your.email@example.com",
"download_url": "https://files.pythonhosted.org/packages/8a/83/02f91aacaf951e66a303f9d7cd5f4846face72ac9542feda385665eabca3/prometheus_logging-0.1.0.tar.gz",
"platform": null,
"description": "# Prometheus Logging\n\nA simple logging library for ML projects using Prometheus.\n\n## Installation\n\n```bash\npip install prometheus_logging\n```\n\n## Usage\n```python\nfrom prometheus_logging import init_logging, log_model_loss, start_metrics_server\nimport threading\n\n# Initialize logging\ninit_logging(\nproject=\"my_project\",\nconfig={\"batch_size\": 32, \"learning_rate\": 0.001},\nnotes=\"Training run\",\nname=\"experiment_1\",\nfake_gpu=True\n)\n\n# Start metrics server in a separate thread\nthreading.Thread(target=start_metrics_server, daemon=True).start()\n\n# In your training loop\nfor epoch in range(num_epochs):\nfor batch in dataloader:\n# ... training logic ...\nloss = model(batch)\nlog_model_loss(loss.item())\n\n# Make sure Prometheus is configured to scrape metrics from `localhost:8000`.\n```\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple logging library for ML projects using Prometheus",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/yourusername/prometheus_logging"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8a8302f91aacaf951e66a303f9d7cd5f4846face72ac9542feda385665eabca3",
"md5": "a4f52b8c27a69646694a12b51532caf2",
"sha256": "e2850a69bbe113c06fa08ad873e974b31432559a5329b1d6d7c4770ddad11596"
},
"downloads": -1,
"filename": "prometheus_logging-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "a4f52b8c27a69646694a12b51532caf2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 3201,
"upload_time": "2024-09-23T16:26:43",
"upload_time_iso_8601": "2024-09-23T16:26:43.303384Z",
"url": "https://files.pythonhosted.org/packages/8a/83/02f91aacaf951e66a303f9d7cd5f4846face72ac9542feda385665eabca3/prometheus_logging-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-23 16:26:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "prometheus_logging",
"github_not_found": true,
"lcname": "prometheus-logging"
}