Skip to content

Commit

Permalink
Merge pull request EverexIO#150 from timophey01/add-statsd-metrix
Browse files Browse the repository at this point in the history
fix send-merics with server prefix
  • Loading branch information
ArtemKo7v authored May 30, 2019
2 parents b858283 + e099f70 commit 36a98c0
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions service/lib/metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ static protected function getConnections() {

static public function sendMetrics() {
if (!(empty(self::$metric))) {
$time = microtime(true);
$endTime = false;
self::sendAllTimingWithPrefix();
if (
isset(self::$statsdOptions['duplicate_metrics_with_hostname']) &&
Expand All @@ -105,8 +107,20 @@ static public function sendMetrics() {
$hostname = explode('.', gethostname())[0];
if (!empty($hostname)) {
self::sendAllTimingWithPrefix($hostname);
$endTime = microtime(true) - $time;
self::$statsd->timing(
$hostname . '.statsd.metric-send',
$endTime
);
}
}
if (!$endTime) {
$endTime = microtime(true) - $time;
}
self::$statsd->timing(
self::STATSD_TOTAL_SERVER_NAME . '.statsd.metric-send',
$endTime
);
self::$timings = [];
}
}
Expand Down

0 comments on commit 36a98c0

Please sign in to comment.