You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by pi...@apache.org on 2025/10/31 13:16:40 UTC
(airflow) branch v3-1-test updated: [v3-1-test] Add number of queries guard in public event logs list endpoints (#57508) (#57558)
This is an automated email from the ASF dual-hosted git repository.
pierrejeambrun pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 297ef8a580b [v3-1-test] Add number of queries guard in public event logs list endpoints (#57508) (#57558)
297ef8a580b is described below
commit 297ef8a580b8cee486f9fa1cf2462b56e148b4fb
Author: github-actions[bot] <41...@users.noreply.github.com>
AuthorDate: Fri Oct 31 14:16:32 2025 +0100
[v3-1-test] Add number of queries guard in public event logs list endpoints (#57508) (#57558)
(cherry picked from commit 2199c7ad9e262728d699a831d9be271b1a2e4a01)
Co-authored-by: Pierre Jeambrun <pi...@gmail.com>
---
.../src/airflow/api_fastapi/core_api/routes/public/event_logs.py | 2 +-
.../tests/unit/api_fastapi/core_api/routes/public/test_event_logs.py | 4 +++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/event_logs.py b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/event_logs.py
index 1bce6a65a50..8909b5ff1bc 100644
--- a/airflow-core/src/airflow/api_fastapi/core_api/routes/public/event_logs.py
+++ b/airflow-core/src/airflow/api_fastapi/core_api/routes/public/event_logs.py
@@ -128,7 +128,7 @@ def get_event_logs(
event_pattern: Annotated[_SearchParam, Depends(search_param_factory(Log.event, "event_pattern"))],
) -> EventLogCollectionResponse:
"""Get all Event Logs."""
- query = select(Log)
+ query = select(Log).options(joinedload(Log.task_instance), joinedload(Log.dag_model))
event_logs_select, total_entries = paginated_select(
statement=query,
order_by=order_by,
diff --git a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_event_logs.py b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_event_logs.py
index 881ca6dc310..e46a355c0f7 100644
--- a/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_event_logs.py
+++ b/airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_event_logs.py
@@ -23,6 +23,7 @@ import pytest
from airflow.models.log import Log
from airflow.utils.session import provide_session
+from tests_common.test_utils.asserts import assert_queries_count
from tests_common.test_utils.db import clear_db_logs, clear_db_runs
from tests_common.test_utils.format_datetime import from_datetime_to_zulu, from_datetime_to_zulu_without_ms
@@ -315,7 +316,8 @@ class TestGetEventLogs(TestEventLogsEndpoint):
def test_get_event_logs(
self, test_client, query_params, expected_status_code, expected_total_entries, expected_events
):
- response = test_client.get("/eventLogs", params=query_params)
+ with assert_queries_count(2):
+ response = test_client.get("/eventLogs", params=query_params)
assert response.status_code == expected_status_code
if expected_status_code != 200:
return