def __init__(self, *, app_name, sentry_config): self.app_name = app_name self.app_request_metric = "{}_request".format(app_name) self.app = aiohttp.web.Application() self.app.on_startup.append(self.create_http_client) self.app.on_cleanup.append(self.cleanup_http_client) self.http_client_v = None self.http_client_no_v = None self.log = logging.getLogger(self.app_name) self.stats = StatsClient(sentry_config=sentry_config) self.raven_client = self.stats.raven_client self.app.on_cleanup.append(self.cleanup_stats_client)
def __init__(self, config, master_coordinator=None): Thread.__init__(self) self.master_coordinator = master_coordinator self.log = logging.getLogger("KafkaSchemaReader") self.timeout_ms = 200 self.config = config self.subjects = {} self.schemas: Dict[int, TypedSchema] = {} self.global_schema_id = 0 self.offset = 0 self.admin_client = None self.schema_topic = None self.topic_replication_factor = self.config["replication_factor"] self.consumer = None self.queue = Queue() self.ready = False self.running = True self.id_lock = Lock() sentry_config = config.get("sentry", {"dsn": None}).copy() if "tags" not in sentry_config: sentry_config["tags"] = {} self.stats = StatsClient(sentry_config=sentry_config)