PHP Agent FAQ
Heroku
Scout runs on Heroku without any special configuration. When Scout detects that an app is being served via Heroku:
- Logging is set to
STDOUT
vs. logging to a file. Log messages are prefixed with[Scout]
for easy filtering. - The dyno name (ex:
web.1
) is reported vs. the dyno hostname. Dyno hostnames are dynamically generated and don’t have any meaningful information.
Configuration
Scout can be configured via environment variables. This means you can use heroku config:set
to configure the agent. For example, you can set the application name that appears in the Scout UI with:
heroku config:set SCOUT_NAME='My Heroku App'
See the configuration section for more information on the available config settings and environment variable functionality.
Using the Scout Heroku Add-on
Scout is also available as a Heroku Add-on. The add-on automates setting the proper Heroku config variables during the provisioning process.
Adding the Database Addon
To get more insights into how your database is performing, check out our Database Addon.
Docker
Scout runs within Docker containers without any special configuration.
However, it may be easier to dockerize the core-agent. We suggest using our Docker image for this.
Transactions
What is a transaction
A transaction is anytime that you application handles a request or runs a background job. To get a better understanding of your transaction volume, visit your usage page for more info
Ignoring Transactions
Note: When a transaction is ignored, we will not collect metric data or traces for the request. When ignoring transactions and using sampling, data may be skewed and important traces may be missed.
If you don’t want to track the current web request or background job, at any point you can call ignore()
to ignore it:
use Scoutapm\Laravel\Facades\ScoutApm; // Laravel only: Add near the other use statements
ScoutApm::ignore()
// or if you have an $agent instance:
$agent->ignore()
Sampling
Use probability sampling to limit the number of web requests or background jobs Scout analyzes:
use Scoutapm\Laravel\Facades\ScoutApm; // Laravel only: Add near the other use statements
$randomFloat = mt_rand(0, mt_getrandmax() - 1) / mt_getrandmax();
// Sample rate should range from 0-1:
// * 0: captures no requests
// * 0.9: captures 90% of requests
// * 1: captures all requests
$sampleRate = 0.9;
if ( $randomFloat > $sampleRate) {
ScoutApm::ignore();
// or if you have an $agent instance:
$agent->ignore();
}