-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
174 additions
and
24 deletions.
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
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
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
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,30 @@ | ||
<?php | ||
namespace NewRelic\Listener; | ||
|
||
use Zend\EventManager\EventManagerInterface as Events; | ||
use Zend\Mvc\MvcEvent; | ||
|
||
class IgnoreApdexListener extends AbstractTransactionListener | ||
{ | ||
/** | ||
* @param Events $events | ||
* @return void | ||
*/ | ||
public function attach(Events $events) | ||
{ | ||
$this->listeners[] = $events->attach(MvcEvent::EVENT_ROUTE, array($this, 'onRequest'), -99); | ||
} | ||
|
||
/** | ||
* @param MvcEvent $e | ||
* @return void | ||
*/ | ||
public function onRequest(MvcEvent $e) | ||
{ | ||
if (!$this->isMatchedRequest($e)) { | ||
return; | ||
} | ||
|
||
$this->client->ignoreApdex(); | ||
} | ||
} |
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
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
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
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
10 changes: 5 additions & 5 deletions
10
...ice/IgnoredTransactionListenerFactory.php → ...ic/Service/IgnoreApdexListenerFactory.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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
<?php | ||
namespace NewRelic\Service; | ||
|
||
use NewRelic\Listener\IgnoredTransactionListener; | ||
use NewRelic\Listener\IgnoreApdexListener; | ||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* NewRelic ignored transaction listener factory | ||
* NewRelic ignore apdex listener factory | ||
*/ | ||
class IgnoredTransactionListenerFactory implements FactoryInterface | ||
class IgnoreApdexListenerFactory implements FactoryInterface | ||
{ | ||
/** | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return IgnoredTransactionListener | ||
* @return IgnoreApdexListener | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$moduleOptions = $serviceLocator->get('NewRelic\ModuleOptions'); | ||
|
||
return new IgnoredTransactionListener($moduleOptions->getIgnoredTransactions()); | ||
return new IgnoreApdexListener($moduleOptions->getIgnoredApdex()); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
namespace NewRelic\Service; | ||
|
||
use NewRelic\Listener\IgnoreTransactionListener; | ||
use Zend\ServiceManager\FactoryInterface; | ||
use Zend\ServiceManager\ServiceLocatorInterface; | ||
|
||
/** | ||
* NewRelic ignore transaction listener factory | ||
*/ | ||
class IgnoreTransactionListenerFactory implements FactoryInterface | ||
{ | ||
/** | ||
* @param ServiceLocatorInterface $serviceLocator | ||
* @return IgnoreTransactionListener | ||
*/ | ||
public function createService(ServiceLocatorInterface $serviceLocator) | ||
{ | ||
$moduleOptions = $serviceLocator->get('NewRelic\ModuleOptions'); | ||
|
||
return new IgnoreTransactionListener($moduleOptions->getIgnoredTransactions()); | ||
} | ||
} |
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
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,37 @@ | ||
<?php | ||
namespace NewRelic\Service; | ||
|
||
class IgnoreApdexListenerFactoryTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var IgnoreApdexListenerFactory | ||
*/ | ||
protected $ignoreApdexListenerFactory; | ||
|
||
public function setUp() | ||
{ | ||
$this->ignoreApdexListenerFactory = new IgnoreApdexListenerFactory(); | ||
} | ||
|
||
public function testCreateService() | ||
{ | ||
$moduleOptions = $this->getMock('NewRelic\ModuleOptions'); | ||
$moduleOptions | ||
->expects($this->once()) | ||
->method('getIgnoredApdex') | ||
->will($this->returnValue(array())); | ||
|
||
$serviceManager = $this->getMockBuilder('Zend\ServiceManager\ServiceManager') | ||
->disableOriginalConstructor() | ||
->setMethods(array('get')) | ||
->getMock(); | ||
|
||
$serviceManager->expects($this->once()) | ||
->method('get') | ||
->will($this->returnValue($moduleOptions)); | ||
|
||
$listener = $this->ignoreApdexListenerFactory->createService($serviceManager); | ||
|
||
$this->assertInstanceOf('NewRelic\Listener\IgnoreApdexListener', $listener); | ||
} | ||
} |
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