hkc-8010 opened a new pull request, #69307:
URL: https://github.com/apache/airflow/pull/69307

   ## Summary
   
   - A single stored log entry with a non-string `event` field (for example, a 
task that
     logs a list or dict as the sole message argument) currently crashes the 
entire
     task-log-fetch request with an unhandled pydantic.ValidationError, instead 
of
     degrading gracefully.
   - `_read()` built `StructuredLogMessage` objects from stored OpenSearch hits 
without
     catching validation failures. This change catches `ValidationError` per 
hit and falls
     back to a stringified event, matching the existing fallback pattern in
     `file_task_handler.py`'s `_log_stream_to_parsed_log_stream`. The identical 
pattern was
     independently fixed in the Elasticsearch provider in #69306.
   
   ## Changes
   
   - 
`providers/opensearch/src/airflow/providers/opensearch/log/os_task_handler.py`:
     wrap `StructuredLogMessage` construction in a try/except `ValidationError` 
with a
     stringified-event fallback and a warning log.
   - `providers/opensearch/tests/unit/opensearch/log/test_os_task_handler.py`: 
add
     coverage for malformed `event` handling and for `read()` surviving one bad 
hit among
     otherwise-valid hits.
   
   ## PR Checklist
   
   - [x] My PR is targeted at the `main` branch
   - [x] Tests added/updated
   - [x] `prek` hooks all pass
   - [x] Unit tests pass locally
   
   Related: #69304


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