當前位置: 首頁>>代碼示例>>PHP>>正文


PHP newrelic_name_transaction函數代碼示例

本文整理匯總了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();
 }
開發者ID:vrtak-cz,項目名稱:newrelic-nette,代碼行數:34,代碼來源:OnRequestCallback.php

示例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());
     }
 }
開發者ID:arashrasoulzadeh,項目名稱:forkcms,代碼行數:30,代碼來源:Cronjob.php

示例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));
 }
開發者ID:coldtrick,項目名稱:newrelic,代碼行數:32,代碼來源:Router.php

示例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');
 }
開發者ID:baconbao,項目名稱:BaconBao_MVC_Framework_PHP,代碼行數:26,代碼來源:Router.class.php

示例5: setNameTransaction

 /**
  * @param $name
  */
 public function setNameTransaction($name)
 {
     $this->debug('Calling setNameTransaction', array($name));
     if ($this->functionExists('newrelic_name_transaction')) {
         newrelic_name_transaction($name);
     }
 }
開發者ID:baisoo,項目名稱:Yireo_NewRelic2,代碼行數:10,代碼來源:Agent.php

示例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);
     }
 }
開發者ID:Bobspadger,項目名稱:NewRelic,代碼行數:37,代碼來源:Observer.php

示例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());
     }
 }
開發者ID:bwgraves,項目名稱:forkcms,代碼行數:30,代碼來源:Cronjob.php

示例8: setNameTransaction

 /**
  * @param string $name
  */
 public function setNameTransaction($name)
 {
     $name = (string) $name;
     if ($this->getEnabled()) {
         newrelic_name_transaction($name);
     }
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:10,代碼來源:Newrelic.php

示例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));
     }
 }
開發者ID:brunitto,項目名稱:cakephp-new-relic,代碼行數:16,代碼來源:NameTransactionFilter.php

示例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);
 }
開發者ID:Nebo15,項目名稱:gandalf.api,代碼行數:14,代碼來源:NewRelicMiddleware.php

示例11: nameTransaction

 /**
  * {@inheritdoc}
  */
 public function nameTransaction($name)
 {
     if (!$this->extensionLoaded()) {
         return $this;
     }
     newrelic_name_transaction($name);
     return $this;
 }
開發者ID:simplicity-ag,項目名稱:NewRelic,代碼行數:11,代碼來源:Client.php

示例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);
 }
開發者ID:jippi,項目名稱:cakephp-newrelic,代碼行數:17,代碼來源:NewRelic.php

示例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;
 }
開發者ID:airtype,項目名稱:craft-httpmessagesnewrelicmiddleware,代碼行數:16,代碼來源:NewRelicMiddleware.php

示例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);
         });
     }
 }
開發者ID:hissy,項目名稱:addon_newrelic_apm,代碼行數:12,代碼來源:controller.php

示例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);
 }
開發者ID:vigm,項目名稱:advancedMD,代碼行數:19,代碼來源:Newrelic.php


注:本文中的newrelic_name_transaction函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。