nonebot-plugin-prometheus


Namenonebot-plugin-prometheus JSON
Version 0.3.7 PyPI version JSON
download
home_pageNone
Summary为 NoneBot 和其他插件提供 Prometheus 监控支持
upload_time2024-12-30 02:49:26
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseMIT License Copyright (c) 2024 suyiiyii Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords nonebot nonebot-plugin nonebot2 prometheus
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- markdownlint-disable MD033 MD036 MD041 -->

<p align="center">
  <a href="https://github.com/suyiiyii/nonebot-plugin-prometheus"><img src="https://github.com/suyiiyii/nonebot-plugin-prometheus/blob/main/nonebot-plugin-prometheus.png" width="200" height="200" alt="nonebot"></a>
</p>

<div align="center">

# Nonebot Plugin Prometheus

_✨ NoneBot Prometheus 监控插件 ✨_

</div>

<p align="center">
  <a href="https://raw.githubusercontent.com/suyiiyii/nonebot-plugin-prometheus/main/LICENSE">
    <img src="https://img.shields.io/github/license/suyiiyii/nonebot-plugin-prometheus.svg" alt="license">
  </a>
  <a href="https://pypi.python.org/pypi/nonebot-plugin-prometheus">
    <img src="https://img.shields.io/pypi/v/nonebot-plugin-prometheus.svg" alt="pypi">
  </a>
</p>

## ✨功能

- 自动挂载 `/metrics` 路径,提供 Prometheus 监控数据
- 为其他插件提供统一的数据上报接口

## 📦 安装

- 使用 nb-cli

```sh
nb plugin install nonebot-plugin-prometheus
```

- 使用 uv

```sh
uv add nonebot-plugin-prometheus
```

- 使用 poetry

```sh
poetry add nonebot-plugin-prometheus
```

- 使用 pip

```sh
pip install nonebot-plugin-prometheus
```

## 🔌接入方式

先在插件代码最前面声明依赖

```python
from nonebot import require

require("nonebot_plugin_prometheus")
```

