V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wjx0912
V2EX  ›  Python

请教 Python 接口统计

  •  
  •   wjx0912 · 2022-10-20 18:06:44 +08:00 · 1444 次点击
    这是一个创建于 525 天前的主题,其中的信息可能已经有所发展或是发生改变。
    是个 fastapi (类似 flash )的 restful 服务程序,接口不是很多,调用也不频繁。

    没怎么写过 python ,算是边看书编写的模块吧。

    有木有这样的功能:加个装饰器或者类似的,对接口调用次数(最近 5 分钟,平均 3 分钟,平均 5 分钟,程序 cpu 内存负载)等之类的做个统计,然后提供 http://xxxx.com/status 返回统计信息( json 格式)

    不想造轮子,感谢大家
    3 条回复    2022-10-26 16:07:30 +08:00
    gumupaier
        1
    gumupaier  
       2022-10-24 17:40:23 +08:00
    自己写个 middleware 吧
    wjx0912
        2
    wjx0912  
    OP
       2022-10-24 17:53:15 +08:00
    @gumupaier 暂时搁置吧,反正是公司的项目能跑起来了。python 没啥熟练度,造轮子耗时~
    谢谢了
    wingor2015
        3
    wingor2015  
       2022-10-26 16:07:30 +08:00
    要求不高的话,直接把 nginx 日志拿出来统计最简单,统计 cpu 、内存那些脚本网上很多
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5458 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 07:43 · PVG 15:43 · LAX 00:43 · JFK 03:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.