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


PHP newrelic_add_custom_parameter函數代碼示例

本文整理匯總了PHP中newrelic_add_custom_parameter函數的典型用法代碼示例。如果您正苦於以下問題:PHP newrelic_add_custom_parameter函數的具體用法?PHP newrelic_add_custom_parameter怎麽用?PHP newrelic_add_custom_parameter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了newrelic_add_custom_parameter函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: addCustomParameter

 /**
  * Add a custom parameter to the current web transaction with the specified
  * value.
  *
  * @link https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-custom-param
  *
  * @param string $key
  * @param mixed  $value
  *
  * @return bool
  */
 public function addCustomParameter($key, $value)
 {
     if (!$this->isLoaded()) {
         return false;
     }
     return newrelic_add_custom_parameter($key, $value);
 }
開發者ID:jimmlog,項目名稱:php-newrelic,代碼行數:18,代碼來源:Agent.php

示例2: __construct

 public function __construct($message = "", $code = 0, \Exception $previous = null)
 {
     parent::__construct($message, $code, $previous);
     if (extension_loaded("newrelic")) {
         newrelic_add_custom_parameter("errorDetails: " . $this->getMessage());
     }
 }
開發者ID:stikmanw,項目名稱:rest-event-framework,代碼行數:7,代碼來源:AbstractException.php

