python错误监视和报告
flawless的Python项目详细描述
完美无缺是shopkick开发的一个简单的python框架,用于在生产环境中检测错误。完美无缺地捕获异常,然后向负责导致异常的开发人员发送电子邮件。完美无缺与git集成,并使用git-buncy来确定要给哪个开发人员发送电子邮件。
project-website:http://shopkick.github.com/完美无缺/
why you should use use完美无缺
-
*每行代码只发送一封电子邮件。即使特定的代码行导致数千个
异常,也只会发送一封电子邮件。
*仅向一个开发人员发送电子邮件。完美无缺使用git-buncy来确定哪个开发人员对特定异常负有责任,并且只会向该开发人员发送电子邮件。
*完美无缺记录异常发生时堆栈帧中每个变量的值。这使调试速度提高了10倍。
*不要在旧代码中报告异常。如果您将report-only设置为早于report-only日期,则
insfectless将只报告由早于report-only日期后修改的代码引起的异常。
您可以将某些文件/函数标记为库代码,当这些文件/函数中发生
异常时,将责怪调用方导致库代码的错误。
4步安装指南
----
\1。安装完美。在这一步之后,您的路径中应该有一个名为fineless的可执行文件。
$>;python setup.py install
\2。安装完美的服务器。转到要承载完美后端的服务器。然后使用下面的命令启动一个简短的问卷来设置服务器。
$>;完美配置
\3。启动完美无缺的服务器
$>;完美无缺的start-conf path/to/完美无缺的.cfg
\4。将完美的客户端集成到代码中。如果您运行的是wsgi应用程序,如
django或pylons/pyramid,只需将完美的.client.middleware添加到您的应用程序中。否则
您可以使用fineless.client.decorators包装特定的函数或整个类。查看
examples目录以获取一些实际的代码示例。
当捕捉到异常时,它会将整个回溯发送到完美的服务器。完美的服务器然后聚合来自客户机的异常
报告,并找出导致异常的代码行。一旦确定了导致异常的那一行,完美无缺就会运行"git-buncy"来确定最后一次接触那一行代码的开发人员的电子邮件地址。完美无缺然后向开发人员发送一封带有
回溯的电子邮件。
如果异常是预期的,则可以将其列为白名单。若要白名单异常,必须指定
文件名、函数名和在相应的
配置文件中白名单的代码行中的文本。或者,异常电子邮件包含一个链接,用于自动将异常添加到白名单中。通过将
行代码文本留空,可以列出特定函数的所有异常。同样,通过保留代码行和
函数空白,整个文件也可以白名单。
.egg/fectless/client/middleware.py",第34行,在"调用"中
return self.app(environ,start\u response)
file"/services/shopkick\u pylons/shopkick\u pylons-current/py/lib/python2.6/site packages/beaker-1.6.4-py2.6.egg/beaker/middleware.py",第73行,在"调用"中
return self.app(environ,start_response)
文件"/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site packages/apps/shopkick/pylons/lib/json_api.py",第66行,换行
返回func(obj,**new_kwargs)
文件"/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site packages/apps/shopkick/pylons/controllers/user.py",第535行,在create廑u web廑u registration
return handler.run();返回json字符串
file"/services/shopkick廑l/shopkick廑l-current/py/lib/python2.6/site packages/apps/shopkick/pylons/controllers/user.py",第219在run
session.commit()
file"/services/shopkick-pylons/shopkick-pylons-current/py/lib/python2.6/site packages/sqlalchemy-0.7.1-py2.6-linux-x86-u64.egg/sqlalchemy/orm/session.py"第617行,在commit
self.transaction.commit()
file"/build/bdist.linux-x86-u64/egg/mysqld"b/cursors.py",第173行,在execute
self.errorhandler(self,exc,value)
file"/build/bdist.linux-x86_64/egg/mysqldb/connections.py"中,第36行,在defaulterrorhandler
raise errorclass,errorvalue
integrityerror('(integrityerror)(1062,"重复条目"10229602058"fo"中r key"primary \'",)
<;b>;堆栈框架:<;b>;
<;b>;文件"/services/shopkik_pylons/shopkik_pylons-current/py/lib/python2.6/site packages/apps/shopkikik/pylons/lib/json_api.py",第66行,换行,<;/b>;
arg self
func=<;函数创建web_reg位于0x7F6C2ACF35F0>;
kwargs={pylons':<;pylons.util.pylonscoxt对象位于0x7F6A5C800190>;,'start_response':<;function repl_start_response at 0x7F6A5C80FED8>;,'controller':u'user','environ':{'routes.route':<;routes.route.route对象位于0x7F6C2A61B850>;,'mod懔wsgi.listener懔…
new懔kwargs={}
obj=<;apps.shopkik.pylons.controllers.user.usercontroller object at 0x7f6a5c800110>;
self.request懔info=jsonrequestinfo(logging懔details懔field懔name='创建Web懔注册懔请求懔details',Web懔authentication=71,请求路径='/shopkick/v1/user/create_web_registration')
<;b>;文件"/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site packages/apps/shopkick/pylons/controllers/user.py",第535行,在create_web_registration<;/b>;
client_platform=2
下载rl_u type='
email=none
error戋manager=<;apps.shopkick.pylons.lib.web戋u registration戋helpers.errormanager object at 0x7f6a5c800150>;
facebook戋u access戋token=none
first戋name=none
gift戋manager=<;apps.shopkick.pylons.lib.giftmanager object at 0x7f>;
礼品令牌='
处理程序=<;apps.shopkick.pylons.controllers.user.createwebregistrationhandler对象位于0x7f6a5c800f90>;
邀请令牌=无
自身。\挂架日志调试=假
自身。启动响应=<;函数复制启动响应位于0x7f6a5c80fed8>;
我们er_u service=<;lib.thrift.utils.persistent_u service.thriftservice object at 0x7f6c2a1f2410>;
zip_u code=none
<;b>;file"/服务/购物塔/购物塔-当前/py/lib/python2.6/站点包/应用程序/购物塔/控制器/user.py",第2190行,正在运行<;/b>;
b_resp=createWebRegistrationResponse(status=0,web戋registration戋id=10229602058)
create戋web戋registrated戋user=<;function create戋web戋registrated戋user at 0x7f6a80faf9b0>;
gift戋resp=none
is戋full戋registration=false
is戋new web戋registrePingRecord(WebReg_用户ID=10229602058,加密的WebReg_用户ID=kiotyq97p7h8,客户端平台=2,reping_状态=0,创建=none)
self.client_平台=2
self.download_url_type='
self.email=none
self.error_manager=<;apps.shopkick.pylons.lib.web_registration_helpers.errormanager对象位于0x7f6a5c800150>;
self.facebook_access_token=none
self.facebook_access_token_func=<;function_facebook_user_id_from_access_token at 0x7f6c2ac719b0>;
self.facebook_user_id=none
web_registration_id='kiotyq97p7h8'
<;b>;其他信息:<;<;&b>;
post/shopkick/v1/user/create_web_registration http/1.0
接受:应用程序n/json,text/javascript,*/*;q=0.01
接受字符集:utf-8,iso-8859-1,utf-16,*;q=0.7
接受编码:gzip
接受语言:en-us,en;q=0.9
缓存控制:max age=43200
连接:关闭
内容长度:-1
内容类型:application/x-www-form-urlended
cookie:session_id=1e9dtwdvcq7m8;uu utma=151718139.482813466.1384371861.1384371861.138483282848848.2;uu utmb=151718139.2.9.1384832848;u utmc=151718139;
主机:app.shopkick.com
来源:http://app.shopkick.com
参考:http://app.shopkick.com/download_page?启动用户代理:mozilla/5.0(linux;u;android 2.2.2;en-us;vm670 build/frg83g)applewebkit/533.1(khtml,类似于gecko)版本/4.0 mobile safari/533.1
x-forwarded-for:255.87.109.255
x-real-ip:255.87.109.255
x-requested-with:xmlhttprequest
gift-token=&;download嫒url嫒type=&;gift嫒token=
<;/code>;
服务器用户界面
----
**/get嫒weekly嫒u error嫒report**-显示本周发生的所有错误。使用排行榜样式
格式显示导致本周最多错误的开发人员。
参数:
*timestamp*—(可选)指定要查看的周。默认值为当前周。
包含已知错误(可选)包含配置/已知错误中的错误。默认值为False。
*include_modified_before_min_date*—(可选)include errors origined in code modified
before fillless.cfg option"report_only_after_minimum_date"。默认值为false。
**/检查运行状况**-检查服务器是否已启动并正在运行。还显示服务器的配置
参数
**/添加已知错误**-可在其中白名单错误的网页
**/查看跟踪**-查看特定错误的最新跟踪
参数:
*文件名*-(必需)指定文件名e发生错误的函数名(必需)指定发生错误的函数名(必需)指定发生错误的行号(必需)指定发生错误的行号(必需)指定出现错误的全文(必需)ber
*时间戳*—(可选)指定要查看的周。默认为当前周。
project-website:http://shopkick.github.com/完美无缺/
why you should use use完美无缺
-
*每行代码只发送一封电子邮件。即使特定的代码行导致数千个
异常,也只会发送一封电子邮件。
*仅向一个开发人员发送电子邮件。完美无缺使用git-buncy来确定哪个开发人员对特定异常负有责任,并且只会向该开发人员发送电子邮件。
*完美无缺记录异常发生时堆栈帧中每个变量的值。这使调试速度提高了10倍。
*不要在旧代码中报告异常。如果您将report-only设置为早于report-only日期,则
insfectless将只报告由早于report-only日期后修改的代码引起的异常。
您可以将某些文件/函数标记为库代码,当这些文件/函数中发生
异常时,将责怪调用方导致库代码的错误。
4步安装指南
----
\1。安装完美。在这一步之后,您的路径中应该有一个名为fineless的可执行文件。
$>;python setup.py install
\2。安装完美的服务器。转到要承载完美后端的服务器。然后使用下面的命令启动一个简短的问卷来设置服务器。
$>;完美配置
\3。启动完美无缺的服务器
$>;完美无缺的start-conf path/to/完美无缺的.cfg
\4。将完美的客户端集成到代码中。如果您运行的是wsgi应用程序,如
django或pylons/pyramid,只需将完美的.client.middleware添加到您的应用程序中。否则
您可以使用fineless.client.decorators包装特定的函数或整个类。查看
examples目录以获取一些实际的代码示例。
当捕捉到异常时,它会将整个回溯发送到完美的服务器。完美的服务器然后聚合来自客户机的异常
报告,并找出导致异常的代码行。一旦确定了导致异常的那一行,完美无缺就会运行"git-buncy"来确定最后一次接触那一行代码的开发人员的电子邮件地址。完美无缺然后向开发人员发送一封带有
回溯的电子邮件。
如果异常是预期的,则可以将其列为白名单。若要白名单异常,必须指定
文件名、函数名和在相应的
配置文件中白名单的代码行中的文本。或者,异常电子邮件包含一个链接,用于自动将异常添加到白名单中。通过将
行代码文本留空,可以列出特定函数的所有异常。同样,通过保留代码行和
函数空白,整个文件也可以白名单。
.egg/fectless/client/middleware.py",第34行,在"调用"中
return self.app(environ,start\u response)
file"/services/shopkick\u pylons/shopkick\u pylons-current/py/lib/python2.6/site packages/beaker-1.6.4-py2.6.egg/beaker/middleware.py",第73行,在"调用"中
return self.app(environ,start_response)
文件"/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site packages/apps/shopkick/pylons/lib/json_api.py",第66行,换行
返回func(obj,**new_kwargs)
文件"/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site packages/apps/shopkick/pylons/controllers/user.py",第535行,在create廑u web廑u registration
return handler.run();返回json字符串
file"/services/shopkick廑l/shopkick廑l-current/py/lib/python2.6/site packages/apps/shopkick/pylons/controllers/user.py",第219在run
session.commit()
file"/services/shopkick-pylons/shopkick-pylons-current/py/lib/python2.6/site packages/sqlalchemy-0.7.1-py2.6-linux-x86-u64.egg/sqlalchemy/orm/session.py"第617行,在commit
self.transaction.commit()
file"/build/bdist.linux-x86-u64/egg/mysqld"b/cursors.py",第173行,在execute
self.errorhandler(self,exc,value)
file"/build/bdist.linux-x86_64/egg/mysqldb/connections.py"中,第36行,在defaulterrorhandler
raise errorclass,errorvalue
integrityerror('(integrityerror)(1062,"重复条目"10229602058"fo"中r key"primary \'",)
<;b>;堆栈框架:<;b>;
<;b>;文件"/services/shopkik_pylons/shopkik_pylons-current/py/lib/python2.6/site packages/apps/shopkikik/pylons/lib/json_api.py",第66行,换行,<;/b>;
arg self
func=<;函数创建web_reg位于0x7F6C2ACF35F0>;
kwargs={pylons':<;pylons.util.pylonscoxt对象位于0x7F6A5C800190>;,'start_response':<;function repl_start_response at 0x7F6A5C80FED8>;,'controller':u'user','environ':{'routes.route':<;routes.route.route对象位于0x7F6C2A61B850>;,'mod懔wsgi.listener懔…
new懔kwargs={}
obj=<;apps.shopkik.pylons.controllers.user.usercontroller object at 0x7f6a5c800110>;
self.request懔info=jsonrequestinfo(logging懔details懔field懔name='创建Web懔注册懔请求懔details',Web懔authentication=71,请求路径='/shopkick/v1/user/create_web_registration')
<;b>;文件"/services/shopkick_pylons/shopkick_pylons-current/py/lib/python2.6/site packages/apps/shopkick/pylons/controllers/user.py",第535行,在create_web_registration<;/b>;
client_platform=2
下载rl_u type='
email=none
error戋manager=<;apps.shopkick.pylons.lib.web戋u registration戋helpers.errormanager object at 0x7f6a5c800150>;
facebook戋u access戋token=none
first戋name=none
gift戋manager=<;apps.shopkick.pylons.lib.giftmanager object at 0x7f>;
礼品令牌='
处理程序=<;apps.shopkick.pylons.controllers.user.createwebregistrationhandler对象位于0x7f6a5c800f90>;
邀请令牌=无
自身。\挂架日志调试=假
自身。启动响应=<;函数复制启动响应位于0x7f6a5c80fed8>;
我们er_u service=<;lib.thrift.utils.persistent_u service.thriftservice object at 0x7f6c2a1f2410>;
zip_u code=none
<;b>;file"/服务/购物塔/购物塔-当前/py/lib/python2.6/站点包/应用程序/购物塔/控制器/user.py",第2190行,正在运行<;/b>;
b_resp=createWebRegistrationResponse(status=0,web戋registration戋id=10229602058)
create戋web戋registrated戋user=<;function create戋web戋registrated戋user at 0x7f6a80faf9b0>;
gift戋resp=none
is戋full戋registration=false
is戋new web戋registrePingRecord(WebReg_用户ID=10229602058,加密的WebReg_用户ID=kiotyq97p7h8,客户端平台=2,reping_状态=0,创建=none)
self.client_平台=2
self.download_url_type='
self.email=none
self.error_manager=<;apps.shopkick.pylons.lib.web_registration_helpers.errormanager对象位于0x7f6a5c800150>;
self.facebook_access_token=none
self.facebook_access_token_func=<;function_facebook_user_id_from_access_token at 0x7f6c2ac719b0>;
self.facebook_user_id=none
web_registration_id='kiotyq97p7h8'
<;b>;其他信息:<;<;&b>;
post/shopkick/v1/user/create_web_registration http/1.0
接受:应用程序n/json,text/javascript,*/*;q=0.01
接受字符集:utf-8,iso-8859-1,utf-16,*;q=0.7
接受编码:gzip
接受语言:en-us,en;q=0.9
缓存控制:max age=43200
连接:关闭
内容长度:-1
内容类型:application/x-www-form-urlended
cookie:session_id=1e9dtwdvcq7m8;uu utma=151718139.482813466.1384371861.1384371861.138483282848848.2;uu utmb=151718139.2.9.1384832848;u utmc=151718139;
主机:app.shopkick.com
来源:http://app.shopkick.com
参考:http://app.shopkick.com/download_page?启动用户代理:mozilla/5.0(linux;u;android 2.2.2;en-us;vm670 build/frg83g)applewebkit/533.1(khtml,类似于gecko)版本/4.0 mobile safari/533.1
x-forwarded-for:255.87.109.255
x-real-ip:255.87.109.255
x-requested-with:xmlhttprequest
gift-token=&;download嫒url嫒type=&;gift嫒token=
<;/code>;
服务器用户界面
----
**/get嫒weekly嫒u error嫒report**-显示本周发生的所有错误。使用排行榜样式
格式显示导致本周最多错误的开发人员。
参数:
*timestamp*—(可选)指定要查看的周。默认值为当前周。
包含已知错误(可选)包含配置/已知错误中的错误。默认值为False。
*include_modified_before_min_date*—(可选)include errors origined in code modified
before fillless.cfg option"report_only_after_minimum_date"。默认值为false。
**/检查运行状况**-检查服务器是否已启动并正在运行。还显示服务器的配置
参数
**/添加已知错误**-可在其中白名单错误的网页
**/查看跟踪**-查看特定错误的最新跟踪
参数:
*文件名*-(必需)指定文件名e发生错误的函数名(必需)指定发生错误的函数名(必需)指定发生错误的行号(必需)指定发生错误的行号(必需)指定出现错误的全文(必需)ber
*时间戳*—(可选)指定要查看的周。默认为当前周。