Scout应用程序性能监视代理
scout-apm的Python项目详细描述
scout python apm代理
使用scout的Python APM Agent监视python django应用程序、flask应用程序和芹菜工人的性能。一旦安装并配置了scout-apm
包,就会收集详细的性能指标和事务跟踪。
要求
Python2.7或3.4+。
Scout APM集成了以下框架:
- 瓶0.12+
- 芹菜3.1+
- Django 1.8+
- 戏剧1.0+
- 猎鹰2.0+
- 烧瓶0.10+
- nameko 2.0+
- 金字塔1.8+
对于其他框架,可以使用代理的instrumentation api。有关详细信息,请参见Python help docs。
快速启动
a scout帐户是必需的。Signup for Scout.
pip install scout-apm
瓶子
fromscout_apm.bottleimportScoutPluginapp=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.pyINSTALLED_APPS=["scout_apm.django",# should be listed first# ... other apps ...]# Scout settingsSCOUT_MONITOR=TrueSCOUT_KEY="[AVAILABLE IN THE SCOUT UI]"SCOUT_NAME="A FRIENDLY NAME FOR YOUR APP"
猎鹰
importfalconfromscout_apm.falconimportScoutMiddlewarescout_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 informationscout_middleware.set_api(api)
烧瓶
这些说明假设应用程序使用SQLAlchemy
。如果不是这样,请删除参照线。
fromscout_apm.flaskimportScoutApmfromscout_apm.flask.sqlalchemyimportinstrument_sqlalchemy# Setup a flask 'app' as normal# Attach ScoutApm to the Flask AppScoutApm(app)# Instrument the SQLAlchemy handleinstrument_sqlalchemy(db)# Scout settingsapp.config["SCOUT_MONITOR"]=Trueapp.config["SCOUT_KEY"]="[AVAILABLE IN THE SCOUT UI]"app.config["SCOUT_NAME"]="A FRIENDLY NAME FOR YOUR APP"
金字塔
将SCOUT_*
设置添加到金字塔配置,然后config.include('scout_apm.pyramid')
importscout_apm.pyramidif__name__=="__main__":withConfigurator()asconfig:config.add_settings(SCOUT_KEY="...",SCOUT_MONITOR=True,SCOUT_NAME="My Pyramid App")config.include("scout_apm.pyramid")# Rest of your config...
文档
完整的安装说明,包括配置scout的信息 通过环境变量和故障排除文档,请参阅 Python docs。
支架
请通过support@scoutapm.com与我们联系,或在此回购协议中创建问题。