當前位置: 首頁>>代碼示例>>Python>>正文


Python raven.fetch_package_version方法代碼示例

本文整理匯總了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 
開發者ID:mozilla,項目名稱:crontabber,代碼行數:26,代碼來源:app.py

示例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 
開發者ID:mozilla-services,項目名稱:autopush,代碼行數:35,代碼來源:logging.py

示例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() 
開發者ID:mozilla,項目名稱:code-coverage,代碼行數:33,代碼來源:log.py

示例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() 
開發者ID:mozilla,項目名稱:code-review,代碼行數:33,代碼來源:log.py


注:本文中的raven.fetch_package_version方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。