Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

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.
@esheehan-gsl esheehan-gsl self-assigned this Nov 17, 2023
@esheehan-gsl esheehan-gsl force-pushed the optional-profiling-in-dev branch from 674b51c to b181181 Compare November 17, 2023 21:26
@esheehan-gsl esheehan-gsl force-pushed the optional-profiling-in-dev branch from b181181 to c08c6a0 Compare November 17, 2023 21:27
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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants