def create_client(conf, app_version='__UNKNOWN__', ignore_common_http=True):
"""Creates a sentry client.
:param app_version: (string): App version sent to sentry for making events more rich
:param conf['SENTRY_DSN']: (string, required): DSN of sentry server
:param conf['SENTRY_SITE']: (string): The site description of the deployment.
:returns: An initialized ``raven.Client`` instance.
"""
ignore_exceptions = []
if ignore_common_http:
ignore_exceptions = [
'werkzeug.exceptions.BadRequest', # 400
'werkzeug.exceptions.Unauthorized', # 401
'werkzeug.exceptions.Forbidden', # 403
'werkzeug.exceptions.NotFound', # 404
'werkzeug.exceptions.MethodNotAllowed', # 405
'marshmallow.exceptions.ValidationError', # Marshmallow Validation Error.
'webargs.core.ValidationError', # Webargs Validation Error
]
client = Client(
conf['SENTRY_DSN'],
site=conf.get('SENTRY_SITE'),
release=app_version,
ignore_exceptions=ignore_exceptions
)
return client
评论列表
文章目录