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_package.py:4:1: PRM902: Metric name should start with one of following prefixes: "kek_", "lol_", got "some_name1" instead
some_package.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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1acb9af0fdb5279f9136ae5a1542d8e03f67e7c5a7fe1b28edb6a718731eca6d |
|
MD5 | 381dde0f458fee9dfe3e387a2d707c98 |
|
BLAKE2b-256 | 15a4d406b5187c8c652943eb1fa68b393b8605ca28df0f5f01847f8191b3e452 |
Close
Hashes for flake8_prometheus_metrics_name-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c67e4522d5f775950583f0b6c092f9f3c8a8f04cacef2274cfc08fd4f8548816 |
|
MD5 | e48e87812f06c97f26572c1056a78d4b |
|
BLAKE2b-256 | 229fda9844fd76c91e76b885ef5a15d4d892ae6fe870dba88da27a67ef48b9ac |