diff --git a/bin/compile b/bin/compile index 83d7efc94..9ce8429b1 100755 --- a/bin/compile +++ b/bin/compile @@ -246,7 +246,7 @@ fi # Set correct port variable. erb /app/vendor/nginx/conf/nginx.conf.erb > /app/vendor/nginx/conf/nginx.conf # Set NEWRELIC key -if [ -x "/app/local/bin/newrelic-license" ]; then +if [ "\${NEW_RELIC_LICENSE_KEY}" -a -x "/app/local/bin/newrelic-license" ]; then /app/local/bin/newrelic-license fi @@ -267,7 +267,7 @@ touch /app/vendor/nginx/logs/access.log /app/vendor/nginx/logs/error.log /app/ve mkdir -p client_body_temp fastcgi_temp proxy_temp scgi_temp uwsgi_temp (tail -f -n 0 /app/vendor/nginx/logs/*.log /app/vendor/php/var/log/*.log /app/local/var/log/newrelic/*.log &) -if [ "\${NEW_RELIC_LICENSE_KEY}" ]; then +if [ "\${NEW_RELIC_LICENSE_KEY}" -a ! -f /app/local/NEWRELIC_VERSION ]; then /app/local/bin/newrelic-daemon -c /app/local/etc/newrelic.cfg -d error fi /app/vendor/php/sbin/php-fpm diff --git a/support/04_newrelic.ini.sample b/support/04_newrelic.ini.sample index b5e2a3cf8..1861a577a 100644 --- a/support/04_newrelic.ini.sample +++ b/support/04_newrelic.ini.sample @@ -1,8 +1,379 @@ -; Edit and place this file in your deployment as conf/etc.d/04_newrelic.ini -extension=newrelic.so +; Edit and place this file in your APP directory as `your_app/conf/etc.d/04_newrelic.ini`. + +; This file contains the various settings for the New Relic PHP agent. There +; are many options, all of which are described in detail at the following URL: +; https://newrelic.com/docs/php/php-agent-phpini-settings +; -newrelic.appname = PHP Application +; If you use a full path to the extension you insulate yourself from the +; extension directory changing if you change PHP installations or versions. +; If you do not use an absolute path then the file must be installed in the +; active configuration's extension directory. +extension=newrelic.so newrelic.enabled = 1 -newrelic.logfile = /app/local/var/log/newrelic/php_agent.log -newrelic.loglevel = none -newrelic.browser_monitoring.auto_instrument = 1 + +; Heroku buildpack note: Do not change the following option. +; Make sure this config file name contains the word 'newrelic'. +; It will be automatically populated to the NEW_RELIC_LICENSE_KEY env var. +newrelic.license = "REPLACE_WITH_REAL_KEY" + +newrelic.logfile = "/app/local/var/log/newrelic/php_agent.log" + +; +; Setting: newrelic.loglevel +; Type : string +; Scope : system +; Default: "info" +; Info : Sets the level of detail to include in the log file. You should +; rarely need to change this from the default, and usually only under +; the guidance of technical support. This option has changed meaning +; fairly significantly from agent versions 1.x and 2.x. +; +;newrelic.loglevel = "info" + +; +; Setting: newrelic.appname +; Type : string +; Scope : per-directory +; Default: "PHP Application" +; Info : Sets the name of the application that metrics will be reported into. +; This can in fact be a list of up to 3 application names, each of +; which must be separated by a semi-colon. The first name in any such +; list is considered the 'primary' application name and must be unique +; for each account / license key. +; +;newrelic.appname = "PHP Application" + +; +; Beginning with version 3.0 of the agent, the daemon can be automatically +; started by the agent. There is no need to start the daemon before starting +; Apache or PHP-FPM. All of the newrelic.daemon.* settings are options that +; control the behaviour of the daemon. These settings are converted into the +; appropriate command line options when the agent starts the daemon. This is +; now the preferred method of starting the daemon. There are still usage cases +; (such as using a single daemon for serving multiple Apache instances) where +; you may want to start the daemon via it's init script, but for most users, +; this is the best place to configure and start the daemon. +; +; The agent will only launch the daemon if one isn't already running. Also +; note that the agent will NOT stop the daemon once it has started. If you +; want control over exactly when the daemon starts and stops you can still +; achieve that by creating a daemon configuration file (located by default at +; /etc/newrelic/newrelic.cfg) and running the chkconfig or equivalent command. +; Please see the newrelic.cfg template file for details. That template file +; is located at /usr/lib/newrelic-php5/scripts/newrelic.cfg.template. +; +; Also please note that the options here and in newrelic.cfg are identical, +; except that in this file they are preceded with "newrelic.daemon.". +; + +; +; Setting: newrelic.daemon.logfile +; Type : string +; Scope : system +; Default: none +; Info : Sets the name of the file to send daemon log messages to. +; +newrelic.daemon.logfile = "/app/local/var/log/newrelic/newrelic-daemon.log" + +; +; Setting: newrelic.daemon.loglevel +; Type : string +; Scope : system +; Default: "info" +; Info : Sets the level of detail to include in the daemon log. You should +; rarely need to change this from the default, and usually only under +; the guidance of technical support. This option has changed meaning +; fairly significantly from agent versions 1.x and 2.x. +; +;newrelic.daemon.loglevel = "info" + +; +; Setting: newrelic.daemon.ssl +; Type : boolean +; Scope : system +; Default: false +; Info : Sets whether or not communication with New Relic data collectors +; should use a secure HTTP connection or not. Depending on your +; operating system and how it is configured, in order for this to +; work correctly you may need to provide the location of either a +; PEM-encoded certificate file, or a directory that contains a list +; of such files, using the following two options. +; +newrelic.daemon.ssl = true + +; +; Setting: newrelic.daemon.location +; Type : string +; Scope : system +; Default: /usr/bin/newrelic-daemon +; Info : Sets the name of the daemon executable to launch. +; Please note that on OpenSolaris where /usr is frequently a read-only +; filesystem, the default daemon location is +; /opt/newrelic/bin/newrelic-daemon. +; +newrelic.daemon.location = "/app/local/bin/newrelic-daemon" + +; +; Setting: newrelic.daemon.dont_launch +; Type : integer (0, 1, 2 or 3) +; Scope : system +; Default: 0 +; Info : If you prefer to have the daemon launched externally before the +; agent starts up, set this variable to non-zero. The value you +; choose determines exactly when the agent is allowed to start the +; daemon: +; 0 - agent can start the daemon any time it needs to +; 1 - non-CLI (i.e Apache / php-fpm) agents can start the daemon +; 2 - only CLI agents can start the daemon +; 3 - the agent will never start the daemon +; +newrelic.daemon.dont_launch = 1 + +; +; Setting: newrelic.capture_params +; Type : boolean +; Scope : per-directory +; Default: false +; Info : Enable or disable the capturing of URL parameters. If enabled, then +; any variables passed on the URL like (for example ?id=12345) will be +; saved with the request and visible in various places in the web UI. +; If you tend to pass sensitive information around directly in the URL +; then its a good idea to keep this disabled. However, if your URL +; parameters are simply used for parameters without sensitive data but +; that are meaningful to each transaction then you can enable this. +; +;newrelic.capture_params = false + +; Setting: newrelic.ignored_params +; Type : string +; Scope : per-directory +; Default: none +; Info : A comma-separated list of parameters to always exclude if parameter +; capturing is enabled above. You can use this to filter out sensitive +; user data that may appear as a URL parameter. +; +;newrelic.ignored_params = "" + +; +; Setting: newrelic.error_collector.enabled +; Type : boolean +; Scope : per-directory +; Default: true +; Info : Enable the New Relic error collector. This will record the 20 most +; severe errors per harvest cycle. It is rare to want to disable this. +; Please also note that your New Relic subscription level may force +; this to be disabled regardless of any value you set for it. +; +;newrelic.error_collector.enabled = true + +; +; Setting: newrelic.error_collector.record_database_errors +; Type : boolean +; Scope : per-directory +; Default: false +; Info : Currently only supported for MySQL database functions. If enabled, +; this will cause errors returned by various MySQL functions to be +; treated as if they were PHP errors, and thus subject to error +; collection. This is only objeyed if the error collector is enabled +; above and the account subscription level permits error trapping. +; +;newrelic.error_collector.record_database_errors = false + +; +; Setting: newrelic.error_collector.prioritize_api_errors +; Type : boolean +; Scope : per-directory +; Default: false +; Info : If the error collector is enabled and you use the New Relic API to +; notice an error, if this is set to true then assign the highest +; priority to such errors. +; +;newrelic.error_collector.prioritize_api_errors = false + +; +; Setting: newrelic.browser_monitoring.auto_instrument +; Type : boolean +; Scope : per-directory +; Default: true +; Info : Enables or disables automatic real user monitoring ("auto-RUM"). +; When enabled will cause the agent to insert a header and a footer +; in HTML output that will time the actual end-user experience. +; +;newrelic.browser_monitoring.auto_instrument = true + +; +; Setting: newrelic.transaction_tracer.enabled +; Type : boolean +; Scope : per-directory +; Default: true +; Info : Enables or disables the transaction tracer. When enabled this will +; produce a detailed call graph for any transaction that exceeds a +; certain threshold (see next entry). Only one transaction trace per +; application per harvest cycle is stored and it is always the slowest +; transaction during that cycle. Transaction traces are extremely +; useful when diagnosing problem spots in your application. Please +; note that TT's may be disabled by your account subscription level +; regardless of what you set here. +; +;newrelic.transaction_tracer.enabled = true + +; +; Setting: newrelic.transaction_tracer.threshold +; Type : string with a time specification or the word "apdex_f" +; Scope : per-directory +; Default: "apdex_f" +; Info : Specifies the threshold above which a transaction becomes a +; candidate for the transaction tracer. This can either be an absolute +; time value like "200ms" or "1s250ms" or "1h30m" or "750us" or the +; word "apdex_f". This last value, "apdex_f", means "4 times apdex_t". +; Thus the threshold changes according to your apdex_t setting. This +; is the default. +; +;newrelic.transaction_tracer.threshold = "apdex_f" + +; +; Setting: newrelic.transaction_tracer.detail +; Type : integer in the range 0-2 +; Scope : per-directory +; Default: 1 +; Info : Sets the level of detail in a transaction trace. Setting this to 0 +; will only show the relatively few PHP functions that New Relic has +; deemed to be "interesting", as well as any custom functions you set +; (see below). A setting of 1 will trace and time all user functions, +; and a setting of 2, which needs another special variable to be set +; in order to take effect, will trace ALL PHP functions, including +; internal ones implemented in modules. This last setting can have a +; severe impact on performance which is why you need to consult New +; Relic support staff at support@newrelic.com to get the "special" +; variable to set to enable the feature. It is very rarely needed. +; +; In earlier releases of the agent this was known as "top100". +; +;newrelic.transaction_tracer.detail = 1 + +; +; Setting: newrelic.transaction_tracer.slow_sql +; Type : boolean +; Scope : per-directory +; Default: true +; Info : Enables or disables the "slow SQL" tracer. When enabled, this will +; record the top 10 slowest SQL calls along with a stack trace of +; where the call occurred in your code. +; +;newrelic.transaction_tracer.slow_sql = true + +; +; Setting: newrelic.transaction_tracer.stack_trace_threshold +; Type : time specification string ("500ms", "1s750ms" etc) +; Scope : per-directory +; Default: 500ms +; Info : Sets the threshold above which the New Relic agent will record a +; stack trace for a transaction trace. +; +;newrelic.transaction_tracer.stack_trace_threshold = 500 + +; +; Setting: newrelic.transaction_tracer.explain_enabled +; Type : boolean +; Scope : per-directory +; Default: true +; Info : Enables or disables requesting "explain plans" from MySQL and +; PostgreSQL databases for slow SQL calls. The threshold for +; requesting explain plans is defined below. +; +;newrelic.transaction_tracer.explain_enabled = true + +; +; Setting: newrelic.transaction_tracer.explain_threshold +; Type : time specification string ("750ms", "1s 500ms" etc) +; Scope : per-directory +; Default: 500ms +; Info : Used by the slow SQL tracer to set the threshold above which an SQL +; statement is considered "slow", and to set the threshold above which +; the transaction tracer will request an "explain plan" from the data- +; base for slow SQL. This latter feature may not be active yet, please +; refer to the agent release notes to see when it becomes available. +; Only relevant if explain_enabled above is set to true. +; +;newrelic.transaction_tracer.explain_threshold = 500 + +; +; Setting: newrelic.transaction_tracer.record_sql +; Type : "off", "raw" or "obfuscated" +; Scope : per-directory +; Default: "obfuscated" +; Info : Sets how SQL statements are recorded (if at all). If this is set to +; "raw" then no attempt is made at obfuscating SQL statements. THIS IS +; HIGHLY DISCOURAGED IN PRODUCTION ENVIRONMENTS! Setting this to raw +; has considerable security implications as it can expose sensitive +; and private customer data. +; +;newrelic.transaction_tracer.record_sql = "obfuscated" + +; Setting: newrelic.transaction_tracer.custom +; Type : string +; Scope : per-directory +; Default: none +; Info : Sets the name(s) of additional functions you want to instrument and +; appear in transaction traces. This is only meaningful if you have +; set newrelic.transaction_tracer.detail to 0. This can be a comma- +; separated list of function or class method names. +; +;newrelic.transaction_tracer.custom = "" + +; +; Setting: newrelic.framework +; Type : string +; Scope : per-directory +; Default: empty (auto-detect framework) +; Info : Forces the framework to be one of the supported frameworks. This +; should only ever be used if the auto-detection fails, in which case +; we (support@newrelic.com) would very much like to know about the +; detection failure. Must be one of the following values: +; +; cakephp, codeigniter, drupal, joomla, kohana, magento, mediawiki, +; symfony, wordpress, yii, zend or no_framework. +; +;newrelic.framework = "" + +; +; Setting: newrelic.webtransaction.name.remove_trailing_path +; Type : boolean +; Scope : per-directory +; Default: false +; Info : Used to aid naming transactions correctly when an unsupported +; framework is being used. This option will cause anything after the +; script name to be stripped from a URL. For example, setting this +; would cause the "/xyz/zy" to be stripped from a URL such as +; "/path/to/foo.php/xyz/zy". +; +;newrelic.webtransaction.name.remove_trailing_path = false + +; +; Setting: newrelic.webtransaction.name.functions +; Type : string +; Scope : per-directory +; Default: none +; Info : Unless a specific framework such as Drupal or Wordpress has been +; detected, transactions are named according to the first script +; encountered, such as login.php. However, if you use a dispatcher +; file such as index.php this produces less useful data. If you use +; a dispatcher to redirect to actions such as "login", "show", "edit" +; etc, you can set this to the top level functions for those actions, +; and the function names specified here will be used to name the +; transaction. +; +;newrelic.webtransaction.name.functions = "" + +; +; Setting: newrelic.webtransaction.name.files +; Type : string +; Scope : per-directory +; Default: none +; Info : Same as newrelic.webtransaction.name.functions above but using file +; names instead of function names. Accepts standard POSIX regular +; expressions. +; +;newrelic.webtransaction.name.files = "" + diff --git a/support/package_newrelic b/support/package_newrelic index eddeb894f..f9e476014 100755 --- a/support/package_newrelic +++ b/support/package_newrelic @@ -24,8 +24,19 @@ cp -f daemon/newrelic-daemon.x64 $installdir/bin/newrelic-daemon cp -f scripts/newrelic.cfg.template $installdir/etc/newrelic.cfg sed -i 's|var|app/local/var|g' $installdir/etc/newrelic.cfg sed -i 's|#ssl=false|ssl=true|g' $installdir/etc/newrelic.cfg -curl -L "https://raw.github.com/gist/2767604/newrelic-license.sh" -o $installdir/bin/newrelic-license +#curl -L "https://raw.github.com/gist/2767604/newrelic-license.sh" -o $installdir/bin/newrelic-license +cat > $installdir/bin/newrelic-license < $installdir/NEWRELIC_VERSION popd pushd $installdir