Flake8 plugin for prometheus metric name validation
Project description
Flake8 prometheus metric name plugin
Flake8 plugin to check metrics name prefix for official client https://github.com/prometheus/client_python.
Installation
pip install flake8-prometheus-metrics-name
Usage
Imagine we have python module some_module.py:
from prometheus_client import Counter
Counter(name='kek_values', documentation='some doc')
Counter(name='some_name1', documentation='some doc')
Counter(name='some_name2', documentation='some doc') # noqa: PRM902
Counter(name='some_name3', documentation='some doc')
Counter(name='lol_values', documentation='some doc')
Add valid metrics name prefixes to setup.cfg:
[flake8]
prometheus-metrics-name-prefixes =
kek_
lol_
Run flake8 flake8 some_modue.py cause following warnings:
some_module.py:4:1: PRM902: Metric name should start with one of following prefixes: "kek_", "lol_", got "some_name1" instead
some_module.py:6:1: PRM902: Metric name should start with one of following prefixes: "kek_", "lol_", got "some_name3" instead
Plugin also may be disabled by adding following option to setup.cfg:
[flake8]
prometheus-metrics-disabled = 1
then AST nodes will not be analized for metrics name on flake8 run.
License
MIT
Project details
Release history Release notifications | RSS feed
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 flake8_prometheus_metrics_name-0.1.14.tar.gz.
File metadata
- Download URL: flake8_prometheus_metrics_name-0.1.14.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.12.3 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e54c67ca82858160835017a7a84c67600a81fde905af4d37918284907e357b6
|
|
| MD5 |
461d3e71f274e633467009b8dc8f1995
|
|
| BLAKE2b-256 |
1a359c10422bbffabe518d5cbfad5a3befba3f136179836129f9f19fb5840696
|
File details
Details for the file flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl.
File metadata
- Download URL: flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.6.1 CPython/3.12.3 Darwin/24.1.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef36b28e7dcf9bc22c07b0c40590c7067944d999c505723aeabc745f9426253b
|
|
| MD5 |
f908c3775b008a4f1712c6bbb398747e
|
|
| BLAKE2b-256 |
2fb30ba525cf94ee8fe6f6e114d9dfe26a45d1337936dad54d0e7eb5f0ae72ca
|