Log exceptions in the StatsD process
authorGergő Tisza <gtisza@wikimedia.org>
Thu, 23 Jul 2015 20:02:22 +0000 (20:02 +0000)
committerBryanDavis <bdavis@wikimedia.org>
Thu, 23 Jul 2015 21:26:29 +0000 (21:26 +0000)
Change-Id: Iff14cbbfbe81d38c55b41ff115c66156323df035

includes/GlobalFunctions.php

index 6f354c3..167305d 100644 (file)
@@ -1254,12 +1254,16 @@ function wfLogProfilingData() {
 
        $config = $context->getConfig();
        if ( $config->get( 'StatsdServer' ) ) {
-               $statsdServer = explode( ':', $config->get( 'StatsdServer' ) );
-               $statsdHost = $statsdServer[0];
-               $statsdPort = isset( $statsdServer[1] ) ? $statsdServer[1] : 8125;
-               $statsdSender = new SocketSender( $statsdHost, $statsdPort );
-               $statsdClient = new StatsdClient( $statsdSender );
-               $statsdClient->send( $context->getStats()->getBuffer() );
+               try {
+                       $statsdServer = explode( ':', $config->get( 'StatsdServer' ) );
+                       $statsdHost = $statsdServer[0];
+                       $statsdPort = isset( $statsdServer[1] ) ? $statsdServer[1] : 8125;
+                       $statsdSender = new SocketSender( $statsdHost, $statsdPort );
+                       $statsdClient = new StatsdClient( $statsdSender, true, false );
+                       $statsdClient->send( $context->getStats()->getBuffer() );
+               } catch ( Exception $ex ) {
+                       MWExceptionHandler::logException( $ex );
+               }
        }
 
        # Profiling must actually be enabled...