21use Liuggio\StatsdClient\Entity\StatsdDataInterface;
22use Liuggio\StatsdClient\Factory\StatsdDataFactoryInterface;
46 StatsdDataFactoryInterface $factory,
49 $this->factory = $factory;
50 $this->prefix = rtrim( $prefix,
'.' );
57 private function addPrefixToKey( $key ) {
58 return $this->prefix .
'.' . $key;
61 public function timing( $key, $time ) {
62 return $this->factory->timing( $this->addPrefixToKey( $key ), $time );
65 public function gauge( $key, $value ) {
66 return $this->factory->gauge( $this->addPrefixToKey( $key ), $value );
69 public function set( $key, $value ) {
70 return $this->factory->set( $this->addPrefixToKey( $key ), $value );
74 return $this->factory->increment( $this->addPrefixToKey( $key ) );
78 return $this->factory->decrement( $this->addPrefixToKey( $key ) );
82 return $this->factory->updateCount( $this->addPrefixToKey( $key ), $delta );
88 $metric = StatsdDataInterface::STATSD_METRIC_COUNT
90 return $this->factory->produceStatsdData(
91 $this->addPrefixToKey( $key ),
Proxy to prefix metric keys sent to a StatsdDataFactoryInterface.
__construct(StatsdDataFactoryInterface $factory, $prefix)
updateCount( $key, $delta)
produceStatsdData( $key, $value=1, $metric=StatsdDataInterface::STATSD_METRIC_COUNT)