Example #1
0
 def setUp(self):
     import vumi.sentry
     self.client = DummySentryClient()
     self.patch(vumi.sentry, 'vumi_raven_client', lambda dsn: self.client)
     self.logger = LogPublisher()
     self.service = SentryLoggerService("http://example.com/",
                                        "test.logger",
                                        "worker-1",
                                        logger=self.logger)
Example #2
0
    def makeService(self, options):
        sentry_dsn = options.vumi_options.pop('sentry', None)
        class_name = options.worker_class.rpartition('.')[2].lower()
        logger_name = options.worker_config.get('worker_name', class_name)
        system_id = options.vumi_options.get('system-id', 'global')
        worker_id = generate_worker_id(system_id, logger_name)

        worker_creator = WorkerCreator(options.vumi_options)
        worker = worker_creator.create_worker(options.worker_class,
                                              options.worker_config)

        if sentry_dsn is not None:
            sentry_service = SentryLoggerService(sentry_dsn, logger_name,
                                                 worker_id)
            worker.addService(sentry_service)

        return worker