diff --git a/api/chalicelib/core/sessions/unprocessed_sessions.py b/api/chalicelib/core/sessions/unprocessed_sessions.py index 37fb9bdb0..0389722bc 100644 --- a/api/chalicelib/core/sessions/unprocessed_sessions.py +++ b/api/chalicelib/core/sessions/unprocessed_sessions.py @@ -1,6 +1,7 @@ import logging -from chalicelib.core import sessions, assist +from chalicelib.core import assist +from chalicelib.core.sessions import sessions logger = logging.getLogger(__name__) diff --git a/api/chalicelib/utils/ch_client.py b/api/chalicelib/utils/ch_client.py index d1ed07515..5fbaa5752 100644 --- a/api/chalicelib/utils/ch_client.py +++ b/api/chalicelib/utils/ch_client.py @@ -41,8 +41,7 @@ class ClickHouseClient: keys = tuple(x for x, y in results[1]) return [dict(zip(keys, i)) for i in results[0]] except Exception as err: - logger.error("--------- CH EXCEPTION -----------") - logger.error(err) + logger.error("--------- CH EXCEPTION -----------", exc_info=err) logger.error("--------- CH QUERY EXCEPTION -----------") logger.error(self.format(query=query, parameters=parameters) .replace('\n', '\\n') diff --git a/api/chalicelib/utils/ch_client_exp.py b/api/chalicelib/utils/ch_client_exp.py index f0d631420..36f6b3e7b 100644 --- a/api/chalicelib/utils/ch_client_exp.py +++ b/api/chalicelib/utils/ch_client_exp.py @@ -108,14 +108,14 @@ def make_pool(): try: CH_pool.close_all() except Exception as error: - logger.error("Error while closing all connexions to CH", error) + logger.error("Error while closing all connexions to CH", exc_info=error) try: CH_pool = ClickHouseConnectionPool(min_size=config("CH_MINCONN", cast=int, default=4), max_size=config("CH_MAXCONN", cast=int, default=8)) if CH_pool is not None: logger.info("Connection pool created successfully for CH") except ConnectionError as error: - logger.error("Error while connecting to CH", error) + logger.error("Error while connecting to CH", exc_info=error) if RETRY < RETRY_MAX: RETRY += 1 logger.info(f"waiting for {RETRY_INTERVAL}s before retry n°{RETRY}") @@ -174,4 +174,4 @@ async def terminate(): CH_pool.close_all() logger.info("Closed all connexions to CH") except Exception as error: - logger.error("Error while closing all connexions to CH", error) + logger.error("Error while closing all connexions to CH", exc_info=error) diff --git a/api/chalicelib/utils/pg_client.py b/api/chalicelib/utils/pg_client.py index fd47e5389..b47b2276a 100644 --- a/api/chalicelib/utils/pg_client.py +++ b/api/chalicelib/utils/pg_client.py @@ -62,7 +62,7 @@ def make_pool(): try: postgreSQL_pool.closeall() except (Exception, psycopg2.DatabaseError) as error: - logger.error("Error while closing all connexions to PostgreSQL", error) + logger.error("Error while closing all connexions to PostgreSQL", exc_info=error) try: postgreSQL_pool = ORThreadedConnectionPool(config("PG_MINCONN", cast=int, default=4), config("PG_MAXCONN", cast=int, default=8), @@ -70,7 +70,7 @@ def make_pool(): if postgreSQL_pool is not None: logger.info("Connection pool created successfully") except (Exception, psycopg2.DatabaseError) as error: - logger.error("Error while connecting to PostgreSQL", error) + logger.error("Error while connecting to PostgreSQL", exc_info=error) if RETRY < RETRY_MAX: RETRY += 1 logger.info(f"waiting for {RETRY_INTERVAL}s before retry n°{RETRY}") @@ -123,7 +123,7 @@ class PostgresClient: if not self.use_pool or self.long_query or self.unlimited_query: self.connection.close() except Exception as error: - logger.error("Error while committing/closing PG-connection", error) + logger.error("Error while committing/closing PG-connection", exc_info=error) if str(error) == "connection already closed" \ and self.use_pool \ and not self.long_query \ @@ -150,7 +150,7 @@ class PostgresClient: try: self.connection.rollback() except psycopg2.InterfaceError as e: - logger.error("!!! Error while rollbacking connection", e) + logger.error("!!! Error while rollbacking connection", exc_info=e) logger.error("!!! Trying to recreate the cursor") self.recreate_cursor() raise error @@ -161,11 +161,11 @@ class PostgresClient: try: self.connection.rollback() except Exception as error: - logger.error("Error while rollbacking connection for recreation", error) + logger.error("Error while rollbacking connection for recreation", exc_info=error) try: self.cursor.close() except Exception as error: - logger.error("Error while closing cursor for recreation", error) + logger.error("Error while closing cursor for recreation", exc_info=error) self.cursor = None return self.__enter__() @@ -183,4 +183,4 @@ async def terminate(): postgreSQL_pool.closeall() logger.info("Closed all connexions to PostgreSQL") except (Exception, psycopg2.DatabaseError) as error: - logger.error("Error while closing all connexions to PostgreSQL", error) + logger.error("Error while closing all connexions to PostgreSQL", exc_info=error) diff --git a/ee/api/chalicelib/core/sessions/sessions_favorite_ee.py b/ee/api/chalicelib/core/sessions/sessions_favorite_ee.py index afd2427b7..0b3d1b065 100644 --- a/ee/api/chalicelib/core/sessions/sessions_favorite_ee.py +++ b/ee/api/chalicelib/core/sessions/sessions_favorite_ee.py @@ -2,13 +2,14 @@ import logging from decouple import config -from chalicelib.utils import ch_client, exp_ch_helper - -logger = logging.getLogger(__name__) +import schemas from chalicelib.core.sessions import sessions_mobs, sessions_devtool -from chalicelib.core.sessions.sessions_favorite import * +from chalicelib.core.sessions.sessions_favorite import add_favorite_session, remove_favorite_session, \ + favorite_session_exists +from chalicelib.utils import ch_client, exp_ch_helper from chalicelib.utils.storage import extra +logger = logging.getLogger(__name__) _add_favorite_session = add_favorite_session _remove_favorite_session = remove_favorite_session