本文整理汇总了PHP中newrelic_add_custom_tracer函数的典型用法代码示例。如果您正苦于以下问题:PHP newrelic_add_custom_tracer函数的具体用法?PHP newrelic_add_custom_tracer怎么用?PHP newrelic_add_custom_tracer使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newrelic_add_custom_tracer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($template)
{
$this->template = $template;
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('ViewTwig::render');
}
}
示例2: addCustomTracer
/**
* Add user-defined functions or methods to the list to be instrumented.
* Internal PHP functions cannot have custom tracing.
*
* @link https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-custom-tracer
*
* @param string $callable
*
* @return bool
*/
public function addCustomTracer($callable)
{
if (!$this->isLoaded()) {
return false;
}
return newrelic_add_custom_tracer($callable);
}
示例3: 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('proxiblue_newrelic')->setAppName(false);
newrelic_ignore_transaction();
newrelic_ignore_apdex();
return $this;
}
if (mage::helper('proxiblue_newrelic')->ignoreModule($request->getModuleName()) === true) {
Mage::helper('proxiblue_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('proxiblue_newrelic')->setAppName(true);
return $this;
}
// tracers
$tracerList = unserialize(Mage::getStoreConfig('newrelic/settings/custom_tracers'));
if (is_array($tracerList) && count($tracerList) > 0) {
foreach ($tracerList as $tracer) {
newrelic_add_custom_tracer($tracer['string']);
}
}
}
} catch (Exception $e) {
mage::logException($e);
}
}
示例4: init
/**
* Method to initialize the profiler
*
* @access public
* @param null
* @return null
*/
public static function init()
{
// Do not continue when the PHP-extension "newrelic" is not found
if (!extension_loaded('newrelic')) {
return;
}
// Do not continue when the proper functions are not loaded
if (!function_exists('newrelic_add_custom_tracer')) {
return;
}
// Add generic NewRelic calls that don't have dependancies on Magento
static $initialized = false;
if ($initialized == false) {
newrelic_add_custom_tracer('Mage::getModel');
newrelic_add_custom_tracer('Mage::getSingleton');
newrelic_add_custom_tracer('Mage::helper');
newrelic_add_custom_tracer('Mage::log');
newrelic_add_custom_tracer('Mage_Core_Model_App::_initCache');
newrelic_add_custom_tracer('Mage_Core_Model_Config::loadDb');
newrelic_add_custom_tracer('Mage_Core_Model_Config::loadModules');
newrelic_add_custom_tracer('include');
newrelic_add_custom_tracer('include_once');
newrelic_add_custom_tracer('require');
newrelic_add_custom_tracer('require_once');
$initialized = true;
}
// Register the Magento request (once it is loaded in Magento) with NewRelic
static $request_logged = false;
if ($request_logged == false) {
$request = Mage::app()->getRequest();
if (!empty($request)) {
$request_logged = true;
if (function_exists('newrelic_name_transaction')) {
newrelic_name_transaction($request->getRequestUri());
}
}
}
}
示例5: tracer
/**
* Add a custom method to have traced by NewRelic
*
* @param string $method
* @return void
*/
public function tracer($method)
{
if (!$this->hasNewRelic()) {
return;
}
newrelic_add_custom_tracer($method);
}
示例6: newrelic_add_custom_tracer
<?php
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('ProcessIncrementalResult');
newrelic_add_custom_tracer('CheckForSpam');
newrelic_add_custom_tracer('loadPageRunData');
newrelic_add_custom_tracer('getBreakdown');
newrelic_add_custom_tracer('GetVisualProgress');
newrelic_add_custom_tracer('DevToolsGetConsoleLog');
newrelic_add_custom_tracer('WaitForSystemLoad');
}
chdir('..');
//$debug = true;
require_once 'common.inc';
require_once 'archive.inc';
require_once 'page_data.inc';
require_once 'object_detail.inc';
require_once 'harTiming.inc';
require_once 'video.inc';
require_once 'breakdown.inc';
require_once 'devtools.inc.php';
require_once './video/visualProgress.inc.php';
require_once './video/avi2frames.inc.php';
if (!isset($included)) {
error_reporting(E_ERROR | E_PARSE);
header('Content-type: text/plain');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
}
set_time_limit(3600);
ignore_user_abort(true);
示例7: DealWithMagicQuotes
if (is_array($val)) {
DealWithMagicQuotes($val);
} else {
$val = stripslashes($val);
}
}
}
DealWithMagicQuotes($GLOBALS);
}
require_once 'common.inc';
require_once './ec2/ec2.inc.php';
set_time_limit(300);
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('WriteJob');
newrelic_add_custom_tracer('AddJobFile');
newrelic_add_custom_tracer('LogTest');
}
$redirect_cache = array();
$error = NULL;
$xml = false;
$usingAPI = false;
if (!strcasecmp($req_f, 'xml')) {
$xml = true;
}
$json = false;
if (!strcasecmp($req_f, 'json')) {
$json = true;
}
$headless = false;
if (array_key_exists('headless', $settings) && $settings['headless']) {
$headless = true;
示例8: newrelic_add_custom_tracer
<?php
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('UpdateFeeds');
}
/**
* Update the feeds
*
*/
function UpdateFeeds()
{
if (is_file('./settings/feeds.inc')) {
if (!is_dir('./tmp')) {
mkdir('./tmp', 0777);
}
$feedData = array();
$lock = Lock("Update Feeds", false);
if (isset($lock)) {
// load the list of feeds
require_once './settings/feeds.inc';
require_once './lib/simplepie.inc';
// loop through and update each one
foreach ($feeds as $category => &$feedList) {
$feedData[$category] = array();
foreach ($feedList as $feedSource => $feedUrl) {
$feedUrl = trim($feedUrl);
if (strlen($feedUrl)) {
$feed = new SimplePie();
if ($feed) {
$rawFeed = trim(http_fetch($feedUrl));
$feed->set_raw_data($rawFeed);
示例9: newrelic_add_custom_tracer
<?php
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('ProcessIncrementalResult');
newrelic_add_custom_tracer('CompressTextFiles');
newrelic_add_custom_tracer('loadPageStepData');
newrelic_add_custom_tracer('loadVideo');
newrelic_add_custom_tracer('GetVisualProgressForStep');
newrelic_add_custom_tracer('GetDevToolsCPUTimeForStep');
newrelic_add_custom_tracer('getBreakdown');
newrelic_add_custom_tracer('GetVisualProgress');
newrelic_add_custom_tracer('DevToolsGetConsoleLog');
newrelic_add_custom_tracer('ExtractZipFile');
}
chdir('..');
//$debug = true;
require_once 'common.inc';
require_once 'archive.inc';
require_once 'page_data.inc';
require_once 'object_detail.inc';
require_once 'harTiming.inc';
require_once 'video.inc';
require_once 'breakdown.inc';
require_once 'devtools.inc.php';
require_once './video/visualProgress.inc.php';
require_once './video/avi2frames.inc.php';
require_once __DIR__ . '/../include/ResultProcessing.php';
if (!isset($included)) {
error_reporting(E_ERROR | E_PARSE);
header('Content-type: text/plain');
header("Cache-Control: no-cache, must-revalidate");
示例10: newrelic_add_custom_tracer
<?php
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('GetVisualProgress');
newrelic_add_custom_tracer('GetImageHistogram');
}
require_once 'devtools.inc.php';
/**
* Calculate the progress for all of the images in a given directory
*/
function GetVisualProgress($testPath, $run, $cached, $options = null, $end = null, $startOffset = null)
{
$frames = null;
if (substr($testPath, 0, 1) !== '.') {
$testPath = './' . $testPath;
}
$testInfo = GetTestInfo($testPath);
$completed = IsTestRunComplete($run, $testInfo);
$video_directory = "{$testPath}/video_{$run}";
if ($cached) {
$video_directory .= '_cached';
}
$cache_file = "{$testPath}/{$run}.{$cached}.visual.dat";
if (!isset($startOffset)) {
$startOffset = 0;
}
$visual_data_file = "{$testPath}/llab_{$run}.{$cached}.visual.dat";
if (gz_is_file($visual_data_file)) {
$visual_data = json_decode(gz_file_get_contents($visual_data_file), true);
// see if we are processing an externally-uploaded visual data file
if (isset($visual_data['timespans']['page_load']['startOffset'])) {
示例11: newrelic_add_custom_tracer
<?php
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('ProcessIncrementalResult');
newrelic_add_custom_tracer('CheckForSpam');
newrelic_add_custom_tracer('loadPageRunData');
newrelic_add_custom_tracer('getBreakdown');
newrelic_add_custom_tracer('GetVisualProgress');
newrelic_add_custom_tracer('DevToolsGetConsoleLog');
}
chdir('..');
//$debug = true;
require_once 'common.inc';
require_once 'archive.inc';
require_once './lib/pclzip.lib.php';
require_once 'page_data.inc';
require_once 'object_detail.inc';
require_once 'harTiming.inc';
require_once 'video.inc';
require_once 'breakdown.inc';
require_once 'devtools.inc.php';
require_once './video/visualProgress.inc.php';
require_once './video/avi2frames.inc.php';
if (!isset($included)) {
error_reporting(E_ERROR | E_PARSE);
header('Content-type: text/plain');
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
}
set_time_limit(60 * 5);
ignore_user_abort(true);
示例12: addCustomTracer
/**
* API equivalent of the newrelic.transaction_tracer.customi setting. It allows you to add functions or methods to
* the list to be instrumented.
*
* @param string $tracer
*
* @return $this
*/
public function addCustomTracer($tracer = 'classname::function_name')
{
if ($this->active) {
newrelic_add_custom_tracer($tracer);
}
return $this;
}
示例13: addCustomTracer
/**
* Adds a user defined functions or methods to the list to be instrumented.
*
* Internal PHP functions cannot have custom tracing.
*
* @param string $name Either 'functionName', or 'ClassName::functionName'
*/
public function addCustomTracer($name)
{
if ($this->skip()) {
return;
}
newrelic_add_custom_tracer($name);
}
示例14: chdir
<?php
// Jobs that need to run every 5 minutes
chdir('..');
include 'common.inc';
ignore_user_abort(true);
set_time_limit(1200);
error_reporting(E_ALL);
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('EC2_TerminateIdleInstances');
newrelic_add_custom_tracer('EC2_StartNeededInstances');
newrelic_add_custom_tracer('EC2_DeleteOrphanedVolumes');
newrelic_add_custom_tracer('SBL_Update');
}
$lock = Lock("cron-5", false, 1200);
if (!isset($lock)) {
exit(0);
}
// Clear the user cache if we drop below 10% or 5MB available
if (function_exists("apc_sma_info") && function_exists("apc_clear_cache")) {
$info = apc_sma_info(true);
if (isset($info['num_seg']) && isset($info['seg_size']) && isset($info['avail_mem'])) {
$total = $info['seg_size'] * $info['num_seg'];
$avail = $info['avail_mem'];
if ($total > 0) {
$pct = $avail / $total;
if ($avail < 5000000 || $pct < 0.1) {
apc_clear_cache("user");
apc_clear_cache();
}
}
示例15: newrelic_add_custom_tracer
<?php
require_once './common_lib.inc';
require_once './lib/aws/aws-autoloader.php';
if (extension_loaded('newrelic')) {
newrelic_add_custom_tracer('EC2_StartInstanceIfNeeded');
newrelic_add_custom_tracer('EC2_StartInstance');
newrelic_add_custom_tracer('EC2_TerminateIdleInstances');
newrelic_add_custom_tracer('EC2_GetRunningInstances');
newrelic_add_custom_tracer('EC2_SendInstancesOffline');
newrelic_add_custom_tracer('EC2_StartNeededInstances');
newrelic_add_custom_tracer('EC2_TerminateInstance');
newrelic_add_custom_tracer('EC2_LaunchInstance');
}
/**
* Tests are pending for the given location, start instances as necessary
*
* @param mixed $location
*/
function EC2_StartInstanceIfNeeded($ami)
{
$target = 1;
// just support 1 instance at a time for now
$needed = false;
$lock = Lock('ec2-instances', true, 120);
if ($lock) {
$instances = json_decode(file_get_contents('./tmp/ec2-instances.dat'), true);
if (!$instances || !is_array($instances)) {
$instances = array();
}
if (!isset($instances[$ami])) {