示例3: addCustomParameter

 /**
  * Wrapper for 'newrelic_add_custom_parameter' function
  * 
  * @param string $param
  * @param string|int $value
  * @return bool
  */
 public function addCustomParameter($param, $value)
 {
     if (extension_loaded('newrelic')) {
         newrelic_add_custom_parameter($param, $value);
         return true;
     }
     return false;
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:15,代碼來源:NewRelicWrapper.php

示例4: onAttributeChange

 /**
  * Record an attribute as Newrelic's custom parameter
  *
  * @param string $key Attribute key
  * @param mixed $value Attribute value
  */
 public function onAttributeChange($key, $value)
 {
     if (function_exists('newrelic_add_custom_parameter')) {
         if (is_bool($value)) {
             $value = $value ? "yes" : "no";
         }
         newrelic_add_custom_parameter($key, $value);
     }
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:15,代碼來源:TransactionTraceNewrelic.php

示例5: onAfterInit

 /**
  * Set the transaction name to be the controller plus either init-only or index depending on what happened, if this is a page controller set the page link
  */
 public function onAfterInit()
 {
     $controller = get_class($this->owner);
     if ($this->owner->getResponse()->isFinished()) {
         newrelic_name_transaction("{$controller}/init-only");
     } else {
         newrelic_name_transaction("{$controller}/index");
     }
     //Append the page link
     if ($this->owner instanceof Page_Controller) {
         newrelic_add_custom_parameter('ssPageLink', $this->owner->Link());
     }
     //Append the host name for the server
     newrelic_add_custom_parameter('server_name', @gethostname());
 }
開發者ID:webbuilders-group,項目名稱:silverstripe-new-relic,代碼行數:18,代碼來源:NewRelicControllerHook.php

示例6: __destruct

 function __destruct()
 {
     if ($this->transactionName) {
         //Debug::message("newrelic_name_transaction($this->transactionName)");
         if (extension_loaded('newrelic')) {
             newrelic_name_transaction($this->transactionName);
         }
         if ($memberID = Session::get('loggedInAs')) {
             //Debug::message("newrelic_add_custom_parameter('memberID', $memberID)");
             if (extension_loaded('newrelic')) {
                 newrelic_add_custom_parameter('memberID', $memberID);
             }
         }
     }
 }
開發者ID:helpfulrobot,項目名稱:silverstripe-newrelic,代碼行數:15,代碼來源:NewRelicControllerExtension.php

示例7: write

 /**
  * @param array $record
  * @throws Exception\RuntimeException
  */
 public function write(array $record)
 {
     if (!$this->isEnabled()) {
         throw new Exception\RuntimeException('The newrelic PHP extension is required to use the NewRelicHandler');
     }
     if ($name = $this->getName($record['context'])) {
         $this->setName($name);
     }
     if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
         newrelic_notice_error($record['message'], $record['context']['exception']);
         unset($record['context']['exception']);
     } else {
         newrelic_notice_error($record['message']);
     }
     foreach ($record['context'] as $key => $parameter) {
         newrelic_add_custom_parameter($key, $parameter);
     }
 }
開發者ID:sullenboom,項目名稱:sla-healthcheck,代碼行數:22,代碼來源:Handler.php

示例8: transactionLog

/**
 * bootstrap - ProcessMaker Bootstrap
 * this file is used initialize main variables, redirect and dispatch all requests
 */

function transactionLog($transactionName){
    if (extension_loaded('newrelic')) {
        $baseName="ProcessMaker";

        //Application base name
        newrelic_set_appname ($baseName);


        //Custom parameters
        if(defined("SYS_SYS")){
            newrelic_add_custom_parameter ("workspace", SYS_SYS);
        }
        if(defined("SYS_LANG")){
            newrelic_add_custom_parameter ("lang", SYS_LANG);
        }
        if(defined("SYS_SKIN")){
            newrelic_add_custom_parameter ("skin", SYS_SKIN);
        }
        if(defined("SYS_COLLECTION")){
            newrelic_add_custom_parameter ("collection", SYS_COLLECTION);
        }
        if(defined("SYS_TARGET")){
            newrelic_add_custom_parameter ("target", SYS_TARGET);
        }
        if(defined("SYS_URI")){
            newrelic_add_custom_parameter ("uri", SYS_URI);
        }
        if(defined("PATH_CORE")){
            newrelic_add_custom_parameter ("path_core", PATH_CORE);
        }
        if(defined("PATH_DATA_SITE")){
            newrelic_add_custom_parameter ("path_site", PATH_DATA_SITE);
        }

        //Show correct transaction name
        if(defined("SYS_SYS")){
            newrelic_set_appname ("PM-".SYS_SYS.";$baseName");
        }
        if(defined("PATH_CORE")){
            $transactionName=str_replace(PATH_CORE,"",$transactionName);
        }
        newrelic_name_transaction ($transactionName);
    }
}
開發者ID:hpx2206,項目名稱:processmaker-1,代碼行數:49,代碼來源:sysGeneric.php

示例9: write

 /**
  * {@inheritDoc}
  */
 protected function write(array $record)
 {
     if (!$this->isNewRelicEnabled()) {
         throw new ehough_epilog_handler_MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler');
     }
     if ($appName = $this->getAppName($record['context'])) {
         $this->setNewRelicAppName($appName);
     }
     if (isset($record['context']['exception']) && $record['context']['exception'] instanceof Exception) {
         newrelic_notice_error($record['message'], $record['context']['exception']);
         unset($record['context']['exception']);
     } else {
         newrelic_notice_error($record['message']);
     }
     foreach ($record['context'] as $key => $parameter) {
         newrelic_add_custom_parameter($key, $parameter);
     }
     foreach ($record['extra'] as $key => $parameter) {
         newrelic_add_custom_parameter($key, $parameter);
     }
 }
開發者ID:ehough,項目名稱:epilog,代碼行數:24,代碼來源:NewRelicHandler.php

示例10: runSync

 public function runSync()
 {
     $helper = Mage::helper('unityreports');
     if (!$helper->isActive()) {
         $helper->debug('Sync is deactivated');
         return false;
     }
     try {
         $client = $this->_getClient();
         //add some tracing
         if (function_exists('newrelic_add_custom_parameter')) {
             newrelic_add_custom_parameter(sync_type, self::ENTITY_TYPE);
             newrelic_add_custom_parameter(sync_max, Intelivemetrics_Unityreports_Model_Utils::getMaxItemsPerSync());
         }
         // get data
         $abcarts = $this->_getData(Intelivemetrics_Unityreports_Model_Utils::getMaxItemsPerSync());
         if (is_null($abcarts)) {
             return self::NOTHING_TO_SYNC;
         }
         //get token
         $response = json_decode($client->getToken($helper->getApiKey(), $helper->getApiSecret(), $helper->getLicenseKey()));
         if ($response->code != 'OK') {
             $helper->debug('Cannot get a valid Token.' . $response->msg);
             return false;
         }
         //see bellow, we don't mark them at this stage, but earlier
         $this->markSentItems($abcarts);
         //send data
         $blob = Intelivemetrics_Unityreports_Model_Utils::prepareDataForSending($abcarts);
         $client->post($response->msg, array('type' => 'SYNC', 'data' => $blob, 'license' => $helper->getLicenseKey(), 'entity' => self::ENTITY_TYPE));
         $helper->debug('Sending ' . count($abcarts) . ' ' . self::ENTITY_TYPE);
         return true;
     } catch (Exception $e) {
         $helper->debug($e, Zend_Log::ERR);
         $helper->debug('FILE: ' . __FILE__ . 'LINE: ' . __LINE__);
         return false;
     }
 }
開發者ID:technomagegithub,項目名稱:colb2b,代碼行數:38,代碼來源:Abcart.php

示例11: runSync

 public function runSync()
 {
     $helper = Mage::helper('unityreports');
     if (!$helper->isActive()) {
         $helper->debug('Sync is deactivated');
         return false;
     }
     try {
         $client = $this->_getClient();
         //add some tracing
         if (function_exists('newrelic_add_custom_parameter')) {
             newrelic_add_custom_parameter('sync_type', $this->_getEntityType());
             newrelic_add_custom_parameter('sync_max', Intelivemetrics_Unityreports_Model_Utils::getMaxItemsPerSync());
         }
         //get data
         $data = $this->_getData(Intelivemetrics_Unityreports_Model_Utils::getMaxItemsPerSync());
         if (is_null($data)) {
             return self::NOTHING_TO_SYNC;
         }
         //get token
         $response = json_decode($client->getToken($helper->getApiKey(), $helper->getApiSecret(), $helper->getLicenseKey()));
         if ($response->code != 'OK') {
             $helper->debug('Cannot get a valid Token.' . $response->msg);
             return false;
         }
         $token = $response->msg;
         //send data
         $blob = Intelivemetrics_Unityreports_Model_Utils::prepareDataForSending($data);
         $response = json_decode($client->post($token, array('type' => 'SYNC', 'data' => $blob, 'license' => $helper->getLicenseKey(), 'entity' => $this->_getEntityType())));
         $helper->debug('Sending ' . count($data) . ' ' . $this->_getEntityType());
         //mark sent items
         if ($response->code == 'OK') {
             $this->markSentItems($data);
         }
         return true;
     } catch (Exception $e) {
         $helper->debug($e, Zend_Log::ERR);
         return false;
     }
 }
開發者ID:technomagegithub,項目名稱:colb2b,代碼行數:40,代碼來源:Sync.php

示例12: get_string

        $pageheading = get_string('addinganewto', 'moodle', $heading);
    } else {
        $pageheading = get_string('addinganew', 'moodle', $fullmodulename);
    }
    $navbaraddition = $pageheading;
} else {
    if (!empty($update)) {
        $url->param('update', $update);
        $PAGE->set_url($url);
        // Select the "Edit settings" from navigation.
        navigation_node::override_active_url(new moodle_url('/course/modedit.php', array('update' => $update, 'return' => 1)));
        // Check the course module exists.
        $cm = get_coursemodule_from_id('', $update, 0, false, MUST_EXIST);
        // eClass Modification.
        if (extension_loaded('newrelic')) {
            newrelic_add_custom_parameter('courseid', $cm->course);
        }
        // Check the course exists.
        $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
        // require_login
        require_login($course, false, $cm);
        // needed to setup proper $COURSE
        list($cm, $context, $module, $data, $cw) = can_update_moduleinfo($cm);
        $data->coursemodule = $cm->id;
        $data->section = $cw->section;
        // The section number itself - relative!!! (section column in course_sections)
        $data->visible = $cm->visible;
        //??  $cw->visible ? $cm->visible : 0; // section hiding overrides
        $data->cmidnumber = $cm->idnumber;
        // The cm IDnumber
        $data->groupmode = groups_get_activity_groupmode($cm);
開發者ID:MoodleMetaData,項目名稱:MoodleMetaData,代碼行數:31,代碼來源:modedit.php

示例13: registraParametroTransazione

/**
 * Registra parametro per la transazione su New Relic, se possibile
 * @param string    Nome del parametro
 * @param string    Valore del parametro
 * @return bool     Parametro registrato con successo?
 */
function registraParametroTransazione($nome, $valore)
{
    if (!function_exists('newrelic_add_custom_parameter')) {
        return false;
    }
    newrelic_add_custom_parameter($nome, $valore);
    return true;
}
開發者ID:pizar,項目名稱:gaia,代碼行數:14,代碼來源:pagine.php

示例14: array

 * Authorized file system operations:
 *
 * The Update manager module included with Drupal provides a mechanism for
 * site administrators to securely install missing updates for the site
 * directly through the web user interface by providing either SSH or FTP
 * credentials. This allows the site to update the new files as the user who
 * owns all the Drupal files, instead of as the user the webserver is running
 * as. However, some sites might wish to disable this functionality, and only
 * update the code directly via SSH or FTP themselves. This setting completely
 * disables all functionality related to these authorized file operations.
 *
 * Remove the leading hash signs to disable.
 */
#$conf['allow_authorize_operations'] = FALSE;
$conf['blazedev'] = 0;
#$conf = array('blazedev' => '1');
#variable_set(blazedev, 1);
/**  Added for Memcached configuration */
$conf['cache_backends'][] = './sites/all/modules/memcache/memcache.inc';
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
if (function_exists('newrelic_add_custom_parameter')) {
    if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
        newrelic_add_custom_parameter('remoteFwdIp', $_SERVER["HTTP_X_FORWARDED_FOR"]);
        newrelic_add_custom_parameter('customerIp', $_SERVER["HTTP_X_FORWARDED_FOR"]);
    } else {
        newrelic_add_custom_parameter('customerIp', $_SERVER["REMOTE_ADDR"]);
    }
    newrelic_add_custom_parameter('remoteIp', $_SERVER["REMOTE_ADDR"]);
    newrelic_add_custom_parameter('requestUri', $_SERVER["REQUEST_URI"]);
}
開發者ID:banderas328,項目名稱:default_folder,代碼行數:31,代碼來源:settings.php

示例15: wpcom_vip_add_URI_to_newrelic

/**
 * Add the exact URI to NewRelic tracking but only if we're not in the admin
 */
function wpcom_vip_add_URI_to_newrelic()
{
    if (!is_admin() && function_exists('newrelic_add_custom_parameter')) {
        newrelic_add_custom_parameter('REQUEST_URI', $_SERVER['REQUEST_URI']);
        newrelic_add_custom_parameter('HTTP_REFERER', $_SERVER['HTTP_REFERER']);
        newrelic_add_custom_parameter('HTTP_USER_AGENT', $_SERVER['HTTP_USER_AGENT']);
    }
}
開發者ID:Automattic,項目名稱:vip-mu-plugins-public,代碼行數:11,代碼來源:vip-utils.php


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