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
Close
Hashes for flake8_prometheus_metrics_name-0.1.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e85d82936a96d12de7cd01822eaa7c5f4b79e8c6b4c7e9fa4ab5d55207bcad29 |
|
MD5 | 1cd6654536ac2a413c6b20137c5cbb16 |
|
BLAKE2b-256 | 3d1e30e438945c3ddb0d994cfd656af2ee93de2e5bc510d70db6066798274fd5 |
Close
Hashes for flake8_prometheus_metrics_name-0.1.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 05ef23b6ef8947d0a5bf85cbff34f1ecb09f68103bd6af87dfce52f438d64b5e |
|
MD5 | a3d588a6c0557d60564036eac14f3b4f |
|
BLAKE2b-256 | dee8c4a936de331129e1f0fdfcfe5d82821a0e58e8f8c440fcefbad93682fbf4 |