Skip to content

Commit

Permalink
Query Collector: Make table schema configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jan 13, 2025
1 parent cf91fb8 commit 15b3c38
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions cratedb_toolkit/wtf/query_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@
logger = logging.getLogger(__name__)

cratedb_sqlalchemy_url = os.getenv("CRATEDB_SQLALCHEMY_URL", "crate://crate@localhost:4200")
uri = DatabaseAddress.from_string(cratedb_sqlalchemy_url)
host = f"{uri.uri.host}:{uri.uri.port}"
username = uri.uri.username
password = uri.uri.password
address = DatabaseAddress.from_string(cratedb_sqlalchemy_url)
host = f"{address.uri.host}:{address.uri.port}"
username = address.uri.username
password = address.uri.password
_, table_address = address.decode()
schema = table_address.schema or "stats"

interval = float(os.getenv("INTERVAL", 10))
stmt_log_table = os.getenv("STMT_TABLE", "stats.statement_log")
last_exec_table = os.getenv("LAST_EXEC_TABLE", "stats.last_execution")
stmt_log_table = os.getenv("STMT_TABLE", f"{schema}.statement_log")
last_exec_table = os.getenv("LAST_EXEC_TABLE", f"{schema}.last_execution")
last_execution_ts = 0
sys_jobs_log = {}
bucket_list = [10, 50, 100, 500, 1000, 2000, 5000, 10000, 15000, 20000]
Expand Down

0 comments on commit 15b3c38

Please sign in to comment.