将setuptools入口点引发的异常转发到sentry
项目描述
DESCRIPTION
“sentry-wrapper”调用setuptools入口点,并将异常发送到sentry。这对于记录正确打包但无法处理sentry的程序的异常非常有用。
使用方法
usage: sentry-wrapper [options] [-- entrypoint options] positional arguments: name Entry point name (eg. my-entrypoint) dist Distribution name (eg. my-project==1.2.4, default: same value than name) group Entry point group (default: console_scripts) optional arguments: -h, --help show this help message and exit --dsn SENTRY_DSN Sentry DSN -t timeout, --timeout timeout Timeout. After this value, TimeoutError is raised to Sentry.
例如,如果包“mypackage”的setup.py文件包含
... name='my-package', entry_points={ 'console_scripts': [ 'my-entrypoint = mypackage:main', ], }, ...
使用以下命令调用my-entrypoint
sentry-wrapper --dsn SENTRY_DSN my-entrypoint my-package console_scripts
安装
在虚拟环境中安装
$> virtualenv myenv $> source myenv/bin/activate $> pip install sentry-wrapper $> pip install path/to/your/project $> sentry-wrapper -h
开发
使用Docker启动对sentry-wrapper的修改
$> make
然后
使用凭据test/test访问http://localhost:9000
创建项目并复制DSN
测试sentry-wrapper与此存储库的测试项目
sentry-wrapper --dsn [...] whatever_ok whatever console_scripts sentry-wrapper --dsn [...] whatever_exception whatever console_scripts