Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/Liuggio/StatsdClient/Entity/StatsdData.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Liuggio\StatsdClient\Entity\StatsdDataInterface;


class StatsdData implements StatsdDataInterface
{

Expand Down Expand Up @@ -56,6 +55,7 @@ public function getMetric()
}

/**
* @param bool $withMetric
* @return string
*/
public function getMessage($withMetric = true)
Expand All @@ -74,5 +74,4 @@ public function __toString()
{
return $this->getMessage();
}

}
4 changes: 2 additions & 2 deletions src/Liuggio/StatsdClient/Factory/StatsdDataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Liuggio\StatsdClient\Entity\StatsdDataInterface;


class StatsdDataFactory implements StatsdDataFactoryInterface
{
/**
Expand Down Expand Up @@ -86,7 +85,8 @@ public function produceStatsdData($key, $value = 1, $metric = StatsdDataInterfac
/**
* {@inheritDoc}
**/
public function produceStatsdDataEntity() {
public function produceStatsdDataEntity()
{
$statsdData = $this->getEntityClass();
return new $statsdData();
}
Expand Down
16 changes: 6 additions & 10 deletions src/Liuggio/StatsdClient/Factory/StatsdDataFactoryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

use Liuggio\StatsdClient\Entity\StatsdDataInterface;


Interface StatsdDataFactoryInterface
{

/**
* This function creates a 'timing' StatsdData
*
* @abstract
* @param string|array $stats The metric(s) to set.
* @param string|array $key The metric(s) to set.
* @param float $time The elapsed time (ms) to log
**/
function timing($key, $time);
Expand All @@ -21,7 +20,7 @@ function timing($key, $time);
* This function creates a 'gauge' StatsdData
*
* @abstract
* @param string|array $stats The metric(s) to set.
* @param string|array $key The metric(s) to set.
* @param float $value The value for the stats.
**/
function gauge($key, $value);
Expand All @@ -30,7 +29,7 @@ function gauge($key, $value);
* This function creates a 'set' StatsdData object
* A "Set" is a count of unique events.
* This data type acts like a counter, but supports counting
* of unique occurences of values between flushes. The backend
* of unique occurrences of values between flushes. The backend
* receives the number of unique events that happened since
* the last flush.
*
Expand All @@ -39,7 +38,7 @@ function gauge($key, $value);
* with each request with a key of "uniques" (or similar).
*
* @abstract
* @param string|array $stats The metric(s) to set.
* @param string|array $key The metric(s) to set.
* @param float $value The value for the stats.
* @return array
**/
Expand Down Expand Up @@ -70,12 +69,9 @@ function decrement($key);
*
* @abstract
* @param string $key The key of the metric
* @param int|1 $value The amount to increment/decrement each metric by.
* @param string|c $metric The metric type ("c" for count, "ms" for timing, "g" for gauge, "s" for set)
* @param int $value The amount to increment/decrement each metric by.
* @param string $metric The metric type ("c" for count, "ms" for timing, "g" for gauge, "s" for set)
* @return StatsdDataInterface
**/
function produceStatsdData($key, $value = 1, $metric = StatsdDataInterface::STATSD_METRIC_COUNT);



}
9 changes: 6 additions & 3 deletions src/Liuggio/StatsdClient/Sender/EchoSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@
/**
* {@inheritDoc}
*/
public function open() {
public function open()
{
echo "[open]";
return true;
}

/**
* {@inheritDoc}
*/
function write($handle, $message, $length = null){
function write($handle, $message, $length = null)
{
echo "[$message]";
return strlen($message);
}

/**
* {@inheritDoc}
*/
function close($handle){
function close($handle)
{
echo "[closed]";
}
}
1 change: 0 additions & 1 deletion src/Liuggio/StatsdClient/StatsdClientInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@
* @return integer the data sent in bytes
*/
function send($data, $sampleRate = 1);

}