/** * @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 ignoreTransaction() { $this->log('Ignoring transaction'); $this->interactor->ignoreTransaction(); }