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

Turn on profiling when FLASK_PROFILE=True #451

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

esheehan-gsl
Copy link
Contributor

I am finding myself having to profile the application from time-to-time to manage performance, so I think it makes sense to have the ability to just add the profiling middleware using an environment variable flag.

I am finding myself having to profile the application from time-to-time
to manage performance, so I think it makes sense to have the ability to
just add the profiling middleware using an environment variable flag.
Copy link

Code Coverage

Package Line Rate Branch Rate Health
unified_graphics 80% 68%
unified_graphics.etl 97% 96%
utils.s3 68% 69%
Summary 84% (369 / 437) 81% (86 / 106)

Minimum allowed line rate is 60%

Copy link
Collaborator

@ian-noaa ian-noaa left a comment

Choose a reason for hiding this comment

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

That's really handy to have that middleware! Looks good to me.

I wanted to confirm I understood what the restrictions=[30] statement does - it looks like it restricts the middleware to print out the top 30 calls. Is that correct?

@esheehan-gsl
Copy link
Contributor Author

it looks like it restricts the middleware to print out the top 30 calls. Is that correct?

I think that’s correct, but I haven’t experimented with that argument to see how it affects the output. I have used this set up a couple of times to identify and fix performance issues, and since it has worked and this bit only ever runs in development with the debug server on and the profiling env variable set (and thus it should never run in production), I haven’t worried too much about what it does. 😅

@ian-noaa
Copy link
Collaborator

Gotcha. That's good enough for me then! 😁

@esheehan-gsl esheehan-gsl merged commit 9125ae5 into main Nov 27, 2023
10 checks passed
@esheehan-gsl esheehan-gsl deleted the optional-profiling-in-dev branch November 27, 2023 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants