Beispiel #1
0
def insert_log(
    alias: str,
    schema: str,
    table: str,
    num: int,
    type_: int,
):
    if not Settings.monitoring():
        return
    from synch.factory import get_writer

    now = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    sql = f"""INSERT INTO synch.log (alias, schema, table, num, type, created_at) VALUES ('{alias}', '{schema}', '{table}', {num}, {type_}, '{now}')"""
    get_writer().execute(sql)
Beispiel #2
0
def init(config_file):
    """
    init
    """
    Settings.init(config_file)
    init_logging()
    dsn = Settings.get("sentry", "dsn")
    if dsn:
        import sentry_sdk
        from sentry_sdk.integrations.redis import RedisIntegration

        sentry_sdk.init(
            dsn,
            environment=Settings.get("sentry", "environment"),
            integrations=[RedisIntegration()],
        )
    if Settings.monitoring():
        init_monitor_db()