Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/174060

Change subject: Added switch-logic for new Profiler config format
......................................................................

Added switch-logic for new Profiler config format

Change-Id: If28876d10407a5bd8567b7b282c754fea484367a
---
M wmf-config/StartProfiler.php
1 file changed, 24 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/mediawiki-config 
refs/changes/60/174060/1

diff --git a/wmf-config/StartProfiler.php b/wmf-config/StartProfiler.php
index 8af1ded..890e7e7 100644
--- a/wmf-config/StartProfiler.php
+++ b/wmf-config/StartProfiler.php
@@ -5,17 +5,29 @@
 
 # Non-logged profiling for debugging
 if ( isset( $_REQUEST['forceprofile'] ) ) {
-       $wgProfiler['class'] = 'ProfilerSimpleText';
-# Non-logged profiling for debugging
-} elseif ( isset( $_REQUEST['forcetrace'] ) ) {
-       $wgProfiler['class'] = 'ProfilerSimpleTrace';
+       if ( class_exists( 'ProfilerOutput' ) ) {
+               $wgProfiler['class'] = 'ProfilerStandard';
+               $wgProfiler['output'] = 'text';
+       } else {
+               $wgProfiler['class'] = 'ProfilerSimpleText';
+       }
 # Profiling hack for test2 wiki (not sampled, but shouldn't distort too much)
 } elseif ( isset( $_SERVER['HTTP_HOST'] ) && $_SERVER['HTTP_HOST'] === 
'test2.wikipedia.org' ) {
-       $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       if ( class_exists( 'ProfilerOutput' ) ) {
+               $wgProfiler['class'] = 'ProfilerStandard';
+               $wgProfiler['output'] = 'udp';
+       } else {
+               $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       }
        $wgProfiler['profileID'] = 'test2';
 # Normal case: randomly (or not) selected for logged profiling sample
 } elseif ( PHP_SAPI !== 'cli' && $wmfDatacenter == 'eqiad' && ( mt_rand() % 50 
) == 0 ) {
-       $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       if ( class_exists( 'ProfilerOutput' ) ) {
+               $wgProfiler['class'] = 'ProfilerStandard';
+               $wgProfiler['output'] = 'udp';
+       } else {
+               $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       }
        // $IP is something like '/srv/mediawiki/php-1.19'
        $version = str_replace( 'php-', '', basename( $IP ) );
        if ( strpos( $_SERVER['REQUEST_URI'], '/w/thumb.php' ) !== false ) {
@@ -26,7 +38,12 @@
                $wgProfiler['profileID'] = $version;
        }
 } elseif ( $wmfRealm === 'labs' ) {
-       $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       if ( class_exists( 'ProfilerOutput' ) ) {
+               $wgProfiler['class'] = 'ProfilerStandard';
+               $wgProfiler['output'] = 'udp';
+       } else {
+               $wgProfiler['class'] = 'ProfilerSimpleUDP';
+       }
        $coreGit = new GitInfo( $IP );
        $wgProfiler['profileID'] = $coreGit->getHeadSHA1() ?: 'labs';
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/174060
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If28876d10407a5bd8567b7b282c754fea484367a
Gerrit-PatchSet: 1
Gerrit-Project: operations/mediawiki-config
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to