pierrejeambrun commented on code in PR #46827:
URL: https://github.com/apache/airflow/pull/46827#discussion_r1969428822


##########
providers/elasticsearch/src/airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -358,12 +371,31 @@ def _read(
 
         # If we hit the end of the log, remove the actual end_of_log message
         # to prevent it from showing in the UI.
-        def concat_logs(hits: list[Hit]):
+        def concat_logs(hits: list[Hit]) -> str:
             log_range = (len(hits) - 1) if hits[-1].message == 
self.end_of_log_mark else len(hits)
             return "\n".join(self._format_msg(hits[i]) for i in 
range(log_range))
 
         if logs_by_host:
-            message = [(host, concat_logs(hits)) for host, hits in 
logs_by_host.items()]
+            if AIRFLOW_V_3_0_PLUS:
+                from airflow.utils.log.file_task_handler import 
StructuredLogMessage
+
+                header = [
+                    StructuredLogMessage.model_construct(

Review Comment:
   I think it's worth confirming with Ash that this is intentional. There are 
other places I see why we do that, but for the header I'm not sure. Maybe it's 
because of the `sources` but since the model allow `extras` it shouldn't be a 
problem to validate.
   
   Otherwise looks good to me.



-- 
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]

Reply via email to