Logging prometheus
Poetry plugin to set package version based on git tag.
Functionality
- Logs handler, creating metrics
- Setup labels
Quick start
install:
pip install logs-prometheus
usage:
import logging
from logging_prometheus.handlers import PrometheusHandler
logger = logging.getLogger()
logger.addHandler(PrometheusHandler('python_logging_', ['name', 'levelname', 'module']))
# or
# from logging_prometheus import setup_prometheus_handler_for_root
# setup_prometheus_handler_for_root()
logger = logging.getLogger('app')
logger.debug('debug')
logger.info('info')
logger.warning('warning')
logger.error('error')
Django setup
LOGGING = {
...
"handlers": {
"prometheus": {
"class": "logging_prometheus.PrometheusHandler",
"prefix": "python_logging_",
"labels": ["name", "levelname", "module"],
},
...
},
"loggers": {
"django": {
"handlers": ["prometheus", ...],
"level": "DEBUG",
"propagate": True,
},
...
},
...
}
Labels
The handler supports all values that are in the log object. more details: https://docs.python.org/3/library/logging.html#logging.LogRecord
Contribute
Issue Tracker: https://gitlab.com/rocshers/python/logs-prometheus/-/issues
Source Code: https://gitlab.com/rocshers/python/logs-prometheus
Before adding changes:
make install-dev
After changes:
make format test
Metadata
Release files for logs-prometheus 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logs_prometheus-1.1.2.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logs_prometheus-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.7 kB
Release files / logs_prometheus-1.1.2.tar.gz
| Download URL | logs_prometheus-1.1.2.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea1207af9ebd1eb8934075fc446b593dc693f1f6ae0470456d65fab978dfc52a
|
|
BLAKE2b-256 checksum How to use checksums |
fdbea70ec5b01e3cc5f33df25b21747e7b12be8280eaf8df3aa37da641577ff6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-97-generic
|
Release files / logs_prometheus-1.1.2-py3-none-any.whl
| Download URL | logs_prometheus-1.1.2-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
49b563bc3b71e64db6e376612946c94fa67129cf46a82df561e16d35d65a5529
|
|
BLAKE2b-256 checksum How to use checksums |
1ebd1fb344ddb71e5b6ea414b7606231d2d2e5f79adc59ea63779073a92aa3dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-97-generic
|