VladaZakharova commented on code in PR #68293:
URL: https://github.com/apache/airflow/pull/68293#discussion_r4157568472
##########
providers/google/src/airflow/providers/google/cloud/log/stackdriver_task_handler.py:
##########
@@ -317,15 +349,23 @@ def _read_single_logs_page(self, log_filter: str,
page_token: str | None = None)
def _task_instance_to_labels(ti) -> dict[str, str]:
"""Convert a task instance to Stackdriver labels."""
- return {
- LABEL_TASK_ID: ti.task_id,
- LABEL_DAG_ID: ti.dag_id,
- LABEL_LOGICAL_DATE: str(ti.logical_date.isoformat())
- if AIRFLOW_V_3_0_PLUS
- else str(ti.execution_date.isoformat()),
+ labels = {
+ LABEL_TASK_ID: str(ti.task_id),
+ LABEL_DAG_ID: str(ti.dag_id),
LABEL_TRY_NUMBER: str(ti.try_number),
}
+ ti_id = getattr(ti, "id", None)
Review Comment:
Could we ensure we guard this with getattr(ti, 'task_instance_id', None) (or
equivalent) in case the passed TaskInstance object doesn't have the attribute
populated, ensuring it falls back cleanly to the legacy label filter?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]