Python raven.fetch_package_version() Examples
The following are 4
code examples of raven.fetch_package_version().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
raven
, or try the search function
.
Example #1
Source File: app.py From crontabber with Mozilla Public License 2.0 | 6 votes |
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
Example #2
Source File: logging.py From autopush with Mozilla Public License 2.0 | 5 votes |
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
Example #3
Source File: log.py From code-coverage with Mozilla Public License 2.0 | 5 votes |
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()
Example #4
Source File: log.py From code-review with Mozilla Public License 2.0 | 5 votes |
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()