本文整理汇总了Python中raven.fetch_package_version方法的典型用法代码示例。如果您正苦于以下问题:Python raven.fetch_package_version方法的具体用法?Python raven.fetch_package_version怎么用?Python raven.fetch_package_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类raven
的用法示例。
在下文中一共展示了raven.fetch_package_version方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sentrytest
# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def sentrytest(self):
"""return true if we managed to send a sample raven exception"""
if not (self.config.sentry and self.config.sentry.dsn):
raise SentryConfigurationError('sentry dsn not configured')
try:
version = raven.fetch_package_version('crontabber')
except Exception:
version = None
self.config.logger.warning(
'Unable to extract version of crontabber',
exc_info=True
)
client = raven.Client(
dsn=self.config.sentry.dsn,
release=version
)
identifier = client.captureMessage(
'Sentry test sent from crontabber'
)
self.config.logger.info(
'Sentry successful identifier: %s', identifier
)
return True
示例2: __init__
# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def __init__(self, logger_name, log_level="debug", log_format="json",
log_output="stdout", sentry_dsn=None,
firehose_delivery_stream=None):
self.logger_name = "-".join([
logger_name,
pkg_resources.get_distribution("autopush").version
])
self._filename = None
self.log_level = LogLevel.lookupByName(log_level)
if log_output == "stdout":
self._output = sys.stdout
elif log_output == "none":
self._output = None
else:
self._filename = log_output
self._output = None
if log_format == "json":
self.format_event = self.json_format
else:
self.format_event = formatEventAsClassicLogText
if sentry_dsn:
self.raven_client = raven.Client(
release=raven.fetch_package_version("autopush"),
transport=TwistedHTTPTransport,
enable_breadcrumbs=False,
)
else:
self.raven_client = None
if firehose_delivery_stream:
self.firehose = FirehoseProcessor(
stream_name=firehose_delivery_stream)
else:
self.firehose = None
示例3: setup_sentry
# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def setup_sentry(name, channel, dsn):
"""
Setup sentry account using taskcluster secrets
"""
# Detect environment
task_id = os.environ.get("TASK_ID")
if task_id is not None:
site = "taskcluster"
elif "DYNO" in os.environ:
site = "heroku"
else:
site = "unknown"
sentry_client = raven.Client(
dsn=dsn,
site=site,
name=name,
environment=channel,
release=raven.fetch_package_version(f"code-coverage-{name}"),
)
if task_id is not None:
# Add a Taskcluster task id when available
# It will be shown in the Additional Data section on the dashboard
sentry_client.context.merge({"extra": {"task_id": task_id}})
sentry_handler = raven.handlers.logbook.SentryHandler(
sentry_client, level=logbook.WARNING, bubble=True
)
sentry_handler.push_application()
示例4: setup_sentry
# 需要导入模块: import raven [as 别名]
# 或者: from raven import fetch_package_version [as 别名]
def setup_sentry(name, channel, dsn):
"""
Setup sentry account using taskcluster secrets
"""
# Detect environment
task_id = os.environ.get("TASK_ID")
if task_id is not None:
site = "taskcluster"
elif "DYNO" in os.environ:
site = "heroku"
else:
site = "unknown"
sentry_client = raven.Client(
dsn=dsn,
site=site,
name=name,
environment=channel,
release=raven.fetch_package_version(f"code-review-{name}"),
)
if task_id is not None:
# Add a Taskcluster task id when available
# It will be shown in the Additional Data section on the dashboard
sentry_client.context.merge({"extra": {"task_id": task_id}})
sentry_handler = raven.handlers.logbook.SentryHandler(
sentry_client, level=logbook.WARNING, bubble=True
)
sentry_handler.push_application()