Python Agent FAQ

Heroku

Scout runs on Heroku without any special configuration. When Scout detects that an app is being served via Heroku:

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_transaction() to ignore it:

import scout_apm.api

if is_health_check():
    scout_apm.api.ignore_transaction()

You can use this whether the transaction was started from a built-in integration or custom instrumentation.

You can also ignore a set of URL path prefixes by configuring the ignore setting:

Config.set(
    ignore=["/health-check/", "/admin/"],
)

When specifying this as an environment variable, it should be a comma-separated list:

export SCOUT_IGNORE='/health-check/,/admin/'

Sampling

We offer a few configuration options that allow you to sample all transactions, or use additional configuration to specify sampling rates for specific web endpoints or background jobs. This is useful to reduce overall usage or ignore select endpoints or jobs entirely.

Sampling Precedence

The more specific sampling settings take precedence over boarder ones. For example, a setting like sample_endpoints=“users/debug:30” would take priority. All endpoints not matching a specific prefix will use endpoint_sample_rate if set, followed by sample_rate. The global sample_rate will default to 100 (no sampling) if not changed. sample_endpoints and/or endpoint/job_sample_rate can be higher than the global rate, which would mean you’d be getting more transactions for those endpoints relative to everything else.

Example Sampling Configurations

Global Sampling of 50%

export SCOUT_SAMPLE_RATE=50

Sampling 10% of Jobs, and 50% of Web Requests

export SCOUT_ENDPOINT_SAMPLE_RATE=50
export SCOUT_JOB_SAMPLE_RATE=10

Sampling 10% of Jobs and 50% of Web Requests, capturing all of a specified web endpoint

export SCOUT_ENDPOINT_SAMPLE_RATE=50
export SCOUT_JOB_SAMPLE_RATE=10
export SCOUT_SAMPLE_ENDPOINTS="/foo/bar:100"