/** * "exercise" one or more URLs * * This is just a dispatcher and iterator, the real work is done in other methods. * * Args: * A URL or filename containing a list of URLs * ...A list of URLs should be a text file with one URL per line * --count: the integer number of times to test the named URL(s) * --rand: if present will cause the exerciser to insert random get vars that (maybe) will prevent page caching * --redirection: the number of redirects to follow, 0 is default * --user_id: if present, will cause the request to be made with the specified user's authentication tokens * * Examples: * wp --url=wpsite.example.org go-newrelic exercise "http://wpsite.example.org/" --count=13 --rand * wp --url=wpsite.example.org go-newrelic exercise url-list.txt --count=13 --rand * while true; do wp --url=wpsite.example.org go-newrelic exercise url-list.txt --count=7 --rand; sleep 100; done * * TODO: * Metrics are collected for summation, but none is done. * Summation by URL and among a group of URLs would be great * Output in CSV form, maybe... */ public function exercise($args, $assoc_args) { // don't this in New Relic if (function_exists('newrelic_ignore_transaction')) { newrelic_ignore_transaction(); } //end if if (empty($args)) { WP_CLI::error('Please specify a URL (or file with URLs) to test.'); return; } //end if if (!is_array($assoc_args)) { $assoc_args = array(); } //end if if (file_exists($args[0]) && ($lines = file($args[0], FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES))) { shuffle($lines); foreach ($lines as $url) { $assoc_args['url'] = $this->find_url($url); self::test_url($assoc_args); } } else { $assoc_args['url'] = $this->find_url($args[0]); self::test_url($assoc_args); } //end else }
/** * Ignore the current transaction * * @return */ public function ignoreTransaction() { if (!$this->hasNewRelic()) { return; } newrelic_ignore_transaction(); }
/** * 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); } }
function disable_newrelic() { if (defined('DOING_CRON') || defined('DOING_AJAX')) { if (extension_loaded('newrelic')) { newrelic_ignore_transaction(); } } }
function init() { if (defined('DOING_CRON') && DOING_CRON == true) { if ($this->settingsobj->get_setting('ignore_cron')) { newrelic_ignore_transaction(); } } if (defined('DOING_AJAX') && DOING_AJAX == true) { newrelic_disable_autorum(); } if ($this->settingsobj->get_setting('application_id')) { newrelic_set_appname($this->settingsobj->get_setting('application_id')); } if ($this->settingsobj->get_setting('enable_newrelic_errors')) { } }
/** * Ignora la transazione su New Relic, se possibile * @return void */ function ignoraTransazione() { if (function_exists('newrelic_ignore_transaction')) { newrelic_ignore_transaction(); } }
return TRUE; //FOR DRUPAL 7 ONLY! //FILE IS SUPPOSED TO BE IN DRUPAL ROOT DIRECTORY (NEXT TO INDEX.PHP)!! // Register our shutdown function so that no other shutdown functions run before this one. // This shutdown function calls exit(), immediately short-circuiting any other shutdown functions, // such as those registered by the devel.module for statistics. register_shutdown_function('status_shutdown'); function status_shutdown() { exit; } // We want to ignore _ping.php from New Relic statistics, // because with 180rpm and less than 10s avg response times, // _ping.php skews the overall statistics significantly. if (extension_loaded('newrelic')) { newrelic_ignore_transaction(); } header("HTTP/1.0 503 Service Unavailable"); // Drupal bootstrap. define('DRUPAL_ROOT', getcwd()); require_once DRUPAL_ROOT . '/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE); // Build up our list of errors. $errors = array(); // Check that the main database is active. $result = db_query('SELECT * FROM {users} WHERE uid = 1'); if (!$result->rowCount()) { $errors[] = 'Master database not responding.'; } // Check that all memcache instances are running on this server. if (isset($conf['memcache_servers'])) {
/** * @link https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-ignore-transaction */ public function ignoreTransaction() { if ($this->isLoaded()) { newrelic_ignore_transaction(); } }
/** * Do the sync process for a site/blog call remotely only. * * @return array|bool */ public static function do_site_sync() { // Do not log into New Relic, because this function is slow and we know why if (extension_loaded('newrelic')) { newrelic_ignore_transaction(); } // Do not let the sync happen on the network blog if (BLOG_ID_CURRENT_SITE == get_current_blog_id()) { header('Content-type: application/json'); echo json_encode(false); exit; } set_error_handler(array('Kigo_Network_Cron', 'php_error_handler')); // Add our custom handler for wp_die() because some functions die on error, and we don't want the script to die ! add_filter('wp_die_ajax_handler', array('Kigo_Network_Cron', 'kigo_cron_wp_die_handler_filter')); $site_cron = new Kigo_Site_Cron(isset($_GET[self::GET_PARAM_FORCED_SYNC]) && $_GET[self::GET_PARAM_FORCED_SYNC] == 1); $ret = $site_cron->sync_entities() ? true : $site_cron->_errors; restore_error_handler(); header('Content-type: application/json'); echo json_encode($ret); exit; }
public function ignoreTransaction() { return newrelic_ignore_transaction(); }
/** * Do not generate metrics for this transaction. This is useful when you have transactions that are particularly * slow for known reasons and you do not want them always being reported as the transaction trace or skewing your * site averages. * * @return $this */ public function markIgnoreTransaction() { if ($this->active) { newrelic_ignore_transaction(); } return $this; }
/** * Do not generate metrics for this transaction. Useful if you have a * known particularly slow transaction that you do not want skewing your * metrics. */ public function ignoreTransaction() { if ($this->skip()) { return; } newrelic_ignore_transaction(); }
public static function ignore() { if (extension_loaded('newrelic')) { newrelic_ignore_transaction(); } }
/** * a method other plugins can call to ignore this transaction */ public function ignore() { newrelic_ignore_transaction(); newrelic_ignore_apdex(); }
/** * {@inheritdoc} */ public function ignoreTransaction() { if (!$this->extensionLoaded()) { return $this; } newrelic_ignore_transaction(); return $this; }
public function ignoreTransaction() { if ($this->getEnabled()) { newrelic_ignore_transaction(); } }
/** * cron_do_this_hourly * * @since 1.0 */ public function cron_do_this() { $settings = get_option('rpnrdisable-settings'); if (isset($settings['enable_cron_job']) && $settings['enable_cron_job'] == 1 || 'test_cronjob' == $_REQUEST['action']) { /* Newrelic. transactions. */ if (extension_loaded('newrelic')) { newrelic_ignore_transaction(TRUE); newrelic_ignore_apdex(TRUE); } } return true; }