An easy way to add web metrics to python daemon. Update metrics from main logic in dict shared to extra web python process.
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file web_metrics_process-2026.5.4.tar.gz.
File metadata
- Download URL: web_metrics_process-2026.5.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ff25abb071ace061fb2beb8ff03938da5eec55d04c3e516e02641e33ad6956e
|
|
| MD5 |
56220cbd427d8519119fcd9260165817
|
|
| BLAKE2b-256 |
5b634c18314a74d661f91f1dac55c71c1328d4166a373b5de4e2810253da5097
|
File details
Details for the file web_metrics_process-2026.5.4-py3-none-any.whl.
File metadata
- Download URL: web_metrics_process-2026.5.4-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3db973f4819fb036a403301ad1f6699ae0faed213924e431246c0653e437edbb
|
|
| MD5 |
928eecd97222d6668db17f1f49c13c9e
|
|
| BLAKE2b-256 |
281387c07fc24fa2b5c2cb088660066e3ad4f9c522022100aec9c18de3944119
|