# 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
```
Release files for flake8-prometheus-metrics-name 0.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 | |
|---|---|---|---|
| flake8-prometheus-metrics-name-0.1.2.tar.gz | 3.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flake8_prometheus_metrics_name-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.4 kB
Release files / flake8-prometheus-metrics-name-0.1.2.tar.gz
| Download URL | flake8-prometheus-metrics-name-0.1.2.tar.gz |
|---|---|
| Size | 3.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
afa697cd9d47a41aa9ca4f89599127e9c03a0c1cfca5b7879242882becf44fc4
|
|
BLAKE2b-256 checksum How to use checksums |
79434f12674a033e5e74e9d7214ae3f5315721ef642f8a7301b38b83c5301454
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/5.4.0-28-generic
|
Release files / flake8_prometheus_metrics_name-0.1.2-py3-none-any.whl
| Download URL | flake8_prometheus_metrics_name-0.1.2-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e4da9349a837f3f0f99c70986c2d7a04fd062afbc0c746ed89ed5817de45d25d
|
|
BLAKE2b-256 checksum How to use checksums |
c09749e54150dd5b0c2f6ee08223e5f09d676cd4061b540a7a8bcc6ee0067e5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.5 CPython/3.8.2 Linux/5.4.0-28-generic
|