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


热门话题
在reducer中迭代自定义可写组件时出现java问题   属性文件中属性的java命名约定   任务链关闭的java Executor服务   java从Eclipse中的字段生成多个构造函数   java通过继承读取Json   java在不知道密钥的情况下解析json   java camel cxf如何在电子邮件中发送soap请求响应   java程序似乎跳过了if语句的一部分,在移回正确位置之前先移到else语句   测试简单的Java加密/解密inputFileName不存在   java从Jenkins REST API获取所有作业的所有构建的构建细节   java基本包装器和静态“类型”类对象   在WebSphere8.5上部署java代码   java对象相等(对象引用“=”)   java MongoDB整型字段到枚举的转换   每次我重新导入gradle时,IntelliJ都会不断重置Java设置   类型使用键或索引从Java中的数据类型检索值   在Java的列表接口中需要listIterator()和iterator()是什么?