Name | nonebot-plugin-prometheus JSON |
Version |
0.3.9
JSON |
| download |
home_page | None |
Summary | 为 NoneBot 和其他插件提供 Prometheus 监控支持 |
upload_time | 2025-02-23 02:54:28 |
maintainer | None |
docs_url | None |
author | None |
requires_python | <4.0,>=3.9 |
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. |
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 监控数据
- 为其他插件提供统一的数据上报接口
## 📊支持统计的指标
- Bot 在线状态
- Bot 掉线次数
- Bot 发送和接受消息次数
- Matcher 执行次数
## 📦 安装
- 使用 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
- 支持通过对话查询指标数据
## 相关仓库
- [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/35/6f/93eab475519dbd3c26900148a890dd01c2bf0b55012118cc714e354b5dae/nonebot_plugin_prometheus-0.3.9.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\udcca\u652f\u6301\u7edf\u8ba1\u7684\u6307\u6807\n\n- Bot \u5728\u7ebf\u72b6\u6001\n- Bot \u6389\u7ebf\u6b21\u6570\n- Bot \u53d1\u9001\u548c\u63a5\u53d7\u6d88\u606f\u6b21\u6570\n- Matcher \u6267\u884c\u6b21\u6570\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- \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\n \n Copyright (c) 2024 suyiiyii\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.",
"summary": "\u4e3a NoneBot \u548c\u5176\u4ed6\u63d2\u4ef6\u63d0\u4f9b Prometheus \u76d1\u63a7\u652f\u6301",
"version": "0.3.9",
"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": null,
"digests": {
"blake2b_256": "9f1534d37b15ccfeabe1317882b7f61b384b630b9271c54863c23a51ec9a8c2e",
"md5": "9dc8a57ef55455f7f303c8651a2e04f5",
"sha256": "801e9d09b361fef3f0edbe30de2b05a8878603d269c9147766974eca07e88b4f"
},
"downloads": -1,
"filename": "nonebot_plugin_prometheus-0.3.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9dc8a57ef55455f7f303c8651a2e04f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 7043,
"upload_time": "2025-02-23T02:54:26",
"upload_time_iso_8601": "2025-02-23T02:54:26.393667Z",
"url": "https://files.pythonhosted.org/packages/9f/15/34d37b15ccfeabe1317882b7f61b384b630b9271c54863c23a51ec9a8c2e/nonebot_plugin_prometheus-0.3.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "356f93eab475519dbd3c26900148a890dd01c2bf0b55012118cc714e354b5dae",
"md5": "222f560a872f97e67a00694ce24433b3",
"sha256": "9ff94717c86ff9d3a73752f8e8b79a2fe456c643ddb36224b7943e808c678efb"
},
"downloads": -1,
"filename": "nonebot_plugin_prometheus-0.3.9.tar.gz",
"has_sig": false,
"md5_digest": "222f560a872f97e67a00694ce24433b3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 5754,
"upload_time": "2025-02-23T02:54:28",
"upload_time_iso_8601": "2025-02-23T02:54:28.397072Z",
"url": "https://files.pythonhosted.org/packages/35/6f/93eab475519dbd3c26900148a890dd01c2bf0b55012118cc714e354b5dae/nonebot_plugin_prometheus-0.3.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-23 02:54:28",
"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"
}