public function NewRelicRpmCommands::preCommandNewrelicTransactionType in New Relic 2.x
Setup how we want to track any drush command in newrelic.
@hook pre-command *
@validate-module-enabled new_relic_rpm
File
- src/
Commands/ NewRelicRpmCommands.php, line 60  
Class
- NewRelicRpmCommands
 - Newrelic rpm drush commands.
 
Namespace
Drupal\new_relic_rpm\CommandsCode
public function preCommandNewrelicTransactionType() {
  $track_drush = $this->configFactory
    ->get('new_relic_rpm.settings')
    ->get('track_drush');
  if (empty($track_drush)) {
    $track_drush = NewRelicAdapterInterface::STATE_NORMAL;
  }
  if ($track_drush !== NewRelicAdapterInterface::STATE_NORMAL) {
    $this->adapter
      ->setTransactionState($track_drush);
    // Let the user know if they run verbose drush.
    $message = $track_drush == NewRelicAdapterInterface::STATE_IGNORE ? 'Newrelic is set to ignore this command' : 'Newrelic is set to track this command as a background task';
    $this
      ->logger()
      ->info($message);
  }
}