-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
feat: add profiling to Superset pages #16136
Conversation
superset/app.py
Outdated
@@ -36,6 +37,10 @@ def create_app() -> Flask: | |||
app_initializer = app.config.get("APP_INITIALIZER", SupersetAppInitializer)(app) | |||
app_initializer.init_app() | |||
|
|||
profiling = app.config.get("PROFILING", False) | |||
if profiling: | |||
app.wsgi_app = SupersetProfiler(app.wsgi_app) # type: ignore |
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.
Codecov Report
@@ Coverage Diff @@
## master #16136 +/- ##
==========================================
- Coverage 76.83% 76.58% -0.26%
==========================================
Files 995 996 +1
Lines 52884 52913 +29
Branches 6721 6721
==========================================
- Hits 40636 40526 -110
- Misses 12023 12162 +139
Partials 225 225
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
5c80d60
to
034464d
Compare
from werkzeug.wrappers import Request, Response | ||
|
||
|
||
class SupersetProfiler: |
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.
@betodealmeida would this be better defined an extension?
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.
We still need the WSGI middleware, but I'll add an extension to register and set it up.
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 is great, LGTM after addressing @john-bodley comment(s)
2ed623a
to
aaece1d
Compare
* feat: add profiling to Superset pages * Address comments
* feat: add profiling to Superset pages * Address comments
* feat: add profiling to Superset pages * Address comments
SUMMARY
Add Python instrumentation to pages, showing method calls used to build the page, and how long each one took.
Requires a configuration flag
PROFILING=True
, and appending_instrument=1
to the URL.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
http://localhost:9000/superset/welcome/?_instrument=1
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION