Other Libraries

Bottle

General instructions for a Bottle app:

1. Install the scout-apm package:

pip install scout-apm

2. Add Scout to your Bottle config:

from scout_apm.bottle import ScoutPlugin

app = bottle.default_app()
app.config.update({
    "scout.name": "YOUR_APP_NAME",
    "scout.key": "YOUR_KEY",
    "scout.monitor": True,
})

scout = ScoutPlugin()
bottle.install(scout)

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and remove the call to app.config.update.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.

CherryPy

Scout supports CherryPy 18.0.0+.

General instructions for a CherryPy app:

1. Install the scout-apm package:

pip install scout-apm

2. Attach the Scout plugin to your app:

import cherrypy

from scout_apm.api import Config
from scout_apm.cherrypy import ScoutPlugin

class Views(object):
    @cherrypy.expose
    def index(self):
        return "Hi"

app = cherrypy.Application(Views(), "/")

Config.set(
    key="[AVAILABLE IN THE SCOUT UI]",
    monitor=True,
    name="A FRIENDLY NAME FOR YOUR APP",
)
scout_plugin = ScoutPlugin(cherrypy.engine)
scout_plugin.subscribe()

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and remove the call to Config.set.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.

Dash

Plotly Dash is built on top of Flask. Therefore you should use the Scout Flask integration with the underlying Flask application object. For example:

import dash
from scout_apm.flask import ScoutApm

app = dash.Dash("myapp")
app.config.suppress_callback_exceptions = True
flask_app = app.server

# Setup as per Flask integration
ScoutApm(flask_app)
flask_app.config["SCOUT_NAME"] = "A FRIENDLY NAME FOR YOUR APP"

For full instructions, see the Flask integration.

Dramatiq

cout supports Dramatiq 1.0+. Add the following to instrument Dramatiq workers:

1. Install the scout-apm package:

pip install scout-apm

2. Add Scout to your Dramatiq broker:

import dramatiq
from dramatiq.brokers.rabbitmq import RabbitmqBroker
from scout_apm.dramatiq import ScoutMiddleware
from scout_apm.api import Config

broker = RabbitmqBroker()
broker.add_middleware(ScoutMiddleware(), before=broker.middleware[0].__class__)

 Config.set(
    key="[AVAILABLE IN THE SCOUT UI]",
    name="Same as Web App Name",
    monitor=True,
) 

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY instead of calling Config.set.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.

Tasks will appear in the “Background Jobs” area of the Scout UI.

Falcon

Scout supports Falcon 2.0+. General instructions for a Falcon app:

1. Install the scout-apm package:

pip install scout-apm

2. Attach the Scout middleware to your Falcon app:

import falcon
from scout_apm.falcon import ScoutMiddleware

scout_middleware = ScoutMiddleware(config={
    "key": "[AVAILABLE IN THE SCOUT UI]",
    "monitor": True,
    "name": "A FRIENDLY NAME FOR YOUR APP",
})
api = falcon.API(middleware=[ScoutMiddleware()])
# Required for accessing extra per-request information
scout_middleware.set_api(api)

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and pass an empty dictionary to config.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.

FastAPI

Scout supports FastAPI through the Starlette instrumentation. General instructions for a FastAPI app:

1. Install the scout-apm package:

pip install scout-apm

2. Attach the Scout middleware to your FastAPI app:

from fastapi import FastAPI
from scout_apm.api import Config
from scout_apm.async_.starlette import ScoutMiddleware

Config.set(
    key="[AVAILABLE IN THE SCOUT UI]",
    name="A FRIENDLY NAME FOR YOUR APP",
    monitor=True,
)
app = FastAPI()
app.add_middleware(ScoutMiddleware)

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and pass an empty dictionary to config.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

Hug

Scout supports Hug 2.5.1+. Hug is based on Falcon so a Falcon version supported by our integration is also needed.

General instructions for a Hug app:

1. Install the scout-apm package:

pip install scout-apm

2. Configure Scout inside your Hug app:

from scout_apm.hug import integrate_scout

# Setup your Hug endpoints as usual

@hug.get("/")
def home():
    return "Welcome home."

# Integrate scout with the Hug application for this module
integrate_scout(
    __name__,
    config={
        "key": "[AVAILABLE IN THE SCOUT UI]",
        "monitor": True,
        "name": "A FRIENDLY NAME FOR YOUR APP",
    },
) 

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and remove the entries in config.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.

Nameko

General instructions for a Nameko app:

1. Install the scout-apm package:

pip install scout-apm

2. Configure scout once in the root of your app, and add a ScoutReporter to each Nameko service:

from scout_apm.api import Config
from scout_apm.nameko import ScoutReporter


Config.set(
    key="[AVAILABLE IN THE SCOUT UI]",
    name="A FRIENDLY NAME FOR YOUR APP",
    monitor=True,
)

class Service(object):
    name = "myservice"

    scout = ScoutReporter()

    @http("GET", "/")
    def home(self, request):
        return "Welcome home."

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and remove the call to Config.set.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.

Pyramid

General instructions for a Pyramid app:

1. Install the scout-apm package:

pip install scout-apm

2. Add Scout to your Pyramid config:

import scout_apm.pyramid

if __name__ == "__main__":
    with Configurator() as config:
        config.add_settings(
            SCOUT_KEY="[AVAILABLE IN THE SCOUT UI]",
            SCOUT_MONITOR=True,
            SCOUT_NAME="A FRIENDLY NAME FOR YOUR APP"
        )
        config.include("scout_apm.pyramid")

        # Rest of your config...

If you wish to configure Scout via environment variables, use SCOUT_MONITOR, SCOUT_NAME and SCOUT_KEY and remove the call to config.add_settings.

If you’ve installed Scout via the Heroku Addon, the provisioning process automatically sets SCOUT_MONITOR and SCOUT_KEY via config vars. Only SCOUT_NAME is required.

3. Deploy.

It takes approximatively five minutes for your data to first appear within the Scout UI.