Skip to main content

Flake8 plugin for prometheus metric name validation

Project description

# Flake8 prometheus metric name plugin

Flake8 plugin to check metrics name prefix for official client

## Installation
pip install flake8-prometheus-metrics-name

## Usage
Imagine we have python module ``:
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`:
prometheus-metrics-name-prefixes =

Run flake8 `flake8` cause following warnings:
```bash PRM902: Metric name should start with one of following prefixes: "kek_", "lol_", got "some_name1" instead 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`:
prometheus-metrics-disabled = 1
then AST-tree nodes will not be analized for metrics name on flake8 run.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for flake8-prometheus-metrics-name, version 0.1.3
Filename, size File type Python version Upload date Hashes
Filename, size flake8_prometheus_metrics_name-0.1.3-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size flake8-prometheus-metrics-name-0.1.3.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page