New Relic collects and reports information on web browser transactions and non-web transactions, such as 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.
Ensure all PHP functions are timed
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.
Use the agent API to control transactions
Beyond that setting, agent API calls can control transactions and add custom instrumentation:
Specify a particular method you want to instrument.
Stop timing a transaction, but continue instrumenting it. Useful for streaming data.
Do not instrument a transaction at all.
Customize the name of a transaction when the default name is not useful.
Record an error message with a stack trace.
newrelic_start_transaction()
andnewrelic_end_transaction()
Manually end the current transaction, then start a new transaction. Useful for queue managers, or other scripts that create numerous "children."