-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#22047 Add Transaction name to NewRelic based on Command name
- Loading branch information
1 parent
a9a72b6
commit a1661a5
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
app/code/Magento/NewRelicReporting/Plugin/CommandPlugin.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
namespace Magento\NewRelicReporting\Plugin; | ||
|
||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\NewRelicReporting\Model\Config; | ||
use Magento\NewRelicReporting\Model\NewRelicWrapper; | ||
|
||
class CommandPlugin | ||
{ | ||
/** | ||
* @var Config | ||
*/ | ||
private $config; | ||
|
||
/** | ||
* @var NewRelicWrapper | ||
*/ | ||
private $newRelicWrapper; | ||
|
||
/** | ||
* @param Config $config | ||
* @param NewRelicWrapper $newRelicWrapper | ||
*/ | ||
public function __construct( | ||
Config $config, | ||
NewRelicWrapper $newRelicWrapper | ||
) { | ||
$this->config = $config; | ||
$this->newRelicWrapper = $newRelicWrapper; | ||
} | ||
|
||
public function beforeRun(\Symfony\Component\Console\Command\Command $command, ...$args) | ||
{ | ||
$this->newRelicWrapper->setTransactionName( | ||
sprintf('CLI %s', $command->getName()) | ||
); | ||
|
||
return $args; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters