{"library":"scout-apm","title":"Scout APM Python Agent","description":"Scout APM is an Application Performance Monitoring (APM) agent for Python that provides detailed performance metrics and transaction traces for web applications (Django, Flask, FastAPI, etc.) and background jobs (Celery, RQ). It helps identify performance bottlenecks, monitor errors, manage logs, and track external services. The current stable version is 3.5.3, with regular updates to support new Python versions and frameworks.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install scout-apm"],"cli":null},"imports":["from scout_apm.api import Config","from scout_apm.api import WebTransaction","from scout_apm.api import BackgroundTransaction","from scout_apm.api import instrument","from scout_apm.flask import ScoutApm","INSTALLED_APPS = ['scout_apm.django', ...]"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom scout_apm.api import Config, install\n\n# Configure Scout APM (often done via environment variables in production)\n# For local testing, ensure these are set in your environment or replace os.environ.get with actual values.\nConfig.set(key=os.environ.get('SCOUT_KEY', 'YOUR_SCOUT_KEY'),\n           name=os.environ.get('SCOUT_NAME', 'My Python App'),\n           monitor=os.environ.get('SCOUT_MONITOR', 'True').lower() == 'true')\n\n# Install the agent (should be called early in your application startup)\ninstall()\n\n# Example of custom instrumentation (e.g., in a non-web script or job)\nfrom scout_apm.api import WebTransaction, instrument\n\ndef my_complex_function():\n    with instrument('MyCustomOperation'):\n        # Simulate some work\n        sum(range(1000000))\n    return 'Operation complete'\n\nif __name__ == '__main__':\n    # In a web framework, transactions are typically auto-instrumented.\n    # For custom scripts or background jobs:\n    with WebTransaction('MyScriptExecution'):\n        print(my_complex_function())\n","lang":"python","description":"The quickstart demonstrates global configuration via `scout_apm.api.Config.set()` and agent installation via `scout_apm.api.install()`. It also includes an example of custom instrumentation using `WebTransaction` and `instrument` for non-framework specific code. In production, `SCOUT_KEY`, `SCOUT_NAME`, and `SCOUT_MONITOR` are commonly set via environment variables.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}