/** * @param ConsoleCommandEvent $event */ public function onConsoleCommand(ConsoleCommandEvent $event) { $command = $event->getCommand(); $input = $event->getInput(); if (in_array($command->getName(), $this->ignoredCommands)) { $this->interactor->ignoreTransaction(); } if ($this->newRelic->getName()) { $this->interactor->setApplicationName($this->newRelic->getName(), $this->newRelic->getLicenseKey(), $this->newRelic->getXmit()); } $this->interactor->setTransactionName($command->getName()); $this->interactor->enableBackgroundJob(); // send parameters to New Relic foreach ($input->getOptions() as $key => $value) { $key = '--' . $key; if (is_array($value)) { foreach ($value as $k => $v) { $this->interactor->addCustomParameter($key . '[' . $k . ']', $v); } } else { $this->interactor->addCustomParameter($key, $value); } } foreach ($input->getArguments() as $key => $value) { if (is_array($value)) { foreach ($value as $k => $v) { $this->interactor->addCustomParameter($key . '[' . $k . ']', $v); } } else { $this->interactor->addCustomParameter($key, $value); } } }
/** * {@inheritdoc} */ public function setApplicationName($name, $key = null, $xmit = false) { $this->log(sprintf('Setting New Relic Application name to %s', $name)); $this->interactor->setApplicationName($name, $key, $xmit); }