[英]How do I instrument my python code?
I'm developing some web apps with the grok framework, and I want to know what the framework is doing when serving a simple page. 我正在使用grok框架开发一些Web应用程序,并且我想知道该框架在提供简单页面时在做什么。
So, what tools are out there to grab such data, and maybe, graph it? 那么,有哪些工具可以获取此类数据,甚至可以绘制图形呢?
Python has plenty of built-in reflectivity that could be used for instrumentation. Python具有大量可用于仪器的内置反射率。 For example:
例如:
def hax_all_the_things():
for x in list(globals()):
func = globals()[x]
if callable(func) and not hasattr(func, 'instrumented'):
globals()[x] = lambda func = func, *args, **kwargs: (
__import__('sys').stdout.write("HAX\n"), func(*args, **kwargs)
)[1]
globals()[x].instrumented = True
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.