一个常见的wsgi堆栈
talisker-fork的Python项目详细描述
Talisker是wsgi应用程序的运行时,旨在提供 python服务的平台。
tl;dr
只需使用Talisker运行您的wsgi应用程序,就好像它是Gunicorn一样。
talisker app:wsgi -c config.py ...
Talisker将把你的应用包在一个简单的wsgi中间件中,并配置 记录到输出结构化日志,如下所示:
logger = logging.getLogger('app') logger.info('something happened', extra={'context': 'I haz it'})
将输出:
2016-01-13 10:24:07.357Z INFO app "something happened" svc.context="I haz it" request_id=...
它还公开了一些您可以使用的状态端点,转到/\u状态/ 你的应用程序上的URL以查看它们。
这一切都是开箱即用塔利斯克尔转轮而不是 Gunicorn的,还有很多功能你也可以使用。
升降舵俯仰
Talisker基于许多标准的Python工具:
- stdlib logging for logs
- gunicorn for a wsgi runner
- requests for http requests
- statsd for metrics (and optionally, prometheus_client)
- sentry for errors
- werkzeug for thread locals and wsgi utilities
它还支持其他可选工具:
- celery for async tasks
- prometheus as an alternate metrics tool
它的主要工作是在一个工具中集成和配置上述所有内容 在开发和生产中使用,它提供了 盒子的大小:
- drop-in replacement for gunicorn as a wsgi runner
- standardised structured logging on top of python stdlib logging
- request id tracing
- standard set of status endpoints for your app
- easier configuration via env vars
- metrics for everything
- deep sentry integration (WIP)
以上所有内容都可以通过使用talisker入口点脚本获得, 而不是古尼科恩。
此外,只要付出少量努力,您的应用程序就可以从其他功能中获益:
- add structured logging tags to your application logs
- simple deeper nagios checks - just implement a ^{tt1}$ url in your app
- per-thread requests connection pool management
此外,Talisker还提供了与 基础设施:
- grok filters for log parsing
- rsyslog templates and config for log shipping (TODO)
塔利斯克是固执己见的,直接来自作者的需要和 因此,目前不太可配置。不过,公关是非常受欢迎的!
有关详细信息,请参阅文档,该文档应位于: