本文整理汇总了PHP中newrelic_name_transaction函数的典型用法代码示例。如果您正苦于以下问题:PHP newrelic_name_transaction函数的具体用法?PHP newrelic_name_transaction怎么用?PHP newrelic_name_transaction使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newrelic_name_transaction函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
* @param \Nette\Application\Application $application
* @param \Nette\Application\Request $request
*/
public function __invoke(Application $application, Request $request)
{
if (PHP_SAPI === 'cli') {
newrelic_background_job(TRUE);
}
$params = $request->getParameters();
$action = $request->getPresenterName();
if (isset($params[$this->actionKey])) {
$action = sprintf('%s:%s', $action, $params[$this->actionKey]);
}
if (!empty($this->map)) {
foreach ($this->map as $pattern => $appName) {
if ($pattern === '*') {
continue;
}
if (Strings::endsWith($pattern, '*')) {
$pattern = Strings::substring($pattern, 0, -1);
}
if (Strings::startsWith($pattern, ':')) {
$pattern = Strings::substring($pattern, 1);
}
if (Strings::startsWith($action, $pattern)) {
\VrtakCZ\NewRelic\Tracy\Bootstrap::setup($appName, $this->license);
break;
}
}
}
newrelic_name_transaction($action);
newrelic_disable_autorum();
}
示例2: execute
/**
* Execute the action
* We will build the classname, require the class and call the execute method.
*/
protected function execute()
{
if (extension_loaded('newrelic')) {
newrelic_background_job();
}
$this->loadConfig();
// build action-class-name
$actionClass = 'Backend\\Modules\\' . $this->getModule() . '\\Cronjobs\\' . $this->getAction();
if ($this->getModule() == 'Core') {
$actionClass = 'Backend\\Core\\Cronjobs\\' . $this->getAction();
}
// validate if class exists (aka has correct name)
if (!class_exists($actionClass)) {
// set correct headers
\SpoonHTTP::setHeadersByCode(500);
// throw exception
throw new Exception('The cronjobfile is present, but the classname should be: ' . $actionClass . '.');
}
// create action-object
$this->cronjob = new $actionClass($this->getKernel());
$this->cronjob->setModule($this->getModule());
$this->cronjob->setAction($this->getAction());
if (extension_loaded('newrelic')) {
newrelic_name_transaction('cronjob::' . $this->getModule() . '::' . $this->getAction());
}
}
示例3: buildTransaction
/**
* Build the named transaction based on an array of information from the route hook
*
* @param array $page_information the routing information
*
* @return void
*/
protected static function buildTransaction($page_information)
{
if (empty($page_information) || !is_array($page_information)) {
return;
}
$transaction = [];
$identifier = elgg_extract('identifier', $page_information);
if (!empty($identifier)) {
$transaction[] = $identifier;
}
// filter out usernames
$usernames = self::getUsernamesToIgnore();
$segments = elgg_extract('segments', $page_information);
if (!empty($segments) && is_array($segments)) {
foreach ($segments as $segment) {
if (is_numeric($segment) || in_array($segment, $usernames)) {
$transaction[] = '*';
break;
} else {
$transaction[] = $segment;
}
}
}
newrelic_name_transaction('/' . implode('/', $transaction));
}
示例4: route
public static function route(Request $request)
{
$controller = $request->getController() . 'Controller';
$method = $request->getMethod();
$args = $request->getArgs();
//$controllerFile = SITE_PATH.'controllers/'.$controller.'.php'; //***Because autoload
//if(is_readable($controllerFile)){ //***Because autoload
//require_once $controllerFile; //***Because autoload
$controller = new $controller();
$method = is_callable(array($controller, $method)) ? $method : 'index';
if (!empty($args)) {
//call_user_func_array(array($controller,$method),$args);
if (extension_loaded('newrelic')) {
newrelic_name_transaction((string) $request->getController() . '/' . (string) $method);
}
call_user_func(array($controller, $method), $args);
} else {
if (extension_loaded('newrelic')) {
newrelic_name_transaction((string) $request->getController() . '/' . (string) $method);
}
call_user_func(array($controller, $method), NULL);
}
return;
//} //***Because autoload
throw new Exception('404 - ' . $request->getController() . ' not found');
}
示例5: setNameTransaction
/**
* @param $name
*/
public function setNameTransaction($name)
{
$this->debug('Calling setNameTransaction', array($name));
if ($this->functionExists('newrelic_name_transaction')) {
newrelic_name_transaction($name);
}
}
示例6: controller_action_predispatch
/**
* Hook to record all fron controller events
* @param Varien_Event_Observer $observer
*/
public function controller_action_predispatch(Varien_Event_Observer $observer)
{
try {
if (extension_loaded('newrelic')) {
$controllerAction = $observer->getControllerAction();
$request = $controllerAction->getRequest();
$controllerName = explode("_", $request->getControllerName());
if (Mage::getStoreConfig('newrelic/settings/ignore_admin_routes') && $request->getRouteName() == 'adminhtml' || $request->getModuleName() == 'admin' || in_array('adminhtml', $controllerName)) {
Mage::Helper('newrelic')->setAppName(false);
newrelic_ignore_transaction();
newrelic_ignore_apdex();
return $this;
}
if (mage::helper('newrelic')->ignoreModule($request->getModuleName()) === true) {
Mage::Helper('newrelic')->setAppName(false);
newrelic_ignore_transaction();
newrelic_ignore_apdex();
return $this;
}
if (Mage::getStoreConfig('newrelic/settings/named_transactions')) {
$route = $request->getRouteName() . '/' . $request->getControllerName() . '/' . $request->getActionName();
if (Mage::getStoreConfig('newrelic/settings/add_module_to_named_transactions')) {
$route .= ' (module: ' . $request->getModuleName() . ')';
}
newrelic_name_transaction($route);
Mage::Helper('newrelic')->setAppName(true);
return $this;
}
}
} catch (Exception $e) {
mage::logException($e);
}
}
示例7: execute
/**
* Execute the action
* We will build the classname, require the class and call the execute method.
*/
protected function execute()
{
if (extension_loaded('newrelic')) {
newrelic_background_job();
}
$this->loadConfig();
// build action-class-name
$actionClass = 'Backend\\Modules\\' . $this->getModule() . '\\Cronjobs\\' . $this->getAction();
if ($this->getModule() == 'Core') {
$actionClass = 'Backend\\Core\\Cronjobs\\' . $this->getAction();
}
// validate if class exists (aka has correct name)
if (!class_exists($actionClass)) {
// set correct headers
header('HTTP/1.1 500 Internal Server Error');
// throw exception
throw new Exception('The cronjobfile ' . $actionClass . ' could not be found.');
}
// create action-object
$this->cronjob = new $actionClass($this->getKernel());
$this->cronjob->setModule($this->getModule());
$this->cronjob->setAction($this->getAction());
if (extension_loaded('newrelic')) {
newrelic_name_transaction('cronjob::' . $this->getModule() . '::' . $this->getAction());
}
}
示例8: setNameTransaction
/**
* @param string $name
*/
public function setNameTransaction($name)
{
$name = (string) $name;
if ($this->getEnabled()) {
newrelic_name_transaction($name);
}
}
示例9: beforeDispatch
/**
* beforeDispatch() method.
*
* Call the newrelic_name_transaction function when the newrelic extension
* is loaded.
*
* @param Cake\Event\Event $event The event.
* @return void
*/
public function beforeDispatch(Event $event)
{
if (extension_loaded('newrelic')) {
$request = $event->data['request'];
newrelic_name_transaction($this->nameTransaction($request));
}
}
示例10: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (extension_loaded('newrelic')) {
newrelic_name_transaction(sprintf('%s (%s)', $request->getRequestUri(), $request->method()));
}
return $next($request);
}
示例11: nameTransaction
/**
* {@inheritdoc}
*/
public function nameTransaction($name)
{
if (!$this->extensionLoaded()) {
return $this;
}
newrelic_name_transaction($name);
return $this;
}
示例12: start
/**
* Start a New Relic transaction
*
* @param string $name
* @return void
*/
public function start($name = null)
{
if (!$this->hasNewRelic()) {
return;
}
newrelic_start_transaction(NEW_RELIC_APP_NAME);
if ($name) {
$this->currentTransactionName = $name;
}
newrelic_name_transaction($this->currentTransactionName);
}
示例13: __invoke
/**
* Invoke
*
* @return void
*/
public function __invoke(Request $request, Response $response, callable $next)
{
if (!extension_loaded('newrelic')) {
$response = $next($request, $response);
return $response;
}
newrelic_name_transaction($request->getRoute()->getPattern());
newrelic_capture_params(true);
$response = $next($request, $response);
return $response;
}
示例14: on_start
public function on_start()
{
if (extension_loaded('newrelic')) {
$site = Config::get('newrelic.site') ? Config::get('newrelic.site') : 'concrete5';
newrelic_set_appname($site);
Events::addListener('on_page_view', function ($event) {
$c = $event->getPageObject();
$path = $c->getCollectionPath() ? $c->getCollectionPath() : '/';
newrelic_name_transaction($path);
});
}
}
示例15: name_transaction
/**
* Give New Relic a name for this transaction
*
* @access public
* @return void
*/
public function name_transaction()
{
$transaction_name = (string) ee()->uri->segment(1);
if (ee()->uri->segment(2) !== FALSE) {
$transaction_name .= '/' . ee()->uri->segment(2);
}
// Append site label if MSM is enabled to easily differentiate
// between similar requests
if (ee()->config->item('multiple_sites_enabled') == 'y') {
$transaction_name .= ' - ' . ee()->config->item('site_label');
}
newrelic_name_transaction($transaction_name);
}