Download the PHP package bedrockstreaming/newrelic-guzzle-http-host without Composer
On this page you can find all versions of the php package bedrockstreaming/newrelic-guzzle-http-host. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bedrockstreaming/newrelic-guzzle-http-host
More information about bedrockstreaming/newrelic-guzzle-http-host
Files in bedrockstreaming/newrelic-guzzle-http-host
Package newrelic-guzzle-http-host
Short Description A workaround to report Guzzle requests with correct Host Http header in NewRelic.
License MIT
Informations about the package newrelic-guzzle-http-host
newrelic-guzzle-http-host
A workaround to report Guzzle requests with correct Host Http header in NewRelic.
In some case, you may use a common proxy for several external calls to various hosts,
using the standard Host
to route your requests.
Unfortunatly, since all of these calls use the same uri, NewRelic will report them as external calls to the same target.
This small script provide a workaround to report the correct endpoint according to the HTTP Host
header.
:warning: This library is a workaround relying on the current implementation of the newrelic extension! Test it carefully before to use it with a new extension release. See explanations section below for more details.
ℹ️An official feature request has been submitted to NewRelic team.
Installation
That's all! The script is automatically imported thanks to Composer autoloader.
ℹ️ You can also copy the content of newrelic_hook.php
directly in your project.
Explanations
The newrelic extension defines a Php function, a Guzzle middleware to report some metrics on each requests sent from Php.
Fortunately, the extension defines this function only if it doesn't already exist… then this workaround define this function before newrelic does 😅.
Original code is copied in this function, but we create a new http requests dedicated to NewRelic reporting, resolving the Http HOST
header.
The original request used by Guzzle stays unchanged.