简体   繁体   English

如何检测我的python代码?

[英]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.

相关问题 如何将我的 python GUI 与我的 python 代码结合起来 - How do I combine my python GUI with my python code 如何使用 Python 中的 AWS Lambda 函数检测 X-Ray 中的其他函数? - How do I instrument additional functions in X-Ray with AWS Lambda function in Python? 如何创建包含不同乐器的多个音轨的 midi 文件? 与 python 和 music21 - How do I createa midi file with mutiple tracks of different instrument? with python and music21 python的探查器cProfile如何工作? 它是否检测或采样代码? - How python's profiler cProfile works? Does it instrument or samples the code? 如何修改我的Python图像缩放器代码以执行此操作? - How do I modify my Python image resizer code to do this? 如何从Java运行python 2.7代码? - How do I run a python 2.7 code from my Java? 如何从 github 获取文件到我的 python 代码中 - How do I get a file from github into my python code 我如何使我的代码在python中的for循环中运行 - How do I make my code run in a for loop in python 如何使我的代码在python中正确循环? - How do I make my code loop properly in python? 如何“重新排列”我的 python 代码以适应某种格式? - How do I 'rearrange' my python code to fit a certain format?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM