You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I used the Flask instructions to set up the profiler in our application.
As far as I understand, it doesn't matter which file we embed the code from the instructions in. Since it clings to the app, all requests must be processed.
As far as I understand, it doesn't matter which file we embed the code from the instructions in. Since it clings to the app, all requests should be processed, but I have a problem. For some reason, the profiling shows information for the last few seconds. It seems that there is only information about the last request.
For example, I turned on the profiler and did not go to the results page for 10-20 minutes. To make sure that the profiler didn't stop working, I put print in front of profile.stop(). I chose speedscope to display the information because it has a timeline at the top, which allowed me to somehow understand how long the information was collected. The timeline scale showed about 110 ms. After that, I made a couple of different queries and immediately saved the result. The schedule was identical.
it is my app:
server = Flask( __name__, static_folder="/app/static/", template_folder=get_absolute_path(__file__, "templates"), static_url_path="/static_sphere", # Чтоб не мешался blueprint-ам без префикса )
launch is in wsgi.py
from sphere import server as application
@application.before_request
def before_request():
if "profile" in request.args:
g.profiler = Profiler()
g.profiler.start()
@application.after_request
def after_request(response):
if not hasattr(g, "profiler"):
return response
g.profiler.stop()
output_html = g.profiler.output(renderers.SpeedscopeRenderer(timeline=True, processor_options=True))
return make_response(output_html)
with application.app_context():
sphere_init()
sphere_conf.configure()
if __name__ == "__main__":
application.run()
I'm sorry if my question seems silly, but I'm not a very experienced developer, and this is the first time I've encountered profilers in my life. I hope for your help and patience!
The text was updated successfully, but these errors were encountered:
Hi again.
I hope you're not tired of me yet :)
I used the Flask instructions to set up the profiler in our application.
As far as I understand, it doesn't matter which file we embed the code from the instructions in. Since it clings to the app, all requests must be processed.
As far as I understand, it doesn't matter which file we embed the code from the instructions in. Since it clings to the app, all requests should be processed, but I have a problem. For some reason, the profiling shows information for the last few seconds. It seems that there is only information about the last request.
For example, I turned on the profiler and did not go to the results page for 10-20 minutes. To make sure that the profiler didn't stop working, I put print in front of profile.stop(). I chose speedscope to display the information because it has a timeline at the top, which allowed me to somehow understand how long the information was collected. The timeline scale showed about 110 ms. After that, I made a couple of different queries and immediately saved the result. The schedule was identical.
it is my app:
server = Flask( __name__, static_folder="/app/static/", template_folder=get_absolute_path(__file__, "templates"), static_url_path="/static_sphere", # Чтоб не мешался blueprint-ам без префикса )
launch is in wsgi.py
I'm sorry if my question seems silly, but I'm not a very experienced developer, and this is the first time I've encountered profilers in my life. I hope for your help and patience!
The text was updated successfully, but these errors were encountered: