From 0100a8e0b255737330f1b5f5c45a5e0f154cacd6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 00:30:39 +0000 Subject: [PATCH 1/4] Snapshot: 24.08.0-dev --- package.json | 2 +- pyproject.toml | 2 +- redash/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 06422d1d68..b5d5e9443c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "redash-client", - "version": "24.07.0-dev", + "version": "24.08.0-dev", "description": "The frontend part of Redash.", "main": "index.js", "scripts": { diff --git a/pyproject.toml b/pyproject.toml index 74d1ad7435..97df8d94b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ force-exclude = ''' [tool.poetry] name = "redash" -version = "24.07.0-dev" +version = "24.08.0-dev" description = "Make Your Company Data Driven. Connect to any data source, easily visualize, dashboard and share your data." authors = ["Arik Fraimovich "] # to be added to/removed from the mailing list, please reach out to Arik via the above email or Discord diff --git a/redash/__init__.py b/redash/__init__.py index 16ebb66f91..58027b050e 100644 --- a/redash/__init__.py +++ b/redash/__init__.py @@ -14,7 +14,7 @@ from redash.destinations import import_destinations from redash.query_runner import import_query_runners -__version__ = "24.07.0-dev" +__version__ = "24.08.0-dev" if os.environ.get("REMOTE_DEBUG"): From 43940efd8eebacd1da58cb1bc1fa9dcc401ef7a6 Mon Sep 17 00:00:00 2001 From: zachliu Date: Wed, 7 Aug 2024 14:20:31 -0400 Subject: [PATCH 2/4] consolidate logs for query execution logs should be informative --- redash/tasks/queries/execution.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/redash/tasks/queries/execution.py b/redash/tasks/queries/execution.py index a863903cdb..c834085c87 100644 --- a/redash/tasks/queries/execution.py +++ b/redash/tasks/queries/execution.py @@ -217,17 +217,10 @@ def run(self): run_time = time.time() - started_at - logger.info( - "job=execute_query query_hash=%s ds_id=%d data_length=%s error=[%s]", - self.query_hash, - self.data_source_id, - data and _get_size_iterative(data), - error, - ) - _unlock(self.query_hash, self.data_source.id) if error is not None and data is None: + self._log_progress("error", error=error) result = QueryExecutionError(error) if self.is_scheduled_query: self.query_model = models.db.session.merge(self.query_model, load=False) @@ -256,7 +249,11 @@ def run(self): self._log_progress("checking_alerts") for query_id in updated_query_ids: check_alerts_for_query.delay(query_id, self.metadata) - self._log_progress("finished") + self._log_progress( + "finished", + data_length=_get_size_iterative(data), + run_time=run_time, + ) result = query_result.id models.db.session.commit() @@ -269,18 +266,22 @@ def _annotate_query(self, query_runner): return query_runner.annotate_query(self.query, self.metadata) - def _log_progress(self, state): + def _log_progress(self, state, data_length=0, run_time=0, error=None): logger.info( "job=execute_query state=%s query_hash=%s type=%s ds_id=%d " - "job_id=%s queue=%s query_id=%s username=%s", # fmt: skip + "data_length=%s job_id=%s queue=%s query_id=%s username=%s" + "query_runtime=%.2f error=[%s]", # fmt: skip state, self.query_hash, self.data_source.type, self.data_source.id, + data_length, self.job.id, self.metadata.get("Queue", "unknown"), self.metadata.get("query_id", "unknown"), self.metadata.get("Username", "unknown"), + run_time, + error, ) def _load_data_source(self): From 1b16269b7ce9efc20733c04141cad2cdefb66eed Mon Sep 17 00:00:00 2001 From: zachliu Date: Fri, 9 Aug 2024 12:09:59 -0400 Subject: [PATCH 3/4] add missing space --- redash/tasks/queries/execution.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redash/tasks/queries/execution.py b/redash/tasks/queries/execution.py index c834085c87..01cb93cfb9 100644 --- a/redash/tasks/queries/execution.py +++ b/redash/tasks/queries/execution.py @@ -269,7 +269,7 @@ def _annotate_query(self, query_runner): def _log_progress(self, state, data_length=0, run_time=0, error=None): logger.info( "job=execute_query state=%s query_hash=%s type=%s ds_id=%d " - "data_length=%s job_id=%s queue=%s query_id=%s username=%s" + "data_length=%s job_id=%s queue=%s query_id=%s username=%s " "query_runtime=%.2f error=[%s]", # fmt: skip state, self.query_hash, From f6eacfa0b5ee530c9214831e6b32c28a88877fe7 Mon Sep 17 00:00:00 2001 From: zachliu Date: Tue, 13 Aug 2024 15:18:38 -0400 Subject: [PATCH 4/4] add data_source name to the log it's more readable than data_source id --- redash/tasks/queries/execution.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/redash/tasks/queries/execution.py b/redash/tasks/queries/execution.py index 01cb93cfb9..8118bf81ec 100644 --- a/redash/tasks/queries/execution.py +++ b/redash/tasks/queries/execution.py @@ -268,13 +268,14 @@ def _annotate_query(self, query_runner): def _log_progress(self, state, data_length=0, run_time=0, error=None): logger.info( - "job=execute_query state=%s query_hash=%s type=%s ds_id=%d " - "data_length=%s job_id=%s queue=%s query_id=%s username=%s " + "job=execute_query state=%s query_hash=%s type=%s ds_id=%d ds_name" + "=%s data_length=%s job_id=%s queue=%s query_id=%s username=%s " "query_runtime=%.2f error=[%s]", # fmt: skip state, self.query_hash, self.data_source.type, self.data_source.id, + self.data_source.name, data_length, self.job.id, self.metadata.get("Queue", "unknown"),