Skip to content
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 option to dump profiler stats #204

Merged
merged 2 commits into from
Dec 13, 2023

Conversation

Dosenpfand
Copy link
Contributor

Add a config option DEBUG_TB_PROFILER_DUMP_FILENAME to dump profile stats to a file, so they can be further evaluated, e.g. with flameprof.

Copy link
Member

@jeffwidman jeffwidman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for the general idea.

Can you rebase / squash to a single commit on top of master?

tox.ini Outdated
@@ -4,6 +4,7 @@ envlist = py27,py36,py37,py38,stylecheck
[testenv]
deps =
pytest
flask<2.3.0 # For "before_first_request"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you further clarify why this is needed?

We can't be pinning Flask to an old version unless it's a super temp pin until Flask drops a bugfix release... but Flask is now on 3.0.0 so methinks we'd want to test with that...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test/basic_app.py still uses the before_first_request decorator which was removed in Flask 2.3.0.
Additional changes would be necessary to make the extension compatible with 3.0.0. If desired, I can prepare an additional PR for that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer part of the PR now that a few other PR's were merged re: compatibility.

@Dosenpfand Dosenpfand force-pushed the profiler-dump-stats branch 3 times, most recently from 45c8f39 to c3f731c Compare October 22, 2023 17:10
@Dosenpfand
Copy link
Contributor Author

Can you rebase / squash to a single commit on top of master?

Done.

Copy link
Contributor

@macnewbold macnewbold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the updates that @jeffwidman suggested, I think this looks good. Thanks for submitting it!

@@ -88,7 +92,14 @@ def process_response(self, request, response):

self.stats = stats
self.function_calls = function_calls
# destroy the profiler just in case
Copy link
Member

@jeffwidman jeffwidman Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this comment seems semi-interesting, although I don't see an explicit del call here. Does it somehow just fall out of scope?

Just wondering if this is a contextual comment we should continue pulling forward in the codebase or if it's outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it's outdated but if you think otherwise I can restore it.

@macnewbold
Copy link
Contributor

I was able to resolve the merge conflict locally, but am running into permission errors when trying to push updates to the PR or to push updates that merge the PR into master. But if we can get past that, I think this one is ready to merge.

@jeffwidman
Copy link
Member

@Dosenpfand can you rebase? And also address my last question?

@Dosenpfand
Copy link
Contributor Author

@jeffwidman Done. Sorry for my late reaction.

@macnewbold
Copy link
Contributor

It looks like it's all good except for one style check that is failing. Once that's fixed I think it is ready to merge.

auto-merge was automatically disabled December 11, 2023 20:11

Head branch was pushed to by a user without write access

@Dosenpfand
Copy link
Contributor Author

@macnewbold
fixed.

@macnewbold macnewbold merged commit 719fe02 into pallets-eco:master Dec 13, 2023
10 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

3 participants