private static function sendMessage($message, $stat, $value, $sampleRate) { // cannot proceed without loaded PluginEngine if (!class_exists('PluginEngine')) { return; } if ($sampleRate < 1) { $rand = mt_rand() / mt_getrandmax(); if ($rand > $sampleRate) { return; } } // cache the activated MetricsPlugins if (!self::$metricPlugins) { self::$metricPlugins = \PluginEngine::getPlugins('MetricsPlugin'); } // call every MetricPlugin foreach (self::$metricPlugins as $plugin) { call_user_func_array(array($plugin, $message), array($stat, $value, $sampleRate)); } }