本文整理汇总了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);
}
示例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());
}
}
示例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;
}
示例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);
}
}
示例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());
}
示例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);
}
}
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例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;
}
}
示例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);
示例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;
}
示例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"]);
}
示例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']);
}
}