/** * {@inheritdoc} */ public function getStats() { if (null === $this->request) { return array(); } $startTime = $this->request->server->get('REQUEST_TIME_FLOAT', $this->request->server->get('REQUEST_TIME')); if (null === $startTime) { return array(); } $elapsedTime = TimeUtil::getElapsedTime($startTime); return array(new Stat(StatsdDataInterface::STATSD_METRIC_TIMING, $elapsedTime)); }
public function postExecuteRequest(PostExecuteRequest $event) { $timeElapsed = TimeUtil::getElapsedTime($this->currentStartTime); if (!isset($this->currentRequest)) { throw new \RuntimeException('Request not set'); } if ($this->currentRequest !== $event->getRequest()) { throw new \RuntimeException('Requests differ'); } $this->addStat(new Stat(StatsdDataInterface::STATSD_METRIC_TIMING, $timeElapsed, array('solarium_endpoint' => $this->currentEndpoint->getKey(), 'solarium_request_method' => strtolower($event->getRequest()->getMethod()), 'solarium_response_status' => sprintf('%d', $event->getResponse()->getStatusCode())))); $this->currentRequest = null; $this->currentStartTime = null; $this->currentEndpoint = null; }
/** * {@inheritdoc} */ public function stopQuery() { $duration = TimeUtil::getElapsedTime($this->currentQueryStartTime); $this->addStat(new Stat(StatsdDataInterface::STATSD_METRIC_TIMING, $duration, $this->currentQueryParameters)); }