|
@@ -125,12 +125,16 @@ class StatsD
|
|
} else {
|
|
} else {
|
|
$sampledData = $data;
|
|
$sampledData = $data;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ $sampledData = $data;
|
|
|
|
|
|
if (empty($sampledData)) {
|
|
if (empty($sampledData)) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// Wrap this in a try/catch - failures in any of this should be silently ignored
|
|
// Wrap this in a try/catch - failures in any of this should be silently ignored
|
|
|
|
+ $count = 1;
|
|
|
|
+ // print_r("Total: ".count($sampledData).PHP_EOL);
|
|
try {
|
|
try {
|
|
$host = $config->getConfig("statsd.host");
|
|
$host = $config->getConfig("statsd.host");
|
|
$port = $config->getConfig("statsd.port");
|
|
$port = $config->getConfig("statsd.port");
|
|
@@ -138,11 +142,20 @@ class StatsD
|
|
if (!$fp) {
|
|
if (!$fp) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ $count_send = 0;
|
|
foreach ($sampledData as $stat => $value) {
|
|
foreach ($sampledData as $stat => $value) {
|
|
|
|
+ // print_r("$count - $stat:$value".PHP_EOL);
|
|
|
|
+ $count++;
|
|
fwrite($fp, "$stat:$value");
|
|
fwrite($fp, "$stat:$value");
|
|
|
|
+ $count_send++;
|
|
|
|
+ if($count_send > 250) {
|
|
|
|
+ sleep(2);
|
|
|
|
+ $count_send = 0;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
fclose($fp);
|
|
fclose($fp);
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
|
+ // print_r($e->getMessage());
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|