Skip to main content

Flake8 prometheus metric name plugin

pypi Python: 3.6+ License: MIT Code style: black

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

Metadata

Release files for flake8-prometheus-metrics-name 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8-prometheus-metrics-name 0.1.14
File Size Uploaded
flake8_prometheus_metrics_name-0.1.14.tar.gz 4.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8-prometheus-metrics-name 0.1.14
File Interpreter ABI Platform
flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 9.5 kB

Release files / flake8_prometheus_metrics_name-0.1.14.tar.gz

Download URL flake8_prometheus_metrics_name-0.1.14.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9e54c67ca82858160835017a7a84c67600a81fde905af4d37918284907e357b6
BLAKE2b-256 checksum
How to use checksums
1a359c10422bbffabe518d5cbfad5a3befba3f136179836129f9f19fb5840696
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.12.3 Darwin/24.1.0

Release files / flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl

Download URL flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ef36b28e7dcf9bc22c07b0c40590c7067944d999c505723aeabc745f9426253b
BLAKE2b-256 checksum
How to use checksums
2fb30ba525cf94ee8fe6f6e114d9dfe26a45d1337936dad54d0e7eb5f0ae72ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.12.3 Darwin/24.1.0

Release history Release notifications | RSS feed

This release

0.1.14 This release

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page