flake8-prometheus-metrics-name


Nameflake8-prometheus-metrics-name JSON
Version 0.1.14 PyPI version JSON
download
home_pagehttps://github.com/perminovs/flake8_prometheus_metrics_name
SummaryFlake8 plugin for prometheus metric name validation
upload_time2024-11-27 21:19:06
maintainerNone
docs_urlNone
authorperminovs
requires_python<4.0,>=3.9.0
licenseMIT
keywords flake8 linter python prometheus
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flake8 prometheus metric name plugin


[![pypi](https://badge.fury.io/py/flake8-prometheus-metrics-name.svg)](https://pypi.org/project/flake8-prometheus-metrics-name/)
[![Python: 3.6+](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://pypi.org/project/flake8-breakpoint)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)

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
```

Plugin also may be disabled by adding following option to `setup.cfg`:
```buildoutcfg
[flake8]
prometheus-metrics-disabled = 1
```
then AST nodes will not be analized for metrics name on flake8 run.

## License
MIT

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/perminovs/flake8_prometheus_metrics_name",
    "name": "flake8-prometheus-metrics-name",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9.0",
    "maintainer_email": null,
    "keywords": "flake8, linter, python, prometheus",
    "author": "perminovs",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/1a/35/9c10422bbffabe518d5cbfad5a3befba3f136179836129f9f19fb5840696/flake8_prometheus_metrics_name-0.1.14.tar.gz",
    "platform": null,
    "description": "# Flake8 prometheus metric name plugin\n\n\n[![pypi](https://badge.fury.io/py/flake8-prometheus-metrics-name.svg)](https://pypi.org/project/flake8-prometheus-metrics-name/)\n[![Python: 3.6+](https://img.shields.io/badge/Python-3.6+-blue.svg)](https://pypi.org/project/flake8-breakpoint)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://en.wikipedia.org/wiki/MIT_License)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\nFlake8 plugin to check metrics name prefix for official client https://github.com/prometheus/client_python.\n\n## Installation\n```bash\npip install flake8-prometheus-metrics-name\n```\n\n## Usage\nImagine we have python module `some_module.py`:\n```python\nfrom prometheus_client import Counter\n\nCounter(name='kek_values', documentation='some doc')\nCounter(name='some_name1', documentation='some doc')\nCounter(name='some_name2', documentation='some doc')  # noqa: PRM902\nCounter(name='some_name3', documentation='some doc')\nCounter(name='lol_values', documentation='some doc')\n```\n\nAdd valid metrics name prefixes to `setup.cfg`:\n```buildoutcfg\n[flake8]\nprometheus-metrics-name-prefixes =\n    kek_\n    lol_\n```\n\nRun flake8 `flake8 some_modue.py` cause following warnings:\n```bash\nsome_module.py:4:1: PRM902: Metric name should start with one of following prefixes: \"kek_\", \"lol_\", got \"some_name1\" instead\nsome_module.py:6:1: PRM902: Metric name should start with one of following prefixes: \"kek_\", \"lol_\", got \"some_name3\" instead\n```\n\nPlugin also may be disabled by adding following option to `setup.cfg`:\n```buildoutcfg\n[flake8]\nprometheus-metrics-disabled = 1\n```\nthen AST nodes will not be analized for metrics name on flake8 run.\n\n## License\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Flake8 plugin for prometheus metric name validation",
    "version": "0.1.14",
    "project_urls": {
        "Homepage": "https://github.com/perminovs/flake8_prometheus_metrics_name",
        "Repository": "https://github.com/perminovs/flake8_prometheus_metrics_name"
    },
    "split_keywords": [
        "flake8",
        " linter",
        " python",
        " prometheus"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2fb30ba525cf94ee8fe6f6e114d9dfe26a45d1337936dad54d0e7eb5f0ae72ca",
                "md5": "f908c3775b008a4f1712c6bbb398747e",
                "sha256": "ef36b28e7dcf9bc22c07b0c40590c7067944d999c505723aeabc745f9426253b"
            },
            "downloads": -1,
            "filename": "flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f908c3775b008a4f1712c6bbb398747e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9.0",
            "size": 5391,
            "upload_time": "2024-11-27T21:19:05",
            "upload_time_iso_8601": "2024-11-27T21:19:05.138326Z",
            "url": "https://files.pythonhosted.org/packages/2f/b3/0ba525cf94ee8fe6f6e114d9dfe26a45d1337936dad54d0e7eb5f0ae72ca/flake8_prometheus_metrics_name-0.1.14-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a359c10422bbffabe518d5cbfad5a3befba3f136179836129f9f19fb5840696",
                "md5": "461d3e71f274e633467009b8dc8f1995",
                "sha256": "9e54c67ca82858160835017a7a84c67600a81fde905af4d37918284907e357b6"
            },
            "downloads": -1,
            "filename": "flake8_prometheus_metrics_name-0.1.14.tar.gz",
            "has_sig": false,
            "md5_digest": "461d3e71f274e633467009b8dc8f1995",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9.0",
            "size": 4128,
            "upload_time": "2024-11-27T21:19:06",
            "upload_time_iso_8601": "2024-11-27T21:19:06.243813Z",
            "url": "https://files.pythonhosted.org/packages/1a/35/9c10422bbffabe518d5cbfad5a3befba3f136179836129f9f19fb5840696/flake8_prometheus_metrics_name-0.1.14.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-27 21:19:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "perminovs",
    "github_project": "flake8_prometheus_metrics_name",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "tox": true,
    "lcname": "flake8-prometheus-metrics-name"
}
        
Elapsed time: 2.07461s