Skip to main content

Scout Application Performance Monitoring Agent

Project description

Scout Python APM Agent

travis pypi docs black

Monitor the performance of Python Django apps, Flask apps, and Celery workers with Scout's Python APM Agent. Detailed performance metrics and transaction traces are collected once the scout-apm package is installed and configured.

screenshot

Requirements

Python 2.7 or 3.4+.

Scout APM has integrations for the following frameworks:

  • Bottle 0.12+
  • Celery 3.1+
  • Django 1.8+
  • Dramatiq 1.0+
  • Falcon 2.0+
  • Flask 0.10+
  • Nameko 2.0+
  • Pyramid 1.8+

For other frameworks, you can use the agent's instrumentation API. See the Python help docs for more information.

Quick Start

A Scout account is required. Signup for Scout.

pip install scout-apm

Bottle

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)

Django

# settings.py
INSTALLED_APPS = [
    "scout_apm.django",  # should be listed first
    # ... other apps ...
]

# Scout settings
SCOUT_MONITOR = True
SCOUT_KEY = "[AVAILABLE IN THE SCOUT UI]"
SCOUT_NAME = "A FRIENDLY NAME FOR YOUR APP"

Falcon

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)

Flask

These instructions assume the app uses SQLAlchemy. If that isn't the case, remove the referencing lines.

from scout_apm.flask import ScoutApm
from scout_apm.flask.sqlalchemy import instrument_sqlalchemy

# Setup a flask 'app' as normal

# Attach ScoutApm to the Flask App
ScoutApm(app)

# Instrument the SQLAlchemy handle
instrument_sqlalchemy(db)

# Scout settings
app.config["SCOUT_MONITOR"] = True
app.config["SCOUT_KEY"] = "[AVAILABLE IN THE SCOUT UI]"
app.config["SCOUT_NAME"] = "A FRIENDLY NAME FOR YOUR APP"

Pyramid

Add the SCOUT_* settings to the Pyramid config, and then config.include('scout_apm.pyramid')

import scout_apm.pyramid

if __name__ == "__main__":
    with Configurator() as config:
        config.add_settings(
            SCOUT_KEY="...",
            SCOUT_MONITOR=True,
            SCOUT_NAME="My Pyramid App"
        )
        config.include("scout_apm.pyramid")

        # Rest of your config...

Documentation

For full installation instructions, including information on configuring Scout via environment variables and troubleshooting documentation, see our Python docs.

Support

Please contact us at support@scoutapm.com or create an issue in this repo.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scout_apm-2.4.1.tar.gz (40.1 kB view hashes)

Uploaded Source

Built Distributions

scout_apm-2.4.1-py2-none-any.whl (50.5 kB view hashes)

Uploaded Python 2

scout_apm-2.4.1-cp37-cp37m-manylinux1_x86_64.whl (60.4 kB view hashes)

Uploaded CPython 3.7m

scout_apm-2.4.1-cp37-cp37m-manylinux1_i686.whl (60.1 kB view hashes)

Uploaded CPython 3.7m

scout_apm-2.4.1-cp36-cp36m-manylinux1_x86_64.whl (60.4 kB view hashes)

Uploaded CPython 3.6m

scout_apm-2.4.1-cp36-cp36m-manylinux1_i686.whl (60.1 kB view hashes)

Uploaded CPython 3.6m

scout_apm-2.4.1-cp35-cp35m-manylinux1_x86_64.whl (60.4 kB view hashes)

Uploaded CPython 3.5m

scout_apm-2.4.1-cp35-cp35m-manylinux1_i686.whl (60.1 kB view hashes)

Uploaded CPython 3.5m

scout_apm-2.4.1-cp34-cp34m-manylinux1_x86_64.whl (60.0 kB view hashes)

Uploaded CPython 3.4m

scout_apm-2.4.1-cp34-cp34m-manylinux1_i686.whl (59.8 kB view hashes)

Uploaded CPython 3.4m

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page