使用haufe.requestmonitoring条目分析zope实例日志

zope_lrr_analyzer的Python项目详细描述


Introduction

此项目将向系统添加一个新的实用程序命令:zope_lrr_analyzer。此实用程序仅与 安装了haufe.requestmonitoring的zope实例日志(以及 monitoring long running requests hook已启用)。

因此,您的instance.log必须由如下条目填写:

------
2012-03-27T15:58:19 WARNING RequestMonitor.DumpTrace Long running request
Request 28060 "/VirtualHostBase/http/www.mysite.com:80/mysiteid/VirtualHostRoot/myrequest/..." running in thread 1133545792 since 10.7206499577s
Python call stack (innermost first)
  ...
  lot of lines, depends on Python traceback
  ...
  Module ZPublisherEventsBackport.patch, line 80, in publish
  Module ZPublisher.Publish, line 202, in publish_module_standard
  Module ZPublisher.Publish, line 401, in publish_module
  Module ZServer.PubCore.ZServerPublisher, line 25, in __init__
<BLANKLINE>

该实用程序将帮助您分析收集一些统计数据的长时间运行的请求。

How to use

Usage: zope_lrr_analyzer [options] logfile [logfile…]

Analyze Zope instance log with haufe.requestmonitoring entries

Options:
--versionshow program’s version number and exit
-h, --helpshow this help message and exit
-s START_FROM, --start=START_FROM
start analysis after a given date/time (format like “YYYY-MM-DD HH:MM:SS”)
-e END_AT, --end=END_AT
stop analysis at given date/time (format like “YYYY- MM-DD HH:MM:SS”)
-l LOG_SIZE, --log-size=LOG_SIZE
keep only an amount of slow requests. Default is: no limit.
-i INCLUDE_REGEX, --include=INCLUDE_REGEX
a regexp expression that a calling path must match or will be discarded. Can be called multiple times, expanding the set
-t TRACEBACK_INCLUDE_REGEX, --traceback-include=TRACEBACK_INCLUDE_REGEX
a regexp expression that the Python traceback must match or will be discarded. Can be called multiple times, expanding the set
-r, --keep-request-id
Use request and thread ids to handle every match as a different entry

Results

让我们解释一下结果:

Stats from 2012-11-14 00:02:07 to 2012-11-15 09:55:41 (347 LRR catched)
...
----
2 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/foo/bar
    25 - 3654.05561542 (1:00:54.055615) - from 2012-11-15 07:48:10 to 2012-11-15 08:45:29

----
1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/baz
    77 - 16029.3731236 (4:27:09.373124) - from 2012-11-15 07:43:55 to 2012-11-15 08:45:30

您将得到最慢的请求路径(前一个是最快的,后一个是最慢的)。 顺序是通过收集所有执行到同一路径的请求,然后获取总时间来完成的。

这意味着只调用一次需要30秒的请求比另一个路径快 这只需要10秒,但调用10次(30x1<;10x10)。

如果同时使用--keep-request-id选项,则每个请求都将作为单独的条目计算, 所以输出会有一点变化:

Stats from 2012-04-27 00:02:07 to 2012-04-27 16:55:41 (347 LRR catched)
...
----
2 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/foo/bar
    1510.2860291 (0:25:10.286029) - from 2012-09-19 08:36:27 to 2012-09-19 09:01:22

----
1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/baz
    1750.49365091 (0:29:10.493651) - from 2012-09-19 08:30:34 to 2012-09-19 09:00:58

Single entry meaning

每个条目都提供这种数据:

Entry position                       Called path
     |                                   |
     1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/...
         15 - 171.913325071 (0:02:51.913325) - from 2012-09-19 08:30:34 to 2012-09-19 09:00:58
         |         |                |                       |                       |
     Times called  |      Time needed (human readable)      |                       |
                   |                                        |              Slow request end date
          Time needed (in seconds)                Slow request start date

使用--keep-request-id时:

Entry position                       Called path
     |                                   |
     1 /VirtualHostBase/http/yoursite.com:80/siteid/VirtualHostRoot/...
         1750.49365091 (0:29:10.493651) - from 2012-09-19 08:30:34 to 2012-09-19 09:00:58
             |              |                           |                      |
 Time needed (in seconds)   |                 Slow request start date          |
                            |                                                  |
                   Time needed (human readable)                       Slow request end date

请注意,“time needed”信息是计算机计算时间。

Authors

本产品由红海龟科技团队开发。

RedTurtle Technology Site

Changelog

0.5 (2016-06-13)

  • 显示捕获的lrr总数的信息 [基尔]
  • 现在可以使用-s-e作为日期字符串(不需要时间) [基尔]

0.4 (2012-12-06)

  • 添加了--traceback-include选项 [基尔]

0.3 (2012-11-15)

  • 始终显示请求的开始和结束日期 (不仅当-r选项被给定时) [基尔]

0.2 (2012-09-19)

  • 添加了--keep-request-id选项 [基尔]
  • 还存储(并在给定-r选项时显示)开始和结束请求时间 [基尔]

0.1 (2012-04-27)

  • 首次发布

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

推荐PyPI第三方库


热门话题
java如何使用相同的模型、颜色、字体和侦听器创建JTable的副本?   JavaSpring+Thymeleaf:用户时区中的时间   java HTTP请求返回非法状态异常安卓   java xml验证JDK 1.5 JDK 1.6差异   junit如何使用Parasoft从java文件生成测试文件   java使用getSpans方法获取可扩展文件中的所有跨距   javascript无法使用bindingResult设置表单元素   java RCP应用程序活动   获取Java类中泛型字段的类型   java更新查询,从一个依赖于另一个表的表中更改字段   java错误:GWT类型中的方法setBridge(GWTBridge)不适用于参数(GWTBridge)   为什么java/安卓需要在XML元素的开头有一个空格来解析它?   java通用代码,用于将字符串转换为任何所需的类   java如何创建Liferay钩子以扩展购物车portlet的功能   java Selected()方法存在漏洞   java新行附加在我的加密字符串上   使用NaN值的指数平滑的java   使用飞碟和iText发行的java XHTML到PDF   java如何在不使用HTMLDocument的情况下在JTextPane中显示两列文本?