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

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第三方库


热门话题
java如何使用jsonb库从Postgres读取jsonb   java如何在SeleniumWebDriver中选择下拉选项?   java如何获取需要在tessbase中使用的目录。init(“目录”,“eng”)?   java计算二进制字的奇偶校验   java如何使用jBCrypt进行密码哈希比较?   eclipse的java分析器插件   在java中调用C函数   java在嵌入式Apache Tomcat 9中以编程方式启用SSL并添加证书   java在中遇到问题。nextDouble()   java如何为JScrollPane的视口绘制引导标记   swing Java组件在启动时不显示   有没有类似java的C语言。util。属性类