然后可以从插件导入相关指标对象使用,详情请参考 [Prometheus Python Client 官方文档](https://prometheus.github.io/client_python/)

```python
from nonebot_plugin_prometheus import Gauge, Counter, Histogram, Summary

# Request counter
request_counter = Counter(
    "request_counter", "The number of requests"
)
request_counter.inc()
```

## 🔧配置

```ini
# 是否开启 Prometheus 插件
prometheus_enable = True
# Prometheus 挂载地址
prometheus_metrics_path = "/metrics"
```

> **Note**
>
> 使用插件需要支持 ASGI 的驱动器,例如 `fastapi`

## 📝TODO

- 监控 NoneBot 相关指标
- 支持通过对话查询指标数据

## 相关仓库

- [NoneBot2](https://github.com/nonebot/nonebot2)
- [Prometheus Python Client](https://github.com/prometheus/client_python)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nonebot-plugin-prometheus",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": "suyiiyii <suyiiyii@gmail.com>",
    "keywords": "nonebot, nonebot-plugin, nonebot2, prometheus",
    "author": null,
    "author_email": "suyiiyii <suyiiyii@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/c0/a3/4cc06d4f7b267a4292a03fe891bdb63b6d0b5131780ae4458177f15c9a6b/nonebot_plugin_prometheus-0.3.7.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable MD033 MD036 MD041 -->\n\n<p align=\"center\">\n  <a href=\"https://github.com/suyiiyii/nonebot-plugin-prometheus\"><img src=\"https://github.com/suyiiyii/nonebot-plugin-prometheus/blob/main/nonebot-plugin-prometheus.png\" width=\"200\" height=\"200\" alt=\"nonebot\"></a>\n</p>\n\n<div align=\"center\">\n\n# Nonebot Plugin Prometheus\n\n_\u2728 NoneBot Prometheus \u76d1\u63a7\u63d2\u4ef6 \u2728_\n\n</div>\n\n<p align=\"center\">\n  <a href=\"https://raw.githubusercontent.com/suyiiyii/nonebot-plugin-prometheus/main/LICENSE\">\n    <img src=\"https://img.shields.io/github/license/suyiiyii/nonebot-plugin-prometheus.svg\" alt=\"license\">\n  </a>\n  <a href=\"https://pypi.python.org/pypi/nonebot-plugin-prometheus\">\n    <img src=\"https://img.shields.io/pypi/v/nonebot-plugin-prometheus.svg\" alt=\"pypi\">\n  </a>\n</p>\n\n## \u2728\u529f\u80fd\n\n- \u81ea\u52a8\u6302\u8f7d `/metrics` \u8def\u5f84\uff0c\u63d0\u4f9b Prometheus \u76d1\u63a7\u6570\u636e\n- \u4e3a\u5176\u4ed6\u63d2\u4ef6\u63d0\u4f9b\u7edf\u4e00\u7684\u6570\u636e\u4e0a\u62a5\u63a5\u53e3\n\n## \ud83d\udce6 \u5b89\u88c5\n\n- \u4f7f\u7528 nb-cli\n\n```sh\nnb plugin install nonebot-plugin-prometheus\n```\n\n- \u4f7f\u7528 uv\n\n```sh\nuv add nonebot-plugin-prometheus\n```\n\n- \u4f7f\u7528 poetry\n\n```sh\npoetry add nonebot-plugin-prometheus\n```\n\n- \u4f7f\u7528 pip\n\n```sh\npip install nonebot-plugin-prometheus\n```\n\n## \ud83d\udd0c\u63a5\u5165\u65b9\u5f0f\n\n\u5148\u5728\u63d2\u4ef6\u4ee3\u7801\u6700\u524d\u9762\u58f0\u660e\u4f9d\u8d56\n\n```python\nfrom nonebot import require\n\nrequire(\"nonebot_plugin_prometheus\")\n```\n\n\u7136\u540e\u53ef\u4ee5\u4ece\u63d2\u4ef6\u5bfc\u5165\u76f8\u5173\u6307\u6807\u5bf9\u8c61\u4f7f\u7528\uff0c\u8be6\u60c5\u8bf7\u53c2\u8003 [Prometheus Python Client \u5b98\u65b9\u6587\u6863](https://prometheus.github.io/client_python/)\n\n```python\nfrom nonebot_plugin_prometheus import Gauge, Counter, Histogram, Summary\n\n# Request counter\nrequest_counter = Counter(\n    \"request_counter\", \"The number of requests\"\n)\nrequest_counter.inc()\n```\n\n## \ud83d\udd27\u914d\u7f6e\n\n```ini\n# \u662f\u5426\u5f00\u542f Prometheus \u63d2\u4ef6\nprometheus_enable = True\n# Prometheus \u6302\u8f7d\u5730\u5740\nprometheus_metrics_path = \"/metrics\"\n```\n\n> **Note**\n>\n> \u4f7f\u7528\u63d2\u4ef6\u9700\u8981\u652f\u6301 ASGI \u7684\u9a71\u52a8\u5668\uff0c\u4f8b\u5982 `fastapi`\n\n## \ud83d\udcddTODO\n\n- \u76d1\u63a7 NoneBot \u76f8\u5173\u6307\u6807\n- \u652f\u6301\u901a\u8fc7\u5bf9\u8bdd\u67e5\u8be2\u6307\u6807\u6570\u636e\n\n## \u76f8\u5173\u4ed3\u5e93\n\n- [NoneBot2](https://github.com/nonebot/nonebot2)\n- [Prometheus Python Client](https://github.com/prometheus/client_python)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 suyiiyii  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "\u4e3a NoneBot \u548c\u5176\u4ed6\u63d2\u4ef6\u63d0\u4f9b Prometheus \u76d1\u63a7\u652f\u6301",
    "version": "0.3.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/suyiiyii/nonebot-plugin-prometheus/issues",
        "Homepage": "https://github.com/suyiiyii/nonebot-plugin-prometheus",
        "Repository": "https://github.com/suyiiyii/nonebot-plugin-prometheus"
    },
    "split_keywords": [
        "nonebot",
        " nonebot-plugin",
        " nonebot2",
        " prometheus"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d34a0e4290dbe57f246b947e464000be0656d135247b88f8313a77eb8b0a4794",
                "md5": "3a6d6f348ec03c31be38e6f557186d71",
                "sha256": "b9cbf048b479c58a9aa7ad7fe4705c79c84d0b31b7b0dac11c708434fc17190b"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_prometheus-0.3.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3a6d6f348ec03c31be38e6f557186d71",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 6065,
            "upload_time": "2024-12-30T02:49:24",
            "upload_time_iso_8601": "2024-12-30T02:49:24.220374Z",
            "url": "https://files.pythonhosted.org/packages/d3/4a/0e4290dbe57f246b947e464000be0656d135247b88f8313a77eb8b0a4794/nonebot_plugin_prometheus-0.3.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0a34cc06d4f7b267a4292a03fe891bdb63b6d0b5131780ae4458177f15c9a6b",
                "md5": "e32bc38bdcd696ea686d3376dd5039fe",
                "sha256": "5f96cd622a2a06ab86a7ebd73d3487ceac959cdc10d4b0282dc980981f08d60b"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_prometheus-0.3.7.tar.gz",
            "has_sig": false,
            "md5_digest": "e32bc38bdcd696ea686d3376dd5039fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 5124,
            "upload_time": "2024-12-30T02:49:26",
            "upload_time_iso_8601": "2024-12-30T02:49:26.674659Z",
            "url": "https://files.pythonhosted.org/packages/c0/a3/4cc06d4f7b267a4292a03fe891bdb63b6d0b5131780ae4458177f15c9a6b/nonebot_plugin_prometheus-0.3.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-30 02:49:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "suyiiyii",
    "github_project": "nonebot-plugin-prometheus",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebot-plugin-prometheus"
}
        
Elapsed time: 0.44035s