/** * Sets the name of the application to string. The string uses the same format as newrelic.appname and can set * multiple application names by separating each with a semi-colon. The first application name is the primary name, * and up to two extra application names can be specified. This function should be called as early as possible, and * will have no effect if called after the RUM footer has been sent. You may want to consider setting the * application name in a file loaded by PHP's auto_prepend_file INI setting. This function returns true if it * succeeded or false otherwise. * * @param string $name * * @return $this */ public function setAppName($name) { if ($this->active) { newrelic_set_appname($name); } return $this; }
public function setAppName($name) { $this->appname = $name; if (extension_loaded('newrelic')) { newrelic_set_appname($name); } }
/** * Change the application name * * @param string $name * @return void */ public function applicationName($name) { if (!$this->hasNewRelic()) { return; } newrelic_set_appname($name); }
/** * @param string $appName * @param string|null $license */ public static function setup($appName, $license = NULL) { if ($license === NULL) { newrelic_set_appname($appName); } else { newrelic_set_appname($appName, $license); } }
/** * Sets the NewRelic application that should receive this log. * * @param $name * @return $this */ public function setName($name) { if ($this->isEnabled()) { newrelic_set_appname($name); } else { ini_set('newrelic.appname', $name); } $this->name = $name; return $this; }
/** * sets the configured app name to newrelic */ public function setConfiguredAppName() { if (!extension_loaded('newrelic')) { return; } $name = "TYPO3 Portal"; if (isset($this->configuration['appname']) && !empty($this->configuration['appname'])) { $name = $this->configuration['appname']; } newrelic_set_appname($name); }
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); }); } }
/** * Set the application name * * @access public * @return void */ public function set_appname() { $appname = (string) ee()->config->item('newrelic_app_name'); // ------------------------------------------- // Hidden Configuration Variable // - newrelic_app_name => Change application name that appears in // the New Relic dashboard // -------------------------------------------*/ if (!empty($appname)) { $appname .= ' - '; } newrelic_set_appname($appname . APP_NAME . ' v' . APP_VER); }
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')) { } }
/** * Initialize Newrelic Metric Provider and add it to SugarMetric_Manager listeners chain * * @param array $additionalParams */ public function __construct(array $additionalParams) { if ($this->isLoaded = extension_loaded('newrelic')) { foreach ($additionalParams as $name => $param) { switch (strtolower($name)) { case 'applicationname': newrelic_set_appname($param); break; default: break; } } } else { if (isset($GLOBALS['log'])) { $GLOBALS['log']->debug('SugarMetric_Provider_Newrelic: newrelic php extension is not loaded on server'); } } }
/** * 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); } }
/** * Set the application name * * @access public * @return void */ public function set_appname() { $appname = (string) ee()->config->item('newrelic_app_name'); // ------------------------------------------- // Hidden Configuration Variable // - newrelic_app_name => Change application name that appears in // the New Relic dashboard // -------------------------------------------*/ if (!empty($appname)) { $appname .= ' - '; } // ------------------------------------------- // Hidden Configuration Variable // - newrelic_include_version_number => Whether or not to include the version // number with the application name // -------------------------------------------*/ $version = ee()->config->item('newrelic_include_version_number') == 'y' ? ' v' . APP_VER : ''; newrelic_set_appname($appname . APP_NAME . $version); }
/** * add more info now that we know it */ public function init() { // set the app name newrelic_set_appname($this->go_newrelic->get_appname()); // not all versions of the php extension support this method if (!function_exists('newrelic_set_user_attributes')) { return; } // END if // see https://newrelic.com/docs/features/browser-traces#set_user_attributes // for docs on how to use the user info in the transaction trace if (is_user_logged_in()) { $user = wp_get_current_user(); newrelic_set_user_attributes($user->ID, '', array_shift($user->roles)); } else { newrelic_set_user_attributes('not-logged-in', '', 'no-role'); } // END else }
public function __construct($go_newrelic) { // get the calling object $this->go_newrelic = $go_newrelic; // can't lazy load the config, we need $this->config = $this->go_newrelic->config(); // the license key is typically set elsewhere during the daemon/module installation, // but this allows some potential future where the license key is set in the WP dashboard if (!empty($this->config['license'])) { ini_set('newrelic.license', $this->config['license']); } // END if // set the app name newrelic_set_appname($this->go_newrelic->get_appname()); // basic settings // make sure the config isn't empty or invalid for any of these // ...sanity and validation intentionally skipped for performance reasons ini_set('newrelic.framework', 'wordpress'); ini_set('newrelic.transaction_tracer.detail', $this->config['transaction-tracer-detail']); ini_set('newrelic.error_collector.enabled', $this->config['error-collector-enabled']); if (isset($this->config['capture-params']) && $this->config['capture-params']) { newrelic_capture_params(); } // END if ini_set('newrelic.ignored_params', $this->go_newrelic->config('ignored-params')); // set logging parameters based on request context // ajax responses _cannot_ have RUM in them, for example if (is_admin()) { if (defined('DOING_AJAX') && DOING_AJAX) { newrelic_disable_autorum(); } // END if } elseif (defined('DOING_CRON') && DOING_CRON) { newrelic_disable_autorum(); } else { // add more tracking of the template pieces add_action('template_include', array($this, 'template_include')); } // END else // track the user info add_action('init', array($this, 'init')); }
/** * Bootstrap the application events. * * @return void */ public function boot() { $this->loadViewsFrom(__DIR__ . '/../resources/views/', 'core'); $this->publishes([__DIR__ . '/../resources/views' => base_path('resources/views/vendor/core'), __DIR__ . '/../resources/views/errors' => base_path('resources/views/errors')], 'views'); // translations $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'core'); /* |-------------------------------------------------------------------------- | New Relic app name |-------------------------------------------------------------------------- */ if (extension_loaded('newrelic')) { newrelic_set_appname(''); } /* |-------------------------------------------------------------------------- | Commands. |--------------------------------------------------------------------------| */ $this->commands('command.install'); $this->commands('command.cachekeyprefix'); $this->commands('command.database'); }
<?php /** Production */ ini_set('display_errors', 0); define('WP_DEBUG_DISPLAY', false); define('SCRIPT_DEBUG', false); /** Disable all file modifications including updates and update notifications */ define('DISALLOW_FILE_MODS', true); /** new relic */ if (extension_loaded('newrelic')) { newrelic_set_appname(env('SITENAME')); }
public function setConfig() { if ($this->getEnabled()) { newrelic_set_appname($this->_appName); } }
<?php define('SS_NR_BASE', basename(dirname(__FILE__))); Config::inst()->update('NewRelicPerformanceReport', 'menu_icon', SS_NR_BASE . '/images/new-relic.png'); //Configure new relic monitoring if (extension_loaded('newrelic')) { //Bind to the controller class Controller::add_extension('NewRelicControllerHook'); //If we have an application name constant ensure New Relic knows what the name is if (defined('SS_NR_APPLICATION_NAME')) { newrelic_set_appname(SS_NR_APPLICATION_NAME); } //If we're in cli make sure New Relic is aware that we are if (Director::is_cli()) { newrelic_background_job(true); } //New Relic error binders if (Director::isLive() || defined('SS_NR_FORCE_ENABLE_LOGGING')) { SS_Log::add_writer(new NewRelicErrorLogger(), SS_Log::NOTICE); SS_Log::add_writer(new NewRelicErrorLogger(), SS_Log::WARN); SS_Log::add_writer(new NewRelicErrorLogger(), SS_Log::ERR); } }
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); if (strlen($_SERVER['PHP_AUTH_USER']) == 0 || strlen($_SERVER['PHP_AUTH_PW']) == 0) { unset($_SERVER['PHP_AUTH_USER']); unset($_SERVER['PHP_AUTH_PW']); } } } BasicAuth::protect_entire_site(); } // CodeEditorField integration if (class_exists('CodeEditorField')) { HtmlEditorConfig::get('cms')->enablePlugins(array('aceeditor' => '../../../codeeditorfield/javascript/tinymce/editor_plugin_src.js')); HtmlEditorConfig::get('cms')->insertButtonsBefore('fullscreen', 'aceeditor'); HtmlEditorConfig::get('cms')->removeButtons('code'); } if (defined('DEVTOOLKIT_USE_APC') && DEVTOOLKIT_USE_APC) { SS_Cache::add_backend('two_level', 'Two-Levels', array('slow_backend' => 'File', 'fast_backend' => 'APC', 'slow_backend_options' => array('cache_dir' => TEMP_FOLDER))); SS_Cache::pick_backend('two_level', 'any', 10); } if (defined('DEVTOOLKIT_USE_MEMCACHED') && DEVTOOLKIT_USE_MEMCACHED) { // Note : this use the Memcache extension, not the Memcached extension // (with a 'd' - which use libmemcached) // Install from https://pecl.php.net/package/memcache // For windows : https://mnshankar.wordpress.com/2011/03/25/memcached-on-64-bit-windows/ SS_Cache::add_backend('two_level', 'Two-Levels', array('slow_backend' => 'File', 'fast_backend' => 'Memcached', 'slow_backend_options' => array('cache_dir' => TEMP_FOLDER), 'fast_backend_options' => array('servers' => array('host' => defined('MEMCACHE_HOST') ? MEMCACHE_HOST : 'localhost', 'port' => defined('MEMCACHE_PORT') ? MEMCACHE_PORT : 11211, 'persistent' => true, 'weight' => 1, 'timeout' => 5, 'retry_interval' => 15, 'status' => true, 'failure_callback' => null)))); SS_Cache::pick_backend('two_level', 'any', 10); } // Really basic newrelic integration if (defined('NEWRELIC_APP_NAME')) { newrelic_set_appname(NEWRELIC_APP_NAME . ";Silverstripe"); }
public function setAppName($name) { newrelic_set_appname($name); }
/** * Sets the NewRelic application that should receive this log. * * @param string $appName */ protected function setNewRelicAppName($appName) { newrelic_set_appname($appName); }
<?php if (extension_loaded('newrelic')) { newrelic_set_appname('DAEMON: FE Points'); } /** * Batch to send push notifications * * @author Johnson Song <*****@*****.**> * @copyright Play It Gaming Inc. * @version v1.0.1 * * If you have any questions or comments, please email: johnson@playitinteractive.com */ error_reporting(E_ALL); set_time_limit(0); include_once dirname(__FILE__) . '/include/include.const.php'; $script_pid_file = '/tmp/.group_push_notifications_process_id'; //run now? if (file_exists($script_pid_file) && is_readable($script_pid_file)) { $pid = file_get_contents($script_pid_file); $pid = (int) trim($pid); if (isPidRunning($pid)) { error_log('[' . date("Y-m-d H:i:s") . '] The daemon script group_push_notifications.php is still running now. Try next time.'); exit(0); } } $pid = posix_getpid(); if (file_put_contents($script_pid_file, $pid) === FALSE) { error_log('[' . date("Y-m-d H:i:s") . '] The daemon script group_push_notifications.php has problem to write process ID into file ' . $script_pid_file); exit(0);
| to the user if maintenace mode is in effect for this application. | */ App::down(function () { return Response::make("Be right back!", 503); }); /* |-------------------------------------------------------------------------- | Require The Filters File |-------------------------------------------------------------------------- | | Next we will load the filters file for the application. This gives us | a nice separate location to store our route and application filter | definitions instead of putting them all in the main routes file. | */ require app_path() . '/filters.php'; /* |-------------------------------------------------------------------------- | New Relic app name |-------------------------------------------------------------------------- */ if (extension_loaded('newrelic')) { newrelic_set_appname(''); } /* |-------------------------------------------------------------------------- | HTML macros. |--------------------------------------------------------------------------| */ require app_path() . '/TypiCMS/Macros.php';
| | Here we will register all of the application's service providers which | are used to bind services into the container. Service providers are | totally optional, so you are not required to uncomment this line. | */ // $app->register('App\Providers\AppServiceProvider'); /* |-------------------------------------------------------------------------- | Load The Application Routes |-------------------------------------------------------------------------- | | Next we will include the routes file so that they can all be added to | the application. This will provide all of the URLs the application | can respond to, as well as the controllers that may handle them. | */ require __DIR__ . '/../app/Http/routes.php'; /* |-------------------------------------------------------------------------- | New Relic App Name |-------------------------------------------------------------------------- | | If the extension `newrelic` is loaded then | set the name of the app to something. | */ if (extension_loaded('newrelic')) { newrelic_set_appname('Lissandra'); } return $app;
<?php define('GD_VIP', '184.168.47.225'); define('GD_RESELLER', 1); // Newrelic tracking if (function_exists('newrelic_set_appname')) { newrelic_set_appname('06c2f2f0-90c8-44d9-a91c-75efd517126f;' . ini_get('newrelic.appname')); } /** * Is this is a mobile client? Can be used by batcache. * @return array */ function is_mobile_user_agent() { return array("mobile_browser" => !in_array($_SERVER['HTTP_X_UA_DEVICE'], array('bot', 'pc')), "mobile_browser_tablet" => false !== strpos($_SERVER['HTTP_X_UA_DEVICE'], 'tablet-'), "mobile_browser_smartphones" => in_array($_SERVER['HTTP_X_UA_DEVICE'], array('mobile-iphone', 'mobile-smartphone', 'mobile-firefoxos', 'mobile-generic')), "mobile_browser_android" => false !== strpos($_SERVER['HTTP_X_UA_DEVICE'], 'android')); }
/** * @link https://docs.newrelic.com/docs/agents/php-agent/configuration/php-agent-api#api-set-appname * * @param string $name * @param string $license * @param bool $xmit * * @return bool */ public function setAppname($name, $license = null, $xmit = false) { if (!$this->isLoaded()) { return false; } return newrelic_set_appname($name, $license ?: ini_get('newrelic.license'), $xmit); }
/** * @param $name * @param $license * @param $xmit */ public function setAppName($name, $license, $xmit) { $parameters = func_get_args(); $this->debug('Calling setAppName', $parameters); if (!empty($name) && $this->functionExists('newrelic_set_appname')) { newrelic_set_appname($name, $license, $xmit); } }
{ $controller = get_class($this->owner); $this->transactionName = "{$controller}/{$action}"; } 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); } } } } } // Set-up calls if (extension_loaded('newrelic')) { //newrelic_add_custom_tracer("Director::direct,SSViewer::process"); // Set the name to the vhost for client-side scripts // To do: get robust way of picking the canoncial hostname for www requests too if (Director::is_cli() && isset($_SERVER['HTTP_HOST'])) { newrelic_set_appname($_SERVER['HTTP_HOST']); } // Distinguish background from web requests more reliably newrelic_background_job(Director::is_cli()); }
/** * Helper function to set the application name used to report */ public function setAppName($xmit = true) { if (extension_loaded('newrelic')) { $application_name = Mage::getStoreConfig('newrelic/api/application_name'); $license_key = Mage::getStoreConfig('newrelic/api/license_key'); return newrelic_set_appname($application_name, $license_key, $xmit); } }
| Next, we need to bind some important interfaces into the container so | we will be able to resolve them when needed. The kernels serve the | incoming requests to this application from both the web and CLI. | */ $app->singleton(Illuminate\Contracts\Http\Kernel::class, App\Http\Kernel::class); $app->singleton(Illuminate\Contracts\Console\Kernel::class, App\Console\Kernel::class); $app->singleton(Illuminate\Contracts\Debug\ExceptionHandler::class, App\Exceptions\Handler::class); /* |-------------------------------------------------------------------------- | New Relic App Name |-------------------------------------------------------------------------- | | If the extension `newrelic` is loaded then | set the name of the app to something. | */ if (extension_loaded('newrelic')) { newrelic_set_appname('LIMS'); } /* |-------------------------------------------------------------------------- | Return The Application |-------------------------------------------------------------------------- | | This script returns the application instance. The instance is given to | the calling script so we can separate the building of the instances | from the actual running of the application and sending responses. | */ return $app;