-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Profile function #155
Add Profile function #155
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very amazing! I tested it and the result look like below.
Just some minor comments
The tested codes is
def method1():
time.sleep(0.02)
return '1'
def method2():
time.sleep(0.02)
return method1()
def method3():
time.sleep(0.02)
return method2()
if __name__ == '__main__':
config.service_name = 'provider'
config.logging_level = 'DEBUG'
agent.start()
import socketserver
from http.server import BaseHTTPRequestHandler
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def do_POST(self):
method3()
time.sleep(0.5)
self.send_response(200)
self.send_header('Content-Type', 'application/json')
self.end_headers()
self.wfile.write('{"song": "Despacito", "artist": "Luis Fonsi"}'.encode('ascii'))
PORT = 9091
Handler = SimpleHTTPRequestHandler
with socketserver.TCPServer(("", PORT), Handler) as httpd:
httpd.serve_forever()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!!! 🎉
@Humbertzhang please consider adding tests for this feature later |
This is PR is for Google Summer Of Code 2021 Project: Proposal for Apache SkyWalking: Python agent supports profiling
I will add test for profile function after GSoC is over.
This PR is the rest part of apache/skywalking#5943 following #127 .
It added the profile function into Python Agent, I tested it in normal and concurrent scenario and it works fine.