aboutsummaryrefslogtreecommitdiffstats
path: root/includes/ResourceLoader/ResourceLoader.php
diff options
context:
space:
mode:
authorAaron Schulz <aschulz@wikimedia.org>2023-03-01 12:16:39 -0800
committerKrinkle <krinkle@fastmail.com>2023-03-23 00:08:49 +0000
commit29bab859fc8ef3680143a792acf1cf0acad22968 (patch)
tree2e28cf81b650d8b4b11d0e10516c788533edb7db /includes/ResourceLoader/ResourceLoader.php
parent4de04152407da76f53291128ed0ac723782efb98 (diff)
downloadmediawikicore-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/ResourceLoader/ResourceLoader.php')
-rw-r--r--includes/ResourceLoader/ResourceLoader.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/includes/ResourceLoader/ResourceLoader.php b/includes/ResourceLoader/ResourceLoader.php
index ad46ddd35c86..492fff773303 100644
--- a/includes/ResourceLoader/ResourceLoader.php
+++ b/includes/ResourceLoader/ResourceLoader.php
@@ -37,6 +37,7 @@ use MediaWiki\HookContainer\HookContainer;
use MediaWiki\Html\Html;
use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
+use MediaWiki\Profiler\ProfilingContext;
use MediaWiki\Request\HeaderCallback;
use MediaWiki\Title\Title;
use MediaWiki\User\UserOptionsLookup;
@@ -750,6 +751,7 @@ class ResourceLoader implements LoggerAwareInterface {
ob_start();
$responseTime = $this->measureResponseTime();
+ ProfilingContext::singleton()->init( MW_ENTRY_POINT, 'respond' );
// Find out which modules are missing and instantiate the others
$modules = [];