Skip to content

Instantly share code, notes, and snippets.

@grahambates
Created August 11, 2021 09:53
Show Gist options
  • Save grahambates/7aa58dc53f6e1e3ed733a79123900f54 to your computer and use it in GitHub Desktop.
Save grahambates/7aa58dc53f6e1e3ed733a79123900f54 to your computer and use it in GitHub Desktop.
diff --git a/Response.php b/Response.php
index 9544a671..54dd215c 100644
--- a/Response.php
+++ b/Response.php
@@ -370,15 +370,29 @@ class Response
*/
public function send()
{
+ if (extension_loaded('newrelic')) {
+ newrelic_add_custom_tracer("Response::send/sendHeaders");
+ }
$this->sendHeaders();
+
+ if (extension_loaded('newrelic')) {
+ newrelic_add_custom_tracer("Response::send/sendContent");
+ }
$this->sendContent();
if (\function_exists('fastcgi_finish_request')) {
+ if (extension_loaded('newrelic')) {
+ newrelic_add_custom_tracer("Response::send/fastcgi_finish_request");
+ }
fastcgi_finish_request();
} elseif (!\in_array(\PHP_SAPI, ['cli', 'phpdbg'], true)) {
static::closeOutputBuffers(0, true);
}
+ if (extension_loaded('newrelic')) {
+ newrelic_add_custom_tracer("Response::send/end");
+ }
+
return $this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment