加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

flask-profiler, 监视端点调用并尝试进行某些分析的Flask 事件探

发布时间:2020-12-20 12:47:30 所属栏目:Python 来源:网络整理
导读:源代码名称: flask-profiler 源代码网址:http://www.github.com/muatik/flask-profiler flask-profiler源代码文档 flask-profiler源代码下载 Git URL: 复制代码 git://www.github.com/muatik/flask-profiler.git Git Clone代码到本地: 复制代码 git clone ht
  • 源代码名称:flask-profiler
  • 源代码网址:http://www.github.com/muatik/flask-profiler
  • flask-profiler源代码文档

flask-profiler源代码下载

  • Git URL:
    git://www.github.com/muatik/flask-profiler.git
  • Git Clone代码到本地:
    git clone http://www.github.com/muatik/flask-profiler
  • Subversion代码到本地:
    $ svn co --depth empty http://www.github.com/muatik/flask-profiler
    Checked out revision 1.
    $ cd repo
    $ svn up trunk
?
烧瓶分析器

版本:1.6

使用? profiler测量在你的Flask 应用程序中定义的端点;并通过web界面提供细粒度的报告。

它给出了这些问题的答案:

  • 应用程序中的瓶颈在哪里?
  • 应用程序中最慢的终结点?
  • 哪些是最常被调用的终结点?
  • 什么导致我的慢速端点? 在哪个上下文中,什么是 ARGS 和 kwargs?
  • 特定请求花费了多少时间?

简而言之,如果你对端点正在做什么和接收的请求进行了了解,请尝试打瓶探查器。

通过使用烧瓶分析器接口,你可以监视所有端点的性能,并通过向下钻取过滤器来调查端点和接收的请求。

屏幕截图

指示板视图显示摘要。

你可以创建过滤器来调查某些类型的请求。 [ alt text](/resources/filtering_all_screen。pngraw=true"按端点筛选")?

你可以看到请求的所有细节。

快速启动

通过例子可以很容易理解烧瓶的轮廓。 让我们来。

按pip安装烧瓶探查器。

pip install flask_profiler

在创建 Flask 应用程序时编辑你的代码。

# your app.pyfrom flask import Flaskimport flask_profiler app = Flask(__name__) app.config["DEBUG"] =True# You need to declare necessary configuration to initialize# flask-profiler as follows:app.config["flask_profiler"] = { "enabled": app.config["DEBUG"], "storage": { "engine": "sqlite" }, "basicAuth":{ "enabled": True, "username": "admin", "password": "admin" }, "ignore": [ "^/static/.*" ] }@app.route(/product/<id>, methods=[GET])defgetProduct(id): return"product id is "+str(id)@app.route(/product/<id>, methods=[

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读