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
```bash
pip install flake8-prometheus-metrics-name
```
## Usage
Imagine we have python module `some_module.py`:
```python
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`:
```buildoutcfg
[flake8]
prometheus-metrics-name-prefixes =
kek_
lol_
```
Run flake8 `flake8 some_modue.py` cause following warnings:
```bash
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
```
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
Close
Hashes for flake8-prometheus-metrics-name-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | afa697cd9d47a41aa9ca4f89599127e9c03a0c1cfca5b7879242882becf44fc4 |
|
MD5 | b44776146325ed26a9511cd2c2a7ae7e |
|
BLAKE2b-256 | 79434f12674a033e5e74e9d7214ae3f5315721ef642f8a7301b38b83c5301454 |
Close
Hashes for flake8_prometheus_metrics_name-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4da9349a837f3f0f99c70986c2d7a04fd062afbc0c746ed89ed5817de45d25d |
|
MD5 | f735e7a8bbd90bc4b150fc6479fdeac0 |
|
BLAKE2b-256 | c09749e54150dd5b0c2f6ee08223e5f09d676cd4061b540a7a8bcc6ee0067e5e |