Metadata-Version: 2.4
Name: web-metrics-process
Version: 2026.5.4
Summary: An easy way to add web metrics to python daemon. Update metrics from main logic in dict shared to extra web python process.
Author-email: itledevs <itledevs@gmail.com>
License-Expression: MIT
Project-URL: Repository, https://github.com/itledevs/web-metrics-process
Project-URL: Source code, https://github.com/itledevs/web-metrics-process
Project-URL: Issue tracker, https://github.com/itledevs/web-metrics-process/issues
Project-URL: Documentation, https://github.com/itledevs/web-metrics-process/wiki
Keywords: web,http,process,metrics
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: fastapi
Requires-Dist: uvicorn

### web-metrics-process
easy way to add web metrics to python daemon. Update metrics from main logic in dict shared to additional python web process
this is designed for linux production systems (you could get issues with spawn process on mac)


```
# install
# pip3 install web-metrics-process
import web_metrics_process as wmp


metrics = wmp.WebMetrics(interface='127.0.0.1', port=8001, web_path='/metrics')
metrics.start()

# metrics.data is a shared dict, beetwen your main process and the web metrics process
# you can put any key/data there, for eaxample let's update name
metrics.data['name'] = 'metrics_producer'
metrics.data['name'] = 'something you want'

# there are already some service fields for convinience
# time_started - start time of python service
# time_alive_last - in each iteration of processing of something you could update alive time to watch by metric is something hanged or waiting resourses or not 
 metrics.update_time_alive()

```

### get metrics by browser or any tool
```
curl -s http://127.0.0.1:8001/metrics | jq .
{
  "time_started": "2026-06-03T14:03:47.397088",
  "time_alive_last": "2026-06-03T14:03:47.583579",
  "time_alive_interval_max": 0,
  "time_alive_ok": null,
  "iteration": 17,
  "name": "metrics_producer",
  "version": null,
  "session_id": "huCfS1YH",
  "data": "something you want"
}
```


### Example is here (simple service based on infinite loop):
src/example_web_metrics_process/metrics_producer.py
