PHP custom instrumentation

New Relic collects and reports information on web browser transactions and background tasks. New Relic normally produces complete information right out of the box without any need to modify your application code. However, if New Relic does not support your framework, you may need to add custom instrumentation.

Custom instrumentation is also useful to add detail to your transaction traces, to block instrumentation on transactions you don't want instrumented, or if New Relic is simply not picking up a part of your code that you want to instrument.


For maximum visibility into your application, ensure that the newrelic.transaction_tracer.detail parameter is set to 1 (default). This will cause all PHP functions to be timed, thus reducing greatly the amount of "uninstrumented time" in a transaction trace. Over and above that setting, the following API calls can be used to control transactions and add custom instrumentation:

Include a conditional check for the New Relic agent so that your code will work with or without the agent present.

For more help

Additional documentation resources include:

Join the discussion about PHP in the New Relic Online Technical Community! The Technical Community is a public platform to discuss and troubleshoot your New Relic toolset.

If you need additional help, get support at