public function end($metric, array $tags = array())
    {
        try {
            if (!isset($this->timers[$metric])) {
                throw new \RuntimeException("Timer for metric $metric was not started");
            }

            if (!empty($tags)) {
                $this->timers[$metric]->setTags(array_merge($this->timers[$metric]->getTags(), $tags));
            }

            $this->sendMetric($this->timers[$metric]->end());
            unset ($this->timers[$metric]);

        } catch (\Exception $exception) {
            $this->logException($exception);
        }

        return $this;
    }
public function end($metric, array $tags = array())
    {
        try {
            if (!isset($this->timers[$metric])) {
                throw new \RuntimeException("Timer for metric $metric was not started");
            }

            if (!empty($tags)) {
                $this->timers[$metric]->setTags(array_merge($this->timers[$metric]->getTags(), $tags));
            }

            $this->sendMetric($this->timers[$metric]->end());
            unset ($this->timers[$metric]);

        } catch (\Exception $exception) {
            $this->logException($exception);
        }

        return $this;
    }
public function end ( $ metric , array $ tags = array ( ) ) { try { if ( ! isset ( $ this -> timers [ $ metric ] ) ) { throw new \ RuntimeException ( "Timer for metric $metric was not started" ) ; } if ( ! empty ( $ tags ) ) { $ this -> timers [ $ metric ] -> setTags ( array_merge ( $ this -> timers [ $ metric ] -> getTags ( ) , $ tags ) ) ; } $ this -> sendMetric ( $ this -> timers [ $ metric ] -> end ( ) ) ; unset ( $ this -> timers [ $ metric ] ) ; } catch ( \ Exception $ exception ) { $ this -> logException ( $ exception ) ; } return $ this ; }
Ends a previously started timer

@param string $metric Metric name
@param array  $tags   Extra tags to set for the metric

@return $this
Ends a previously started timer