主进程的采样分析输出模块

liveprofiler_sampler的Python项目详细描述


[![Circleci](https://circleci.com/gh/fieldaware/liveprofiler_sampler.svg?style=svg)(https://circleci.com/gh/fieldaware/liveprofiler_sampler)
[![PYPI版本](https://badge.fury.io/py/liveprofiler_sampler.svg)(https://badge.fury.io/py/liveprofiler_sampler)

这是基于https://github.com/nylas/nylas-perftools的临时工作。因此,大部分的功劳都归功于:nylas.com

要真正了解这里发生了什么,请查看这篇伟大的博客文章:https://www.nylas.com/blog/performance

这里我们有一个小烧瓶示例:

```
来自烧瓶导入烧瓶
app=flask(u name_u)


import liveprofiler_sampler
app.wsgi_app=liveprofiler_sampler.profilingmiddleware(app,interval=0.05,secret_header='secret')
app.run()


>;curl-v localhost:5000/liveprofiler
*尝试127.0.0.0.1.0.1.0.0.1.0.1.0.1.0.1.0.1.0.1.0.1.0.1.0.1.0.0.1.0.0.0.0.1.0.0.0.1.0.0.br/>>;get/liveprofiler http/1.1
>;host:localhost:5000
>;user-agent:curl/7.43.0.0
>;接受:**/>>
>;
>>>;
>;
>>>;
>;
>;<啊!!!!!!!!!!!!1111oneonelephant
<;连接:关闭
<;服务器:werkzeug/0.11.10 python/2.7.8
<;日期:2016年6月30日星期四15:30:21 GMT
<;
*关闭连接0

`````

传递给profilingmiddleware构造函数的secret_header参数是保护堆栈的秘密值。传递机密令牌将返回一个JSON,可以使用并可视化。

````
>;curl curl--header“profiler_token:secret”-v localhost:5000/liveprofiler
*重建的URL到:curl/
*无法解析主机:curl
*关闭连接0
curl:(6)无法解析主机:curl
*尝试127.0.0.1…
*已连接到本地主机(127.0.0.0.1)端口5000(1)端口5000(1)
>;get/liveprofiler http/1.1
>;host:localhost:5000
>;用户代理:curl/7.43.0
>;接受:*/*
>;profiler\u token:secret
>;
>;profiler\u token:secret
>;
>;http 1.0 200确定
><;连接:关闭
<;服务器:werkkprofiler/1.1;主机:本地主机:5000
>;用户代理:curl/7.43.0
>;接受zeug/0.11.10Python/2.7.8
<;日期:2016年6月30日星期四格林尼治标准时间15:31:39
<;
{“粒度”:0.05,“堆栈”:[{“计数”:9,“帧”:“<;模块>;”(ipython;启动ipython(ipython);启动实例(traitlets.config.application);
启动(ipython.terminal.ipapp);主循环(ipython.terminal.interactiveshell);
交互(ipython.terminal.interactiveshell);运行单元(iprt(ip……….
```

要可视化数据,请检查:https://github.com/fieldaware/liveprofiler
在uwsgi下运行您的服务时,您必须知道这一点。
为了收集任何样本,您需要向uwsgi.ini添加以下配置
````
py call osafterfork=true;启用运行cpython的子进程来捕获操作系统信号
lazy apps=true```

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
JPanel的java滚动窗格?   java JPA查询方法:findTopX,其中X是给定的(变量)数?   当应用程序在Oreo中处于后台时,java音乐服务在几秒钟后不工作   java通过TCP流发送密钥编码的字符串BadPaddingException with Windows   java在这里构建代码的更好方法是什么?   如何使用Java(无给定参数)检查列表中是否有数字   跨多个JVM的java事务控制   dataframe如何使用SparkJavaAPI的MapFunction和ReduceFunction在集群上并行处理这个问题?   java如何在多模块spring引导中配置yml文件   已安装java JDBC驱动程序,但出现异常   JUnit 4中的java,有没有一种方法可以在扩展BlockJUnit4ClassRunner的自定义运行程序中,在all@BeforeClass之前运行一段代码   继续未能选择JAVA上的radioButton   java如何通过PHP代码运行shell命令?   java JSlider SynthLookandFeel填充颜色   java给定一个数字,打印下三个数字   java SpringMVC(安全)403错误   java Graphhopper从装载的obb文件系统加载路由信息时出错   java安全工具扫描问题,发现依赖默认编码:新字符串(字节[])   java如何获取嵌套字段