• /
  • Log in
  • Free account

newrelic_end_of_transaction (PHP agent API)



Stop timing the current transaction, but continue instrumenting it.


Compatible with all agent versions.


Stop timing the web transaction immediately. Useful when a page is done with app code and is about to stream data (file download, audio or video streaming, and so on), and you don't want streaming time to count as part of the transaction run time. The agent sends data to the daemon at the end of the transaction.

This is especially relevant when the time taken to complete the operation is completely outside the bounds of your application. For example, a user on a very slow connection may take a very long time to download even small files, and you wouldn't want that download time to skew the real transaction time.


Compare newrelic_end_transaction(), which ends instrumentation entirely.


This call does not accept any parameters.


Stop timing after streaming data [#streaming example]

function example() { 
    ... // computational logic
    if (extension_loaded('newrelic')) { // Ensure PHP agent is available
        newrelic_end_of_transaction(); // Used to stop recording the transaction after computing for the transaction is complete, typically when streaming data 
    ... //streaming data

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.