diff options
author | Aaron Schulz <aschulz@wikimedia.org> | 2023-03-01 12:16:39 -0800 |
---|---|---|
committer | Krinkle <krinkle@fastmail.com> | 2023-03-23 00:08:49 +0000 |
commit | 29bab859fc8ef3680143a792acf1cf0acad22968 (patch) | |
tree | 2e28cf81b650d8b4b11d0e10516c788533edb7db /includes/api/ApiMain.php | |
parent | 4de04152407da76f53291128ed0ac723782efb98 (diff) | |
download | mediawikicore-29bab859fc8ef3680143a792acf1cf0acad22968.tar.gz mediawikicore-29bab859fc8ef3680143a792acf1cf0acad22968.zip |
profiler: Add ProfilingContext class
Use this class to track the entry point and handler used for requests,
making it available for use in profiling, stats, and logging code.
This makes it possible for periodic and/or shutdown profiling callbacks
to know the basic action handler that applies to the request (if any).
Metric names can easily include this string along with MW_ENTRY_POINT
to create per-action profiling dashboards.
This info cannot otherwise be acquired from things like excimer stack
traces since the router and handler classes do not appear in the stack
during PRESEND deferred updates and variations like ApiMain/SpecialPage
"inclusion mode" would have to be detected somehow.
Bug: T330810
Change-Id: Icca5a7a343faeeb18652994c96752acb61a61fd1
Diffstat (limited to 'includes/api/ApiMain.php')
-rw-r--r-- | includes/api/ApiMain.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index f4162cfdb8f8..b06f5cfed8a1 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -28,6 +28,7 @@ use MediaWiki\Logger\LoggerFactory; use MediaWiki\MainConfigNames; use MediaWiki\MediaWikiServices; use MediaWiki\ParamValidator\TypeDef\UserDef; +use MediaWiki\Profiler\ProfilingContext; use MediaWiki\Request\FauxRequest; use MediaWiki\Request\WebRequestUpload; use MediaWiki\Rest\HeaderParser\Origin; @@ -1886,6 +1887,7 @@ class ApiMain extends ApiBase { $this->mModule = $module; if ( !$this->mInternalMode ) { + ProfilingContext::singleton()->init( MW_ENTRY_POINT, $module->getModuleName() ); $this->setRequestExpectations( $module ); } |