• EnglishEspañol日本語한국어Português
  • Log inStart now

newrelic_end_of_transaction (PHP agent API)

Syntax

newrelic_end_of_transaction()

Stop timing the current transaction, but continue instrumenting it.

Requirements

Compatible with all agent versions.

Description

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.

Tip

Compare newrelic_end_transaction(), which ends instrumentation entirely.

Parameters

This call does not accept any parameters.

Examples

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
}
Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.